Long-horizon language-model agents accumulate increasingly large interaction histories, making context compaction essential for efficient execution. Existing learned compaction methods often rely on downstream task outcomes or solver behavior, coupling training to specific tasks or agents. We introduce SumOne, a standalone summarizer trained to preserve information in agent histories through masked reconstruction. Given a summary of the expired history, a frozen reconstructor recovers randomly masked portions of the original trajectory; reconstruction quality, combined with a length penalty, provides a task-agnostic reward for optimizing the summarizer with GRPO. This yields self-supervision directly from raw trajectories, without reference summaries or downstream task execution. At inference time, only the lightweight summarizer is retained, enabling plug-and-play context compression for otherwise unchanged agents. We conduct a systematic evaluation of SumOne in long-horizon search and software-engineering tasks. SumOne reduces estimated inference cost by approximately 78% on DeepSearchQA and 75% on SWE-bench Verified relative to operating with full context, with absolute decreases of 0.04. The same checkpoint also transfers across downstream models and agent harnesses without additional fine-tuning.
Figures & tables
Figure 1: SumOne is an efficient and scalable memory compressor for long-horizon agents. (a) A single 2B SumOne , trained solely from raw trajectories, can be plugged into different tasks, downstream models, and agent harnesses without specific adaptation. (b) SumOne consistently improves over self-summary in both task performance and inference cost, yielding a better performance–cost trade-off. The y -axis shows task success rate (resolved rate) on the SWE-bench Verified ( Jimenez et al., 2024a ) benchmark, while the x -axis shows total inference cost per query normalized by that of self-summary.
Figure 2: Overview of SumOne . The summarizer compresses the expired history into a short summary. A frozen reconstructor then attempts to recover masked parts of the original history conditioned on the summary and retained context, and the reconstruction score (with a length penalty) provides the reward to optimize the summarizer.
DeepSearchQA
Method
Score ↑
C. Ratio ↑
Input Tok. ↓
Sum. Cost ↓
Total Cost ↓
Comp./Q ↓
Full History
0.52
–
2.83M
–
$0.170
–
Recent Truncation
0.16
–
752K
–
$0.047
1.24
Self-Summary
0.44
91%
652K
$0.002
$0.044
1.68
Prompt-2B
0.29
92%
468K
$0.001
$0.031
1.24
CoMem
0.32
88%
577K
$0.001
$0.036
1.48
Table 1: Main results on DeepSearchQA and SWE-bench Verified. Score denotes task performance, measured by F1 on DeepSearchQA and the resolved rate on SWE-bench Verified. C. Ratio, Input Tok., Sum. Cost, Total Cost, and Comp./Q denote the compression ratio, the number of input tokens consumed by the agent, the summarization cost per query, the total inference cost per query, and the average number of compactions per query, respectively. Costs are reported in USD.
Table 4
Method
Overall ↑
Single ↑
Multi ↑
Temporal ↑
Update ↑
Sum. Cost ↓
C. Ratio ↑
Oracle
0.85
0.94
0.72
0.8
0.93
–
–
Full History
0.77
0.81
0.5
0.8
0.86
–
–
Prompt-2B
0.43
0.38
0.51
0.38
0.24
0.003
94%
CoMem
0.31
0.41
0.08
0.24
0.61
0.003
93%
SumOne
0.47
0.48
0.41
0.36
0.43
0.003
89%
Table 4: Isolated memory evaluation on LongMemEval-S. Single , Multi , Temporal , and Update denote single-session retrieval, multi-session reasoning, temporal reasoning, and knowledge-update questions, respectively. Sum. Cost denotes the normalized cost of memory summarization, and C. Ratio denotes compression ration defined in Section 4.1.
Downstream Agent Tasks
LongMemEval-S
Method
DSQA ↑
SWE ↑
Overall ↑
Single ↑
Multi ↑
Temp. ↑
Update ↑
Full History
0.52
0.63
0.77
0.81
0.5
0.8
0.86
Prompt-2B
0.29
0.51
0.43
0.38
0.51
0.38
0.24
Summ.-Judge-RL
0.41
0.54
0.36
0.40
0.14
0.31
0.71
Recon-RL (ours)
0.48
0.59
0.47
0.48
0.41
0.36
0.43
Table 5: Ablation on the training objective. All compressed variants use the same Qwen3.5-2B initialization and are evaluated under the same compression setting. We report downstream performance on DeepSearchQA and SWE-bench, together with direct memory evaluation on LongMemEval-S. Full History provides an uncompressed reference.
Table 6: Ablation on mask ratio and length penalty. We report performance on DeepSearchQA (DSQA) and LongMemEval-S (LongMem).
Hyperparameter
Value
Model and System
Base model
Qwen3.5-2B
Training framework
veRL
Hardware
8 × H20-141G
Sharding
FSDP full shard
Gradient checkpointing
Yes
Table 7: Training configuration and hyperparameters of SumOne .
Full History
Self-Summary
SumOne
Model
Score ↑
Cost ↓
Score ↑
Cost ↓
Score ↑
Cost ↓
Gemini 3.7 Flash
0.63
$0.82
0.52
$0.47
0.55
$0.39
GLM-5.3
0.74
$1.36
0.61
$0.78
0.66
$0.64
GPT-6 Luna
0.65
$0.14
0.54
$0.08
0.58
$0.07
DeepSeek V4.1 Flash
0.78
$0.42
0.66
$0.24
0.74
$0.20
Table 8: Cross-model generalization on SWE-bench Verified. We compare Full History, Self-Summary, and SumOne across different downstream agent models. Score denotes the resolved rate, and Cost denotes the average total inference cost per task in USD.
Full History
Self-Summary
SumOne
Model
F1 ↑
Cost ↓
F1 ↑
Cost ↓
F1 ↑
Cost ↓
Gemini 3.7 Flash
0.54
$0.58
0.51
$0.36
0.56
$0.29
GLM-5.3
0.42
$1.14
0.33
$0.72
0.40
$0.51
GPT-6 Luna
0.38
$0.04
0.40
$0.05
0.46
$0.04
DeepSeek V4.1 Flash
0.74
$0.38
0.59
$0.18
0.66
$0.15
Table 9: Cross-model generalization on DeepSearchQA. We compare Full History, Self-Summary, and SumOne across different downstream agent models. Cost denotes the average total inference cost per query in USD.
Model
Provider
Input
Output
GPT-6 Luna
OpenAI
$0.20
$1.20
DeepSeek V4.1 Flash
DeepSeek
$0.15
$0.60
Qwen3.5-35B-A3B
Alibaba Cloud Bailian
$0.0592
$0.4739
Qwen3.5-2B
DeepInfra via Requesty
$0.02
$0.10
Qwen3.5-4B
Alibaba Cloud Bailian
$0.03
$0.15
Gemini 3.7 Flash
Google Gemini API
$0.75
$3.75
Table 10: API prices used for cost estimation. Prices are in USD per one million tokens. We use standard list prices without cache discounts, promotional discounts, or other temporary pricing adjustments.