Video by Discover AI • Watch on YouTube

OpenThoughts-Agent is a research project from Stanford, Harvard, UC Berkeley, and many other institutions that systematically engineers the best possible supervised fine-tuning (SFT) dataset for long-horizon coding and terminal agents. The result is a 32B open-source model that outperforms nearly everything else in its size class across financial, medical, software engineering, and terminal benchmarks.

Collaborating Institutions [00:00]

  • Stanford University, Harvard University, UC Berkeley
  • Harvard Medical School, Technical University of München (TUM)
  • New York University, University of Southern California
  • Amazon, Microsoft, Korea University, Cornell University
  • University of Michigan, Technische Universität Darmstadt
  • A massive coalition of experts united around one goal: build better agents

Motivation & Core Idea [01:00]

  • Current AI models (LLMs, VLMs, VLAs) are described as a disappointment in agentic performance — even top models don't perform well enough
  • The core principle: "garbage in, garbage out" — model quality is fundamentally limited by training data quality
  • The team's approach: find the best training dataset to maximize model performance
  • Tested with a 32B model and an 8B model (Qwen 3 base)
  • The recipe is applicable to any domain: medical, financial, chemical, physical — you can build the best data representation for your own local LLM

The Methodology — 100+ Ablation Experiments [02:01]

  • Over 100 controlled ablation experiments were conducted to investigate each stage of the data-building pipeline
  • Evaluation was continuous and empirical — not theoretical
  • Insights emerged on the importance of task source quality, domain specificity, and data diversity for generalization
  • Training sets started at 10,000 examples, then scaled to 100,000
  • A six-stage pipeline was identified as the optimal data curation process

Results: A New State-of-the-Art 32B Open Model [03:04]

  • Fine-tuned Qwen 3 32B on the curated dataset → called "OpenThoughts Agent 32B"
  • Outperforms nearly every other model in the 32B size class across benchmarks:
  • Financial Agent benchmark
  • Terminal Bench 2.0
  • Medical Agent Bench
  • Software Engineering Bench (verified)
  • Claimed to be perhaps the best open-source model available today at the 32B scale

Prior Work & Foundation [04:05]

  • A year earlier, a similar coalition (Stanford, U. Washington, UC Berkeley, UT Austin, UCLA) released open-source reasoning models
  • That earlier work focused on supervised fine-tuning with reasoning datasets and already outperformed other open models
  • Almost nobody used that earlier model — surprisingly overlooked
  • The current work builds on those insights, now focused on agentic benchmarks (not just code, but finance, medicine, software engineering, etc.)

Open Source Availability [06:05]

  • Everything is open source:
  • Supervised fine-tune only models
  • Supervised fine-tuning data and traces
  • Reinforcement learning data and environments
  • All benchmark data
  • Complete codebase
  • Available on Hugging Face with an inference provider (Federated AI)
  • Updated ~16 days before the video with new models
  • Dataset includes 15,000 rows in parquet format

The Six-Stage Data Curation Pipeline [07:05]

The dataset consists of task description + agent trajectory pairs. The best dataset is simply the one that produces the highest-performing agent on downstream benchmarks — no theory, no LLM-as-judge, just benchmark performance.

The six stages:

  1. Task Sourcing — where do tasks come from?
  2. Task Mixing — single source or mixture?
  3. Task Augmentation — can tasks be improved by rewriting?
  4. Task Filtering — which tasks are worth keeping?
  5. Teacher Model — which model generates trajectories?
  6. Trajectory Filtering — which rollouts to keep?

Each stage was ablated by generating a 10,000-trajectory dataset, fine-tuning a Qwen 3 8B model, and evaluating on three benchmarks (SWE-Bench Verified, Terminal Bench 2.0, and one more). Strategies were ranked using average Z-scores across the three benchmarks.

Ablation training details [10:08]:

  • 10,000 agent trajectories per candidate
  • Full-parameter SFT on Qwen 3 8B
  • Learning rate: specified, cosine schedule
  • Batch size: 96, 7 epochs, 32K context length
  • Evaluated with 3 stochastic reruns

