Trajectory2Gym: Decision-Grounded Compositional Interaction Synthesis for Tool-Use Agents

A method for generating training data for tool-calling agents: The authors argue that "successful trajectories" are not necessarily good supervision signals—they may miss multi-step dependencies or include actions that lacked visible justification at the time. Trajectory2Gym constructs executable interactions around "observation-action" compositional structures that are underrepresented in the training set, treating only decisions justified by the history visible at that moment as supervision targets. It then allocates samples based on structural support and performs fine-tuning with weighting applied to entire interaction sequences.

A method for generating training data for tool-calling agents: The authors argue that "successful trajectories" are not necessarily good supervision signals—they may miss multi-step dependencies or include actions that lacked visible justification at the time. Trajectory2Gym constructs executable interactions around "observation-action" compositional structures that are underrepresented in the training set, treating only decisions justified by the history visible at that moment as supervision targets. It then allocates samples based on structural support and performs fine-tuning with weighting applied to entire interaction sequences.

Likes 336 · Code Stars 5

Rationale

  • The authors report that across 5 sizes of Qwen3, performance improved on all three benchmarks—Tau1, Tau2, and BFCL—for every size, with an equal-weighted average increase of 16.9–29.8 percentage points; gains were largest for multi-turn, stateful tasks where later decisions depend on earlier feedback.
  • Training uses only standard assistant-token cross-entropy, without reinforcement learning, resulting in a low barrier to reuse.
  • Weights for 5 sizes and candidate interaction data have been made publicly available, allowing them to be used directly as a foundation for tool calling or as a control group; this issue's like count of 336 ranks it 1, which reflects only attention level.

Usage

  • Code: github.com/yihaohu0118/Trajectory2Gym (Apache-2.0, Python 3.10+). After running pip install -e ".\[dev\]", you can run the built-in regression tests and the examples/structural\_support\_demo.py demo on CPU.
  • Weights: Available on Hugging Face at mis2/Trajectory2Gym-1.7B / 4B / 8B / 14B / 30B-A3B (model cards specify apache-2.0), loadable directly via transformers; model cards require using the provided tokenizer and native tool format, with generation in non-thinking mode (pass enable\_thinking=False to apply\_chat\_template).
  • Data: Hugging Face dataset mis2/Trajectory2gym, containing 34,772 candidate interactions, approximately 125 MB.

Risks

  • The 1.7B / 4B / 8B models are stored as-is in float32 (the 8B model is approximately 32.8 GB), resulting in loading memory usage twice that of common BF16 versions; users must convert precision themselves.
  • The public data is a candidate pool, not the actual training views used for each size in the paper; the README explicitly states that the paper's numbers cannot be reproduced using this code alone. Benchmark scores are the original experimental results reported by the authors and were not re-run at release time.

Open · Code · Hugging Face Paper Page

Hugging Face Daily Papers

Explore the latest AI Radar updates