A multi-agent system with a three-layer memory keeps long projects on track and improves model selection in drug modeling tests
Large language models are powerful but forgetful across long projects. This paper presents Ensemble QSP, a multi-agent system that limits the amount of text each model must hold at once. By keeping the injected context small and structured, the system aims to run multi-session computational modeling workflows without losing earlier work or degrading performance.
The core idea is a three-layer hierarchical memory. The short-term layer holds the immediate working context: a fixed recent conversation window, a capped scratchpad for exact facts and file pointers, and a tiny buffer of recent task outcomes. The mid-term layer is a compact, structured project-state JSON that contains only task-relevant slices (for example, the five most recent active requests and the 20 most recently modified files). The authors report a median mid-term state size of 301 tokens (interquartile range 215–478; maximum 4,050) across 104 runs. The long-term layer stores domain knowledge such as a ~24,000-character handbook, physics checklists, and retrieved source papers that are injected only when needed. Because completed work is evicted, the injected context stays bounded instead of growing with every session.
Ensemble QSP organizes work with a principal investigator (PI) agent overseeing five specialist sub-agents. The specialists have distinct roles: Optimization (parameter fitting), Modeling (writing and implementing equations), Reporting (analysis and write-up), Infrastructure (literature and compute management), and Review (code quality). The system also enforces physical constraints using domain JSON files, physics checklists, and retrieval-augmented comparison to source material to reduce the chance of physically implausible outputs. The authors say this structure is domain-agnostic: adding a new scientific area only requires a new PI configuration.