This repo uses a unified long-context synthesis pipeline to convert standard QA examples into single long documents by mixing gold evidence with many in-domain distractors. The goal is a controlled setting where the answer is always supported by gold evidence, while retrieval difficulty scales with context length.
Each synthesized instance follows the same supervision format:
QAD_gold (documents/paragraphs annotated by the source dataset)D_dist (sampled from the same dataset corpus)For each original QA instance:
Q, D_gold, and D_dist (in-domain distractors).We sample distractors from the same corpus to preserve domain/style match, making retrieval harder than mixing out-of-domain noise.
We adopt a two-stage training scheme to reliably execute the PreThink–Retrieve–Write protocol under a bounded-memory constraint:
We synthesize cold-start SFT data following the NIAH-style long-context QA construction used in MemAgent.
We use Qwen3-32B (thinking enabled) as a teacher to generate interaction traces that follow PreThink–Retrieve–Write:
We distill trajectories into the following student backbones:
MuSiQue provides optional multi-hop decompositions (sub-questions). We feed decompositions only to the teacher to elicit cleaner planning traces.
Students never observe decompositions, gold document IDs, or teacher-side annotations during training or inference.
To ensure supervision quality:
After filtering, we decompose successful traces into turns, yielding 29,717 single-turn dialogue instances for SFT.
For RL training, we apply the same synthesis pipeline to extend HotpotQA instances to ~28K tokens:
RL focuses on improving agent control decisions under long contexts (retrieval timing, memory management, early stopping) while keeping the environment consistent with SFT.
To evaluate robustness under extreme context lengths, we create synthesized long-context benchmarks from:
For each fixed set of questions, we generate multiple variants at increasing target lengths, e.g.:
Gold evidence is inserted once per instance (fixed seed), and distractors are sampled from the same corpus.
This ensures that differences across lengths reflect context scaling only (more distractors / longer inputs), not changes in questions or evidence.
If you find this work useful, please consider citing our paper:
@misc{wang2026infmemlearningsystem2memory,
title={InfMem: Learning System-2 Memory Control for Long-Context Agent},
author={Xinyu Wang and Mingze Li and Peng Lu and Xiao-Wen Chang and Lifeng Shang and Jinping Li and Fei Mi and Prasanna Parthasarathi and Yufei Cui},
year={2026},
eprint={2602.02704},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2602.02704},
}
3 commits
This repo uses a unified long-context synthesis pipeline to convert standard QA examples into single long documents by mixing gold evidence with many in-domain distractors. The goal is a controlled setting where the answer is always supported by gold evidence, while retrieval difficulty scales with context length.
Each synthesized instance follows the same supervision format:
QAD_gold (documents/paragraphs annotated by the source dataset)D_dist (sampled from the same dataset corpus)For each original QA instance:
Q, D_gold, and D_dist (in-domain distractors).We sample distractors from the same corpus to preserve domain/style match, making retrieval harder than mixing out-of-domain noise.
We adopt a two-stage training scheme to reliably execute the PreThink–Retrieve–Write protocol under a bounded-memory constraint:
We synthesize cold-start SFT data following the NIAH-style long-context QA construction used in MemAgent.
We use Qwen3-32B (thinking enabled) as a teacher to generate interaction traces that follow PreThink–Retrieve–Write:
We distill trajectories into the following student backbones:
MuSiQue provides optional multi-hop decompositions (sub-questions). We feed decompositions only to the teacher to elicit cleaner planning traces.
Students never observe decompositions, gold document IDs, or teacher-side annotations during training or inference.
To ensure supervision quality:
After filtering, we decompose successful traces into turns, yielding 29,717 single-turn dialogue instances for SFT.
For RL training, we apply the same synthesis pipeline to extend HotpotQA instances to ~28K tokens:
RL focuses on improving agent control decisions under long contexts (retrieval timing, memory management, early stopping) while keeping the environment consistent with SFT.
To evaluate robustness under extreme context lengths, we create synthesized long-context benchmarks from:
For each fixed set of questions, we generate multiple variants at increasing target lengths, e.g.:
Gold evidence is inserted once per instance (fixed seed), and distractors are sampled from the same corpus.
This ensures that differences across lengths reflect context scaling only (more distractors / longer inputs), not changes in questions or evidence.
If you find this work useful, please consider citing our paper:
@misc{wang2026infmemlearningsystem2memory,
title={InfMem: Learning System-2 Memory Control for Long-Context Agent},
author={Xinyu Wang and Mingze Li and Peng Lu and Xiao-Wen Chang and Lifeng Shang and Jinping Li and Fei Mi and Prasanna Parthasarathi and Yufei Cui},
year={2026},
eprint={2602.02704},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2602.02704},
}
3 commits