Stage 1: Task Sourcing [11:08]

  • Evaluated 95 task generation strategies including:
  • Synthetic issue resolution tasks
  • Human-written infrastructure questions
  • Competitive coding-style tasks
  • Prior agent datasets
  • Stack Exchange–derived tasks
  • GitHub issue tasks
  • Best sources: a combination of SWE-Smith issue tasks, Stack Exchange Superuser, and Stack Exchange "Tezos" tasks
  • The underlying task distribution matters enormously — where you pull tasks from is the most important stage

Stage 2: Task Mixing [12:08]

  • Question: train on one source or a mixture?
  • Finding: a portfolio of the top 4–8 sources works best
  • Single-source (even the best one) is too specialized and not balanced
  • Mixing several top sources gives broader coverage and better generalization
  • If you know your domain (finance, medicine, physics, coding, math), mix accordingly

Stage 3: Task Augmentation [13:08]

  • Tried hardening task descriptions, adding constraints, mixing original + hardened tasks, combining tasks across sources, adding trace hints
  • Finding: almost no augmentation strategy reliably beat the original task description
  • Conclusion: skip augmentation, use original task descriptions

Stage 4: Task Filtering [14:08]

  • Tested filters: GPT-5 response length (longest/shortest), LLM-based filtering, embedding diversity, and others
  • Best filter: GPT-5 longest response length
  • Tasks that elicit longer responses from a strong model contain more procedural information and are better SFT training tasks

Stage 5: Teacher Model Selection [15:08]

  • The teacher model generates the agent trajectories (tool use, reasoning style, exploration depth, error recovery, patching behavior, trajectory length/structure)
  • Tested GPT-5.3 and other top models — GPT-5.3 was not the winner
  • Best teacher: GLM 4.7 (quantized) — outperformed GPT-5.3 and even GLM 5
  • The teacher determines the style and depth of all trajectory data, making this a critical choice

Stage 6: Trajectory Filtering [16:09]

  • Heuristic filters tested: remove timeouts, remove sub-agent traces, keep traces with minimum number of turns
  • Best filter: keep only trajectories with at least 5 turns
  • Longer trajectories encode richer multi-step behavior (exploration, tool use, revision, validation, repair)
  • This matches the demands of long-horizon agentic systems

Scaling to 100K: The Diversity Bottleneck [18:09]

  • Scaling from 10K to 100K examples revealed a new bottleneck: task description diversity
  • Small task pools (e.g., Tezos with only ~997 unique task descriptions) cause plateauing at scale
  • Reusing the same small set of tasks with more rollouts hits a wall
  • Solution: synthetic instruction rewriting and augmentation
  • Tezos was expanded from 997 base problems to 21,000+ unique surface forms
  • Same core problems, restated in many different ways
  • Response length signal used as an upsampling weight
  • Synthetic augmentation outperformed all other scaling methods in benchmarks
  • Caveat: this must be validated on your own dataset and domain — not guaranteed to work universally

SFT + Reinforcement Learning: Does RL Help? [24:13]

  • Second part of the study: does adding an RL stage on top of SFT improve performance?
  • Tested on Qwen 3 8B with 100K SFT trajectories + RL
  • Results were mixed:
  • On some benchmarks, SFT+RL slightly outperformed SFT-only (~0.5 percentage points)
  • On SWE-Bench Verified, SFT-only actually outperformed SFT+RL
  • On Terminal Bench 2.0, SFT+RL outperformed SFT-only (13.5 vs lower)
  • No clear universal trend — RL helps sometimes, hurts sometimes
  • Depends on domain, complexity, and specific use case
  • Note: comparison isn't perfectly apples-to-apples (100K SFT vs 15K RL training sets)

Key Takeaways [27:14]

  • Agent SFT data curation is a sequential optimization over: task distribution, source diversity, task difficulty, teacher behavior, and trajectory richness
  • Diversity at scale is critical — scaling to 100K requires more unique task formulations, not just more of the same
  • The six-stage pipeline works: task sourcing → mixing → augmentation → filtering → teacher model → trajectory filtering
  • Best teacher wasn't the biggest model: GLM 4.7 quantized beat GPT-5.3
  • Keep trajectories with ≥5 turns for richer multi-step behavior
  • Task augmentation (rewriting) doesn't help at the task level but is essential for scaling diversity
  • RL on top of SFT is not a guaranteed boost — evaluate on your own benchmarks
  • Everything is fully open source — models, data, code, environments — ready for you to apply to your own domain
  • The Qwen 3 (32B or 8B) base model is an excellent foundation for domain-specific fine-tuning