From Flat Storage to Structured Graphs: Adaptive Memory for Domain-Specific LLM Reasoning
Abstract
Large language models (LLMs) achieve strong general performance but struggle in specialized domains requiring structured, evolving knowledge. Existing context adaptation frameworks, such as Dynamic Cheatsheet and Agentic Context Engineering (ACE), accumulate domain knowledge as flat bullet-point lists, ignoring the relational structure inherent to many knowledge-intensive fields. We present Graph-Structured Adaptive Memory (GSAM), a framework that replaces flat storage with an ontology-grounded knowledge graph, enabling principled cross-concept transfer, explicit failure-cascade modeling, and structurally-aware retrieval. GSAM extends the ACE architecture with two new components, a Graph Constructor and a Graph Retriever, operating over a domain ontology layer pre-populated from the XBRL financial taxonomy. Evaluated on financial numeric entity recognition (FiNER) and formula reasoning tasks, GSAM achieves $\mathbf{6 4. 0 {\%}}$ and $\mathbf{6 5. 0 {\%}}$ accuracy, respectively, in the online setting, surpassing ACE by 11.0% on both benchmarks, and reaches 71.0% and 81.0% in the offline setting. On the newly introduced FiNER-Transfer benchmark, GSAM achieves a near-transfer rate of $\mathbf{6 4. 3 {\%}}$ compared to 26.2% for ACE, with negative transfer reduced from 19.0% to 7.1%. Retrieval precision improves nearly fourfold, from 6.5% to 25.2%, and the repeated failure rate is reduced by 54.9%.