Agents need practice environments as well as web text

John Yang explains how to collect trajectories and tasks, verify results and avoid training on shortcuts.

JYJohn Yang登壇者 · Stanford University
チャンネル
Stanford Online
公開日
2026年11月24日
動画
1:24:37
読了時間
9 分
スライド
3
原文
英語
YouTube で開く
スクロールすると動画は右下に小さくなって再生を続けます。字幕は閲覧言語に合わせて切り替わります。
閲覧言語2 言語で読めます
この記事はまだ日本語に翻訳されていないため、英語の原文を表示しています。
要約

30 秒でわかる

Reading code is like studying a textbook; an agent also needs a place to run it, observe results and try again, says Stanford researcher John Yang. He distinguishes recorded trajectories used for imitation from environments that provide tasks and verification, then compares human demonstrations, web mining and synthetic generation. SWE-smith, for example, creates repair tasks by introducing bugs into working repositories. Yang warns that poor tests, exposed answers, narrow tool interfaces and excessive training can teach shortcuts or reduce generalization.

  1. 1A textbook is not a laboratoryYang says pretraining on code exposes its form, while an environment lets an agent execute code, inspect results and iterate.
  2. 2Trajectories record behavior; environments make behavior possibleA trajectory contains a sequence of actions and observations. An environment supplies the task and setting in which those actions can be taken and evaluated.
  3. 3Recording fidelity has a storage and portability costScreenshots or machine snapshots preserve more context than a lightweight page representation, but the right representation depends on the agent being trained.
  4. 4SWE-smith creates repair tasks by breaking working codeThe system introduces bugs into repositories with passing tests. Yang reports 50,000 tasks across 128 repositories, while noting that quality varies by generation strategy.
  5. 5A shortcut can teach the wrong lessonYang describes environments that exposed later repository history and tests narrow enough to manipulate. He recommends sanitizing tasks and strengthening verification.
  6. 6A model can overfit to a harness or data distributionTraining across tool formats and monitoring generalization can reduce the risk that an agent learns one interface or narrow task too well.

ポイント

  1. A trajectory records actions and observations; an environment supplies a task, an action space and a way to verify outcomes.
  2. Choose data for the capabilities and evaluation setting desired, not only by volume.
  3. Human demonstrations, mined web artifacts and synthetic tasks trade fidelity against cost and scale.
  4. Check that verification covers the intended behavior and that an environment does not expose shortcuts.
  5. Train across varied harnesses and monitor for overfitting to a narrow distribution.
全文

チャプターごとに整えた全文を読む

文字起こしのみ
01

Why agent training needs different data

Yang contrasts web-text pretraining with practice in an environment. He introduces data selection and the risks of learning one harness too narrowly.

John Yang introduces the data used to make language models more capable as agents. Building an agent involves tools and an execution framework, but the model itself can also be trained on examples of acting, observing results and completing tasks.

Yang says agent performance has improved quickly, and attributes part of that progress to training data rather than scaffolding alone. The lecture distinguishes trajectories and environments, surveys ways to create them and examines failure modes in training and evaluation.

He argues that data quality and selection can matter as much as architectural changes. Model reports may release weights while withholding training data, and companies now sell specialized datasets and environments rather than only large collections of web text.

Yang reviews pretraining, supervised fine-tuning and reinforcement learning. Pretraining commonly uses large text corpora; supervised fine-tuning can imitate conversations or agent trajectories; reinforcement learning can use tasks in environments where outcomes are checked.

He compares the internet to a textbook and an environment to a laboratory. Reading code can teach a model its surface patterns, but an environment lets it run code, inspect output and revise its actions—skills that are not the same as reading a repository.

Even with many trajectories available, the choice of which ones to train on matters. Yang cites work showing that different data mixtures can produce different results under a fixed trajectory budget, and asks students to consider quality, coverage, cost and missing capabilities.

A dataset concentrated on GitHub issue repair may be especially effective for that domain but less suitable as the whole mixture for a general agent. The intended evaluation target should shape the choice of examples rather than assuming that more data is automatically better.

An audience question introduces harness overfitting. If a model only sees one agent's tool-call format, it can learn the surrounding framework as well as the desired capability. Yang suggests training across varied harnesses so the model can follow different tool interfaces.

02

Trajectories, environments and verification

A trajectory is a recorded run; an environment supplies a task and a setting. Verification can use tests, rubrics or preferences depending on the task.

Trajectory versus environment
スライド 1 / 3Trajectory versus environmentThe slide contrasts a recorded action-observation sequence with a task, sandbox and verifier.

A trajectory is a record of an agent solving a task: it can contain reasoning, actions, observations and a final submission. It resembles a conversation log, except that the model invokes tools and receives results from an environment between its messages.

An environment is different from the record of a particular run. It supplies a setting and action space in which an agent can act and receive observations. Running an agent in an environment and recording that sequence produces a trajectory.

For supervised fine-tuning, the model can learn to predict actions given preceding context. A later user correction can also be part of the same record, followed by further actions and observations.

