GenericAgent: A Token-Efficient Self-Evolving LLM Agent via Contextual Information Density Maximization (V1.0)

Jiaqing Liang, Jinyi Han, Weijia Li, Xinyi Wang, Zhoujia Zhang, Zishang Jiang, Ying Liao, Tingyun Li, Ying Huang, Hao Shen, Hanyu Wu, Fang Guo, Keyi Wang, Zhonghua Hong, Zhiyu Lu, Lipeng Ma, Sihang Jiang, Yanghua XiaoarXiv 2026

TL;DR

GenericAgent (GA) is a general-purpose, self-evolving LLM agent system designed around a singular core principle: contextual information density maximization. Instead of chasing massive context windows that dilute model attention, GA uses a minimal atomic toolset, hierarchical on-demand memory, and an autonomous self-evolution pipeline to compress long-horizon trajectories into compact, reusable code and Standard Operating Procedures (SOPs). The result is an architecture that consistently matches or outperforms state-of-the-art agents while slashing token consumption by up to 90% over repeated tasks.

What Problem Does This Paper Address?

Long-horizon Large Language Model (LLM) agents face two major bottlenecks: context explosion and experience stagnation.

As an agent interacts with an environment over dozens of turns, tool definitions, raw environment logs, and intermediate observations accumulate rapidly. This bloat triggers "lost in the middle" retrieval failures and dilutes the model's effective attention, severely degrading decision quality. Concurrently, most existing agent frameworks treat task episodes as stateless across sessions. Successful strategies are forgotten upon context expiration, forcing agents to repeat the same failure patterns and rediscover solutions from scratch.

The authors argue that long-horizon performance is determined not by raw context length, but by how much decision-relevant information is maintained within a finite context budget. They frame this as the Context Trilemma, a structural tension between completeness, conciseness, and naturalness.

The Context Trilemma: Balancing completeness, conciseness, and naturalness.

Methods

GenericAgent systematically optimizes for information density across the entire lifecycle of an interaction via four tightly integrated components:

  1. Minimal Atomic Toolset: Instead of exposing dozens of specialized tools that clutter the prompt, GA relies on just 9 atomic primitives (e.g., code_run, file_patch, web_scan) across 5 capability classes. Complex behaviors emerge via composition rather than tool enumeration.
  2. Hierarchical Memory Architecture: Memory is split into four layers: L1 (always-on index layer), L2 (verified facts), L3 (procedural SOPs), and L4 (raw session archives). Only the lightweight L1 index is injected by default; deeper layers are retrieved on-demand via tool calls.
  3. Self-Evolution Pipeline: GA autonomously distills successful interaction traces into structured, textual SOPs and eventually compiles them into executable Python code/skills. It follows a strict "No Execution, No Memory" rule to filter out unverified actions.
  4. Layered Context Truncation and Compression: Using a character-domain heuristic, GA actively trims context via a 4-stage pipeline: tool-output truncation, tag-level XML compression (every 5 turns), FIFO message eviction, and a persistent working-memory anchor prompt to preserve critical task state.
The overall framework of GenericAgent, highlighting its runtime loop, hierarchical memory, and self-evolution pipeline.

Datasets

The authors evaluated GA across a comprehensive suite of benchmarks targeting distinct agent capabilities:

  • SOP-Bench: Evaluates multi-step instruction-following and procedural reasoning.
  • Lifelong AgentBench: Tests context management and state maintenance over continuous interactions with cross-task dependencies.
  • RealFin-Benchmark: Assesses domain-specific understanding in complex financial workflows.
  • WebCanvas & BrowseComp-ZH: Benchmarks for open-ended web browsing, navigation, and multi-hop reasoning (the latter specifically in the Chinese web ecosystem).
  • LoCoMo: Used to evaluate long-term factual memory retention.
  • Custom Tasks: A curated set of 22 real-world web automation tasks.

Key Insights and Ideas

  • Tool Composition Beats Proliferation: Analysis of traditional agents shows that tool usage is heavily concentrated in a few high-frequency tools, while long-tail tools just bloat the prompt context. GA proves that a tiny set of atomic primitives can replicate complex specialized tools through code-based composition.
Tool usage distribution across different agent frameworks, showing heavy concentration in a few core tools.
  • Representation Shift as the Goal of Reflection: Instead of using reflection merely for natural-language self-correction within a single run, GA shifts the representation entirely—turning verbose, high-entropy text trajectories into deterministic, low-cost executable code assets for future runs.
  • Token Consumption as a Symptom: The authors propose a counterintuitive finding: in long-horizon settings, higher token consumption often reflects systematic failures in context management rather than "thoroughness of reasoning." Efficient context management naturally yields better task performance.

Key Results

  • State-of-the-Art Performance: GA achieved 100% accuracy on both SOP-Bench and Lifelong AgentBench using Claude 4.6 Sonnet, outperforming Claude Code and OpenClaw. On the RealFin-Benchmark, it achieved the highest overall accuracy of 65%.
  • Extreme Token Efficiency: On Lifelong AgentBench, GA required only 222k input tokens compared to Claude Code's 800k and OpenClaw's 1.43M while maintaining perfect accuracy.
  • Rapid Convergence via Self-Evolution: In a 9-round longitudinal GitHub research task, GA demonstrated a massive phase transition: runtime dropped by 78.2%, LLM calls fell from 32 to 5 (an 84.4% reduction), and total token consumption plummeted by 89.6% as the agent converted text trajectories into codified SOPs.
  • Web Browsing Superiority: On BrowseComp-ZH, GA tripled OpenClaw's score (0.60 vs 0.20) while consuming roughly one-third of the tokens (0.47M vs 1.31M), proving its resilience against raw HTML/DOM bloat.

Limitations and Future Work

  • Context Length Caps: GA enforces a 30-round execution cap; highly complex research tasks that span multiple sessions must rely entirely on written reports and task-list annotations to maintain continuity.
  • Preliminary Weight Adaptation: The curriculum planner's reflection-based weight adjustment mechanism for autonomous exploration is still a preliminary design and lacks extensive long-term real-world validation.
  • Manual Maintenance Overhead: While skill execution is automated, higher-level management tasks—such as curating the self-improvement log, merging redundant skill tree categories, or deprecating outdated tools—still require manual human intervention.

Summary updated

BibTeX
@misc{liang2026genericagent,
  author = {Jiaqing Liang and Jinyi Han and Weijia Li and Xinyi Wang and Zhoujia Zhang and Zishang Jiang and Ying Liao and Tingyun Li and Ying Huang and Hao Shen and Hanyu Wu and Fang Guo and Keyi Wang and Zhonghua Hong and Zhiyu Lu and Lipeng Ma and Sihang Jiang and Yanghua Xiao},
  title = {{GenericAgent: A Token-Efficient Self-Evolving LLM Agent via Contextual Information Density Maximization (V1.0)}},
  year = {2026},
  eprint = {2604.17091},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.17091},
}
Figure