Skip to content

About

A post-training self-evolving framework, utilizes a dual-loop mechanism mutually driven by model optimization and dynamic observation to continuously identify capability gaps and validate optimization solutions.

Topics

Resources

Contributing

Stars

10 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Sage Evolve

A Self-Evolving Framework Driven by Blackbox Dynamic Observation

An automated post-training loop where agents run diagnosis → planning → data construction → training → evaluation to improve models, evaluation suites, and research skills across iterations.

Project Website  Python 3.11+  5 Training Backends  4 Agent Harnesses  10 Domain Skills  Apache 2.0 License

Project Page · Overview · Features · Examples · Backends · Quick Start · Docs · Contributing · 简体中文

Sage Evolve cover banner

Interactive demos and 35B benchmark results: sage-evolve.github.io

Overview

Sage Evolve 1.0 turns post-training into an automated research loop driven by black-box dynamic observation. Given a target capability, research agents diagnose failure modes, propose a controlled experiment, ingest and validate training data, run training on open-source trainers, and evaluate the resulting checkpoint.

  • Dual-loop co-evolution: Fixed benchmarks give a stable baseline, while Sage Atlas maintains a dynamic capability matrix to surface new weak spots. Once gains flatten on the current set, the observation loop expands coverage and raises difficulty. Test sets stay isolated from training; agents only see black-box evaluation feedback.
  • Persistent memory and skills: Hypotheses, experiment trees, outcomes, and operational fixes are written to disk after each round and periodically distilled back into reusable skills.
  • 35B-scale results: Tested on 35B post-training across 13 text benchmarks (long-context understanding, multi-document reasoning, instruction following, coding, translation, and writing). See the Project Page for full numbers and interactive traces.
Sage Evolve architecture

In code, orchestration is kept separate from domain scripts:

Component Location Responsibility
Engine src/core, src/execution (sage-evolve) 7-stage pipeline, state.json persistence, resume, and artifact checks
Harnesses src/harness Adapters for claude_code, codex, opencode, and deepseek
Skills skills/<name>/SKILL.md (10 skills) Data ingestion, JSONL validation, training launch, evaluation, planning, and experiment memory
Backends oss-sft-runner, oss-eval-runner Wrappers for 5 training frameworks (xtuner, verl, slime, miles, areal) and self-eval

News

  • 2026-12: Unified all 5 open-source training frameworks (xtuner, verl, slime, miles, areal) under skills/oss-sft-runner.
  • 2026-11: Added support for 4 Agent CLIs (Claude Code, Codex, OpenCode, DeepSeek Harness) and an optional LLM Supervisor.

Features

  • Black-box dynamic observation: Evolves models purely from black-box evaluation signals, dynamically expanding coverage and difficulty while isolating test sets from training.
  • Closed-loop experiment tree: Automates multi-round diagnosis → planning → data → training → evaluation, tracking single-variable hypotheses and parent-child lineage.
  • Memory & skill evolution: Persists experiment outcomes and failure diagnoses across rounds, distilling verified strategies into reusable skills.
  • Multi-harness & multi-trainer: Runs the same evolution loop across 4 Agent CLIs (Claude Code, Codex, OpenCode, DeepSeek) and 5 open-source training frameworks (XTuner, verl, slime, miles, AReaL).

Examples

Textbook navigation and knowledge application on lattice random walks
Textbook navigation & knowledge application
Navigates a multi-chapter textbook on demand, looks up relevant theorems, and puts together a complete proof.
Cross-document integration and reasoning across 22 documents
Cross-document integration & reasoning
Cross-checks conflicting claims across 22 long documents, verifying scope and separating enacted rules from proposals.
Iterative self-evolution trajectory
Iterative self-evolution trajectory
Tracks multi-round experiment trees from the V00 baseline (44.00%), recording verified gains, unsupported hypotheses, observation updates, and distilled skills.

Supported Backends

Training Frameworks

Supports 5 open-source training frameworks via inputs.training.framework (xtuner, verl, slime, miles, areal). See docs/training-frameworks.md for environment setup and upstream repositories.