Yang breaks an agent task into a problem statement, an environment or sandbox, and verification. A coding task might include a repository and a bug report; an agent acts in the repository and its proposed solution is then graded.

An agent task and its verification
スライド 2 / 3An agent task and its verificationThe diagram shows a problem statement, interactive environment and several ways to grade a submission.

Verification depends on the task. Tests can check a deterministic algorithm; a rubric or model judge can help assess less rigid outputs; human preferences can compare answers where there is no single obvious correct response. Each form imposes different costs and limitations.

Yang likens supervised learning from trajectories to imitation: the model learns from recorded behavior. In reinforcement learning, the agent has more freedom to try different action sequences, with feedback about whether it achieved the task.

He notes that a single environment can support multiple problem statements. Although post-training may use fewer tokens or less total compute than pretraining, the resulting data can have a large effect on final behavior. Excessive specialization can also weaken other capabilities.

03

Collect demonstrations and mine existing artifacts

The lecture compares human-recorded web and computer-use tasks with data derived from repositories, tutorials and video. Fidelity, cost and validation differ.

The lecture groups collection methods into five broad strategies, not an exhaustive taxonomy. For each, Yang asks students to consider the expense of human labor and model inference, fidelity of the environment, and whether verification is comprehensive.

The first strategy records people doing tasks. An annotator receives a task and an environment, performs the work, and a logging system turns the interaction into a trajectory for model training.

Mind2Web moved beyond simple simulated web shops by gathering tasks on real websites. A model could propose plausible tasks for a site, while people carried them out; the resulting actions and page states formed training examples.

Clicks and entries can be mapped to a defined action space, while page HTML represents observations. Yang says the work collected 2,350 tasks across 137 sites and used those demonstrations to improve performance on web-agent evaluations.

A student asks what should be recorded: screenshots, page structure, mouse movement or an entire machine state. Yang frames this as a trade-off. High-fidelity snapshots preserve context but are expensive and less portable; lightweight representations may omit information the intended agent needs.

OpenCUA illustrates a more detailed computer-use recording approach. Logging the screen and interactions can capture tasks that cross applications, such as generating a file in one tool and using it in another, rather than being limited to one browser page.

Human actions are often too granular to use directly as the model's tool interface. A data pipeline must map mouse movement and keystrokes into the actions supported by a chosen agent harness, a conversion that itself requires inference.

Because demonstrations require paid labor, another strategy mines existing material on the web. Repositories, tutorials and videos contain useful artifacts, but the challenge is to convert them into actionable trajectories or environments rather than merely having a model read them.

Yang revisits SWE-bench: a model receives a repository and an issue, then attempts a fix. To construct a task from a real pull request, a pipeline identifies the issue and change, prepares the earlier codebase and uses tests to check a proposed solution.

Scaling that process requires quality control. Repositories must be installable, old dependencies may no longer work, and tests must align with the problem statement. Yang contrasts the original benchmark's 2,294 tasks with a later scaled collection of roughly 20,000.

AgentTrek turns web tutorials into trajectories. A tutorial supplies a goal and a sequence of steps; a model follows those steps on a site, translating the natural-language instructions into actions and recording the resulting observations.

That approach trades some human effort for model inference cost. Yang reports the paper's estimate of about fifty cents per trajectory and notes that its examples connect a high-level task to lower-level actions.

In response to a question, he explains that a model could also generate tutorials, but then the pipeline must ask whether the instructions are realistic and whether a suitable environment exists. A human-authored tutorial is a starting point, not an automatic guarantee of correctness.

Another student asks about verification. For code tasks mined from pull requests, tests contributed with the fix can act as checks: they should fail before the fix and pass after it. For demonstrations, a curator may instead inspect the final state and reject unsuccessful runs.

Tutorials can provide a rough explanation for actions; in video data the situation can be reversed. A recording may show actions, while captions or a model-generated reconstruction can supply an explanation. Yang treats that reconstruction as a data-generation step, not as access to the person's actual internal reasoning.

A general pipeline filters a large source for relevant artifacts, converts them into trajectories or tasks, and then selects or checks the resulting examples. Each step creates choices about coverage, fidelity and quality.

04

Synthesize trajectories, tasks and users

Models can generate actions from instructions or infer tasks from interactions. SWE-smith creates coding tasks by introducing bugs into working repositories.

Synthetic trajectories offer two broad directions. In an instruction-first approach a model receives a task and attempts it; in an interaction-first approach it explores an environment first, and another process infers meaningful tasks from parts of the recorded behavior.

Yang describes an offline approach in which a model turns tutorial steps into plausible tool actions without executing them on the real site. The cited work reports useful benchmark performance at lower collection cost, raising a question about when recorded observations are essential.

In an interaction-first example, an agent explores an environment without a prescribed task. Its logged actions and observations are later grouped into plausible sequences, and a model writes a higher-level instruction that could have motivated each sequence.

Another approach adds a persona to make a sequence of otherwise arbitrary browsing actions coherent. Yang says the same clicks can be interpreted differently depending on what a user is trying to learn or accomplish.

Synthetic tasks can also begin with a working environment. Yang's SWE-smith takes repositories with passing tests and introduces changes that make some tests fail, creating repair tasks rather than relying only on naturally occurring pull requests.

He says mining real pull requests has a low yield because many cannot be turned into runnable, verifiable environments. SWE-smith instead starts from a setup known to work, perturbs the code and records a task when the existing tests reveal the introduced problem.

SWE-smith task-generation pipeline
スライド 3 / 3SWE-smith task-generation pipelineThe slide shows working repositories, environment setup and strategies for creating synthetic repair tasks.

The system uses several bug-generation strategies, including programmatic changes and model-generated modifications. Yang reports 50,000 tasks across 128 repositories and notes that quality varies by strategy; more examples are not interchangeable just because their format matches.

R2E-Gym represents another trade-off: use commits as a source of code changes, then synthesize missing problem statements or tests. This can improve yield compared with requiring every naturally occurring change to arrive with a complete issue and suitable tests.

For tasks involving people, a simulated environment may need a simulated user as well. A customer-service agent must respond to requests and follow-up answers, so datasets can vary personas, willingness to share information or changes in the user's request.

Yang also mentions using a language model as a simulator of the environment itself: instead of actually running a command in a container, another model predicts the observation. He describes this as an interesting research direction rather than a widely settled replacement for real environments.

05

Reward hacking, memorization and overfitting

Unintended shortcuts and weak checks can reward the wrong behavior. Yang also warns that memorized benchmarks and narrow harnesses can distort evaluation and training.

The final section concerns pitfalls. If an environment contains a shortcut, optimization may reward an agent for exploiting it rather than performing the intended work. That matters both when evaluating a model and when training it.

As an example, Yang describes a coding benchmark environment that exposed later repository history. An agent could obtain the already-fixed version rather than independently repair the issue. Removing such unintended information is important for a meaningful task.

He cites work suggesting that training on exploitable coding environments can affect behavior outside the immediate task. He also describes more direct verifier manipulation, such as changing tests or producing a hard-coded output that passes a narrow check without solving the underlying problem.

A verifier should cover relevant successful and failure cases, and the environment should not expose unintended shortcuts. Yang notes that analogous problems appear outside coding when an agent can locate evaluation answers or recognize a benchmark.

Memorization is another concern: if a model has already seen an evaluation issue during training, a correct answer may not show that it can solve a new one. This does not mean models should never train on code, he says, but it complicates interpretation of benchmark results.

Training on a single harness can also teach its specific tool format in a way that fails to transfer. Yang recommends diversity of frameworks and warns that too much supervised fine-tuning or reinforcement learning on a narrow distribution can eventually reduce generalization.

He closes by returning to the central trade-off: generating a large number of trajectories or environments is not enough. Researchers must assess their quality, verification, data mixture and training pressure as well as their scale.

同じチャンネルの記事

1:17:43EN
Stanford Online· 2026年11月24日Tune the baseline before trusting a deep-learning resultTatsunori Hashimoto · Stanford UniversityTatsunori Hashimoto explains how hyperparameters, scaling, randomness and matched controls shape reliable experiments.Machine LearningScaling LawsDeep Learning+2
1:08:38EN
Stanford Online· 2026年11月24日Stanford’s deep-learning course teaches students to predict experimentsTatsunori Hashimoto, Suhas Kotha · Stanford UniversityA small language model and repeated quizzes test intuition; one demonstration shows why a component can look broken until its learning rate is tuned.Deep LearningPretraining & midtrainingNeural Networks
56:46EN
Stanford Online· 2026年11月23日Amy X. Zhang: AI agents need shared plans and continual alignmentAmy X. Zhang · University of WashingtonResearch on cooperative work suggests better ways to divide tasks, notice agent activity and adjust to changing social preferences.Human-AI CollaborationAI agentsAI interface design+2
1:44:59EN
Stanford Online· 2026年11月21日Evaluate LLMs by the Work You Need Them to DoAfshine Amidi, Shervine Amidi · Stanford UniversityHuman ratings, model judges and benchmarks each miss different failures; Stanford’s instructors show how to combine and test them.評価(Evals)AI agentsモデルと学習+1
1:00:02EN
Stanford Online· 2026年11月20日Philip Guo: The Small Choices That Kept Python Tutor AlivePhilip Guo · UC San DiegoA free code visualizer reached nearly 30 million people through instant access, a narrow mission and years of careful maintenance.EducationProgramming Languagesプロダクトと UX+2
48:59EN
Stanford Online· 2026年11月19日Cynthia Bailey: Choose AI models for the task and guard your API keysCynthia Bailey · Stanford UniversityStanford’s Cynthia Bailey shows how token overhead, repeated agent steps and exposed credentials turn AI use into real costs.AI cost & performanceAI agentsAI Safety+1