JL-AgentBehavior-10K / docs /TRAINING_GUIDE.md
jumplander's picture
Upload 20 files
f301d78 verified
|
Raw
History Blame Contribute Delete
4.79 kB

Training Guide

Training objective

JL-AgentBehavior-10K is designed to influence the control policy of a code-capable model. It should not be expected to create coding competence or repository understanding from scratch.

The primary learning targets are:

  • next valid action;
  • tool name and argument selection;
  • bounded plan construction;
  • failure classification;
  • repair action selection;
  • evidence-aware final reporting.

Recommended preparation

Filter by evidence tier

Version 1 contains only silver_structural records. When later releases add executed data, preserve provenance and construct explicit mixtures rather than silently concatenating tiers.

Normalize tool schemas

Map abstract tools to the deployment runtime:

Dataset action Runtime mapping example
search ripgrep wrapper, repository search API, or language server
read_file bounded file reader
apply_patch patch editor
run_tests sandboxed command runner
git_diff version-control diff tool
request_approval runtime permission gate

Do not train one schema and deploy another without an adapter.

Loss masking

A conservative loss policy is:

Content Default loss
System policy Mask
User task Mask
Repository/environment context Mask
External tool output Mask
Assistant observation summary Optional / low weight
Tool selection and arguments Train
Failure classification Train
Patch strategy Train
Final reporting contract Train

Training on external tool outputs as assistant tokens can teach fabricated observations.

Mixture strategy

A reasonable first experiment:

  • 60–75% real code or repository SFT;
  • 10–20% JL trajectory records;
  • 5–10% JL repair records;
  • preference records in a separate preference-optimization stage;
  • remaining weight allocated to verified tool-use data.

These are starting points, not established optimal weights. Evaluate several mixtures.

Curriculum

Stage A: Grounding and tool validity

Train on:

  • repository_grounding;
  • tool_selection_execution;
  • simple test_verification.

Goal: reduce invalid or premature actions.

Stage B: Bounded execution

Add:

  • planning_decomposition;
  • bounded_code_editing;
  • medium-difficulty trajectories.

Goal: improve multi-step control without expanding scope.

Stage C: Recovery and review

Add:

  • failure_diagnosis_repair;
  • code_review_security;
  • permission_scope_safety.

Goal: improve behavior after failure and at trust boundaries.

Stage D: Preference optimization

Use chosen/rejected records only after the SFT model can reliably emit the runtime tool format.

Sampling

Avoid sampling only by dataset size. Use behavior-aware sampling so that the 200 final-reporting examples and 400 permission examples are not lost in the larger editing mixture.

Possible weighting:

sample_weight = base_weight
              * evidence_tier_weight
              * behavior_balance_weight
              * difficulty_weight

Do not upweight synthetic rare categories so aggressively that they dominate the model’s natural code distribution.

Chat conversion

Run:

python scripts/format_sft.py data/train.jsonl train_sft.jsonl

The output is a conservative reference view with system, user, and assistant messages. Inspect it and adapt the chat template before training.

Data collator requirements

The collator should support:

  • assistant-only loss;
  • tool-call JSON boundaries;
  • maximum sequence control;
  • truncation that preserves task constraints and target actions;
  • optional per-record weights;
  • logging by primary_behavior.

A truncation policy that removes the verification or repair tail defeats the dataset’s purpose.

Baselines

Always retain:

  1. unchanged base model;
  2. same model trained on an equal-size generic code-instruction control;
  3. full behavior mixture;
  4. behavior ablations.

Match tokens or optimizer steps across controls where possible. Comparing 10K agent records against a much smaller control confounds data type with training volume.

Known failure modes

  • Narration inflation: model produces long plans but no useful action.
  • Tool ritualization: model always searches and tests even when not needed.
  • Synthetic imitation: model repeats template language.
  • False execution: model states expected observations as completed results.
  • Over-refusal: safety supervision triggers approval for reversible local work.
  • Patch underfitting: scope control becomes reluctance to modify all necessary files.
  • Repair looping: model learns repair vocabulary without changing the failed action.

Measure these effects directly.