Training Framework Supported Upstream Repo Launcher Required Config Fields Template
xtuner (default) ✅ InternLM/xtuner torchrun framework_root (or xtuner_path) campaign.example.json
verl ✅ verl-project/verl torchrun framework_root campaign.verl.example.json
slime ✅ THUDM/slime + Megatron-LM in-run Ray + Megatron framework_root, megatron_root, model_args_file, torch_dist_root campaign.slime.example.json
miles ✅ radixark/miles + Megatron-LM in-run Ray + Megatron framework_root, megatron_root, model_args_file, torch_dist_root campaign.miles.example.json
areal ✅ areal-project/AReaL AREAL_SPMD_MODE=1 torchrun framework_root campaign.areal.example.json

Agent CLIs

Supports 4 Agent CLIs via harness (claude_code, codex, opencode, deepseek). See src/harness/ and examples/README.md for full configuration options.

Agent Harness Supported CLI Binary Config & Output Contract Adapter
codex (default) ✅ codex Native schema output, sandbox & auto-approve src/harness/codex.py
claude_code ✅ claude Permission modes, custom base_url & per-stage overrides src/harness/claude_code.py
opencode ✅ opencode provider/model, --auto, final_output.json validation src/harness/opencode.py
deepseek ✅ dsh --profile / --patch (Node >= 24.9.0), final_output.json validation src/harness/deepseek.py

Quick Start

1. Install

Requires Python >= 3.11 and at least one supported Agent CLI (claude, codex, opencode, or dsh) in PATH. The engine under src/ uses only the Python standard library.

git clone https://github.com/InternLM/SageEvolve.git
cd SageEvolve

pip install -e .
sage-evolve --help

You can also run python3 -m src from the repo root without installing. If you use public dataset ingestion, install its optional dependencies with pip install -r skills/new-data-public-ingestion/requirements-data-pipeline.txt.

2. Write a campaign config

Copy a framework template into experiments/ (so the relative skills_root: "../skills" resolves cleanly) and fill in your local paths. Full schema: examples/README.md.

mkdir -p experiments
# Default template is xtuner; see also campaign.{verl,slime,miles,areal}.example.json
cp examples/campaign.example.json experiments/campaign.json
$EDITOR experiments/campaign.json

# Keep credentials in env vars or gitignored local files, never in campaign JSON
export HF_TOKEN=<your_hf_token>                                                # optional, for HF downloads
cp skills/oss-eval-runner/configs/secrets.json.example \
   skills/oss-eval-runner/configs/secrets.json                                 # optional, for self-eval

3. Run the pipeline

sage-evolve run --config experiments/campaign.json                                     # single iteration
sage-evolve run --config experiments/campaign.json --auto-advance --max-iterations 5   # multiple iterations

Or run it from an interactive claude / codex / opencode / dsh session: "Run the Sage Evolve pipeline with config /abs/path/to/experiments/campaign.json".

4. Status, resume, and expert interrupts

sage-evolve status --config experiments/campaign.json
sage-evolve expert-note --config experiments/campaign.json --message "Focus next round on multi-doc reasoning."

Progress is persisted in <iteration_root>/state.json; re-run sage-evolve run (with --watch, --retry-blocked, or --retry-failed) to resume. See docs/startup-guide.md for the full walkthrough.

Repository Layout

src/        Orchestration engine (core / harness / execution / monitoring / interaction)
skills/     10 modular skills (SKILL.md + scripts/ + references/)
examples/   Campaign templates for all 5 training frameworks, schema docs, and stage reference
script/     Stage gate and preflight helpers
docs/       Bilingual startup guide, training framework setup guides, and figures

Documentation

Topic Doc Notes
Startup guide docs/startup-guide.md Setup, config, running, and recovery (简体中文)
Training frameworks docs/training-frameworks.md Environment setup & upstream repos for all 5 trainers (简体中文)
Config schema examples/README.md Campaign JSON fields and validation rules (简体中文)

Contributing & License

Pull requests are welcome — see CONTRIBUTING.md. Released under the Apache License 2.0; upstream frameworks, base models, and datasets follow their own licenses.

Citation

@misc{sageevolve,
  author       = {{InternLM}},
  title        = {{Sage Evolve: A Self-Evolving Post-Training Framework Driven by Blackbox Dynamic Observation}},
  version      = {0.1.0},
  year         = {2026},
  url          = {https://sage-evolve.github.io/}
}

About

A post-training self-evolving framework, utilizes a dual-loop mechanism mutually driven by model optimization and dynamic observation to continuously identify capability gaps and validate optimization solutions.

Topics

Resources

Contributing

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages