Dual-Cluster Memory Agent for LLMs
- DCM-Agent is a memory-augmented LLM design that decouples problem modeling from code generation using a dual-cluster memory structure.
- It employs structured retrieval, verification, and repair strategies to dynamically select optimal solution paths and significantly improve performance.
- Empirical evaluations show improvements up to 21 percentage points, with knowledge inheritance enabling smaller models to benefit from high-quality memory archives.
The Dual-Cluster Memory Agent (DCM-Agent) is a memory-augmented agent design for LLMs that systematically addresses multi-paradigm ambiguity in optimization problem solving and related domains. DCM-Agent leverages a two-cluster memory structure—decoupling modeling and coding knowledge—and augments inference with structured retrieval, verification, and repair capabilities. This architecture is training-free and emphasizes plug-and-play extensibility, delivering significant accuracy improvements over baseline LLM prompting and centralized memory methods (Zhang et al., 22 Apr 2026, Hao et al., 21 May 2026).
1. Problem Setting and Architectural Motivation
LLMs face challenges in tasks characterized by structural ambiguity, where a single problem can admit multiple, sometimes conflicting, mathematical modeling paradigms (e.g., combinatorial (CP), integer linear programming (ILP), dynamic programming (DP)). End-to-end LLMs are prone to paradigm lock-in or spurious hybridizations, and retraining alone does not overcome such ambiguity. DCM-Agent is designed to:
- Explicitly decouple problem modeling (mapping a problem to a formalization ) from subsequent code generation (mapping to executable code ).
- Utilize a persistent, structured memory of prior solutions and errors decoupled into modeling and coding domains.
- Provide paradigm-specific checks and repair strategies during inference, utilizing distilled collective knowledge from both successful and failed prior attempts (Zhang et al., 22 Apr 2026).
2. Dual-Cluster Memory Construction
2.1 Node-Level Extraction
DCM-Agent maintains an archive of solved problem–solution trajectories. Each trajectory is decomposed into:
- Modeling logic (problem formalization)
- Code (concrete implementation)
Solutions are assigned a type: Always Correct (A), Recovered (B), or Persistent Failure (C). Each yields instance-level guidance :
- Approach: canonical problem-solving template
- Checklist: minimal validity check
- Pitfall: common failure mode
Type A/B provide Approach/Checklist knowledge; Type B/C yield Pitfall knowledge.
2.2 Cluster Assignment and Evolution
Nodes are clustered independently for modeling () and coding (0) via embedding-based retrieval followed by LLM-based semantic verification. Cluster-level knowledge is synthesized as:
- 1
Clusters are abstracted and merged whenever they accrue 2 new entries, propagating patterns and best practices. Each problem–solution node forms an edge in a weighted bipartite graph 3 linking modeling and coding clusters, accumulating co-occurrence statistics for efficient retrieval and trajectory construction (Zhang et al., 22 Apr 2026).
3. Memory-Augmented Inference Pipeline
When presented with a new task 4, DCM-Agent executes the following structured pipeline:
- Dual Retrieval: Queries both instance-level examples (by embedding similarity) and cluster-level centroids to assemble relevant modeling clusters. For each identified modeling cluster, retrieves top coding neighbors in 5.
- Path Selection: Considers a pool of trajectories, ranked by an LLM selector, for candidate model–code derivations.
- Generate-Verify-Repair-Backtrack:
- Generates modeling logic using 6, then verifies against 7.
- Generates code conditional on the verified model, then verifies using coding cluster's checklist, and executes.
- Upon error, attempts targeted repair using 8 and checklist knowledge. If repair fails within budgeted attempts, backtracks to an alternative path.
This structured enumeration, verification, and repair scheme enables robust dynamic switching among solution paths and avoids lock-in to suboptimal or failing paradigms (Zhang et al., 22 Apr 2026).
4. Empirical Evaluation and Knowledge Inheritance
DCM-Agent has been benchmarked on seven optimization and reasoning datasets, spanning mathematical programming (NL4Opt, ComplexLP, IndustryOR), logic programming (NLP4LP), open-domain reasoning (OptiBench, OptMATH), and other complex tasks, totaling over 1,500 instances (Zhang et al., 22 Apr 2026).
Main Results (Selected)
| Model | Baseline (%) | DCM-Agent (%) | Improvement (points) |
|---|---|---|---|
| Qwen3-8B | 27.99 | 49.43 | +21.44 |
| Qwen3-30B | 40.52 | 59.61 | +19.09 |
| Qwen3-235B | 57.74 | 71.28 | +13.54 |
| Deepseek-V3.2 | 57.61 | 71.47 | +13.86 |
| GPT-5.1 | 67.62 | 78.50 | +10.88 |
Average gains across tasks range from 11–21%.
Knowledge Inheritance
A salient feature is "knowledge inheritance": memory constructed by a strong LLM (e.g., Qwen3-235B) can be utilized by a smaller LLM (e.g., Qwen3-8B), substantially improving weaker model performance (e.g., NLP4LP: 35.12% 9 62.40%, OptiBench: 30.58% 0 55.37%, OptMATH: 10.24% 1 21.69%), evidencing the decoupling of memory construction and inference as a robust transferability mechanism (Zhang et al., 22 Apr 2026).
5. Comparative Analyses and Ablation Studies
Ablation experiments confirm both memory clusters are necessary: removing either cluster (modeling or coding) causes marked performance drops, especially when modeling knowledge is absent. Performance scales with memory size (number of stored nodes), and parameter sweeps identify efficient operating points for retrieval and re-synthesis (optimum at 2). DCM-Agent achieves competitive runtime, typically occupying the middle ground between pure prompting and compute-intensive techniques like Monte Carlo Tree Search; for instance, solving NLP4LP with Qwen3-235B requires 22.1 seconds (DCM-Agent) vs. 85.3 seconds (AF-MCTS), without accuracy loss (Zhang et al., 22 Apr 2026).
6. Key Characteristics, Limitations, and Extensions
Scalability and Training-Free Deployment
DCM-Agent is designed for training-free extension: memory archives can be incrementally expanded, and existing clusters refined as more data is acquired. No additional supervised or reinforcement learning is required.
Balanced Flexibility and Structure
The dual-cluster paradigm supports dynamic paradigm switching, facilitating robustness against multi-paradigm ambiguity and preventing suboptimal solution lock-in.
Limitations
The one-time memory construction phase is computationally non-trivial but amortizes over repeated inference. Real-time or online updating remains an open direction for reducing amortization latency.
Extensions
Proposed directions include:
- Online memory evolution via continual feedback.
- Enrichment of the bipartite memory graph to capture sub-cluster transitions and finer solution structure.
- Generalization to domains beyond optimization, such as theorem proving and diagnostic reasoning (Zhang et al., 22 Apr 2026).
7. Position Within the Broader Memory-Augmented LLM Landscape
DCM-Agent embodies the principle of structured, persistent, and decoupled guidance within the rises of LLM memory augmentation methods. Related approaches include dual-process retrieval-for-reasoning systems with quality gating (You et al., 19 Mar 2026) and dual-memory continual learning frameworks for diagnostic reasoning (Li et al., 8 Apr 2026). In multi-agent contexts, decentralized dual-pool (exploitation/exploration) memory architectures guarantee search reachability and order-optimal cumulative regret, further supporting the scalability and adaptability of dual-cluster paradigms (Hao et al., 21 May 2026).
In summary, DCM-Agent delivers a principled, empirically validated framework for resolving paradigm ambiguity and enhancing inference robustness in memory-augmented LLM architectures, underpinned by structured dual-cluster organization, dynamic retrieval and repair, and transferable knowledge inheritance (Zhang et al., 22 Apr 2026).