https://github.com/bytedance/ftrl
Feedback-Driven Tool-Use Improvements in Large Language Models via Automated Build Environments
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Repository
Feedback-Driven Tool-Use Improvements in Large Language Models via Automated Build Environments
Basic Info
Statistics
- Stars: 15
- Watchers: 0
- Forks: 1
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
FTRL
Feedback-Driven Tool-Use Improvements in Large Language Models via Automated Build Environments
Data and code for paper Feedback-Driven Tool-Use Improvements in Large Language Models via Automated Build Environments
Junjie Ye
jjye23@m.fudan.edu.cn
Aug. 03, 2025
Introduction
Effective tool use is essential for large language models (LLMs) to interact meaningfully with their environment. However, progress is limited by the lack of efficient reinforcement learning (RL) frameworks specifically designed for tool use, due to challenges in constructing stable training environments and designing verifiable reward mechanisms. To address this, we propose an automated environment construction pipeline, incorporating scenario decomposition, document generation, function integration, complexity scaling, and localized deployment. This enables the creation of high-quality training environments that provide detailed and measurable feedback without relying on external tools. Additionally, we introduce a verifiable reward mechanism that evaluates both the precision of tool use and the completeness of task execution. When combined with trajectory data collected from the constructed environments, this mechanism integrates seamlessly with standard RL algorithms to facilitate feedback-driven model training. Experiments on LLMs of varying scales demonstrate that our approach significantly enhances the models’ tool-use performance without degrading their general capabilities, regardless of inference modes or training algorithms. Our analysis suggests that these gains result from improved context understanding and reasoning, driven by updates to the lower-layer MLP parameters in models.
What's New
- [2025/08/03] Release the data and code for FTRL.
- [2025/08/03] Paper available on Arxiv.
Main Results
We evaluate the performance of various LLMs, and present the average performance across scenarios for each dataset. Based on it, we make the following observations. - Our approach consistently enhances the model's tool-use capabilities across various conditions. - Performance gains achieved by our method appear to primarily stem from updates to the model’s lower-layer MLP parameters. - Current open-source LLMs do not necessarily exhibit stronger tool-use performance in reasoning mode compared to non-reasoning mode.
Usage
Requirement
- Run the command to install the packages required.
bash pip install -r requirements.txt
Training with Our Data
Collected trajectories based on our constructed environments.
bash python3 Code/data_sample/data_sample.py --series qwen --model_path ${your_model_path} --input_file Data/jsonl/raw/train.jsonl --output_file ${train_files} --do_sample --temperature 1.0 --device cuda --max_turns 20 --start_id 0 --end_id -1Transform the train data from JSONL format to PARQUET format.
bash python3 Code/data_process/tool.py --source_file ${train_files} --overloadTrain the model with the transformed data.
bash python3 -m verl.trainer.main_ppo \ algorithm.adv_estimator=${adv_estimator} \ data.train_files=${train_files} \ data.val_files=${test_files} \ data.return_raw_chat=False \ data.train_batch_size=512 \ data.max_prompt_length=16384 \ data.max_response_length=${max_response_length} \ data.filter_overlong_prompts=True \ data.truncation='error' \ data.prompt_key=messages \ data.system_style=${system_style} \ data.enable_thinking=${enable_thinking} \ actor_rollout_ref.model.path=${model} \ actor_rollout_ref.actor.optim.lr=1e-6 \ actor_rollout_ref.model.use_remove_padding=True \ actor_rollout_ref.actor.ppo_mini_batch_size=32 \ actor_rollout_ref.actor.use_dynamic_bsz=True \ actor_rollout_ref.actor.ppo_max_token_len_per_gpu=32768 \ actor_rollout_ref.actor.use_kl_loss=True \ actor_rollout_ref.actor.kl_loss_coef=0.001 \ actor_rollout_ref.actor.kl_loss_type=low_var_kl \ actor_rollout_ref.actor.entropy_coeff=0.001 \ actor_rollout_ref.model.enable_gradient_checkpointing=True \ actor_rollout_ref.actor.fsdp_config.param_offload=False \ actor_rollout_ref.actor.fsdp_config.optimizer_offload=False \ actor_rollout_ref.rollout.tensor_model_parallel_size=2 \ actor_rollout_ref.rollout.name=vllm \ actor_rollout_ref.rollout.mode="sync" \ actor_rollout_ref.rollout.gpu_memory_utilization=0.7 \ actor_rollout_ref.rollout.n=16 \ actor_rollout_ref.rollout.max_num_batched_tokens=32768 \ actor_rollout_ref.ref.fsdp_config.param_offload=True \ reward_model.reward_manager=tool \ custom_reward_function.path=Code/verl/utils/reward_score/tool.py \ custom_reward_function.name=compute_solve_f1 \ algorithm.use_kl_in_reward=False \ trainer.critic_warmup=0 \ trainer.logger=['console','wandb'] \ trainer.project_name='FTRL' \ trainer.experiment_name='test' \ trainer.val_before_train=False \ trainer.n_gpus_per_node=8 \ trainer.nnodes=1 \ trainer.save_freq=120 \ trainer.test_freq=-1 \ trainer.total_epochs=1 $@Merge the trained model into SATETENSORS format.
bash python3 Code/data_process/merge_model.py merge --local_dir ${dir} --target_dir ${dir}
Evaluation for Open-Source LLMs
- Run the command to evaluate the Open-Source LLMs. We have supported evaluation for Qwen2.5 and Qwen3 families.
- Non reasoning mode
bash python3 Code/evaluation/${evaluation_file} --series qwen --model_path ${model} --input_file Data/jsonl/raw/${file} --output_file ${save_file} --start_id 0 --end_id -1 - Reasoning mode
bash python3 Code/evaluation/${evaluation_file} --series qwen --model_path ${model} --input_file Data/jsonl/raw/${file} --output_file ${save_file} --start_id 0 --end_id -1 --enable_thinking
- Non reasoning mode
Evaluation for Closed-Source LLMs
- Run the command to evaluate the Closed-Source LLMs. We have supported evaluation for Gemini2.5, Claude4.0, and GPT families.
- Non reasoning mode
bash python3 Code/evaluation/${evaluation_file} --series qwen --model_path ${model} --base_url ${base_url} --api_key ${api_key} --input_file Data/jsonl/raw/${file} --output_file ${save_file} --start_id 0 --end_id -1 - Reasoning mode
bash python3 Code/evaluation/${evaluation_file} --series qwen --model_path ${model} --base_url ${base_url} --api_key ${api_key} --input_file Data/jsonl/raw/${file} --output_file ${save_file} --start_id 0 --end_id -1 --enable_thinking
- Non reasoning mode
License
The code is licensed under the Apache License 2.0.
Acknowledgement
We employ the VeRL 0.3.1.dev framework for training.
Citation
If you find this project useful in your research, please cite:
bibtex
@misc{FTRL,
title={Feedback-Driven Tool-Use Improvements in Large Language Models via Automated Build Environments},
author={Junjie Ye and Changhao Jiang and Zhengyin Du and Yufei Xu and Xuesong Yao and Zhiheng Xi and Xiaoran Fan and Qi Zhang and Xuanjing Huang and Jiecao Chen},
year={2025},
eprint={2508.08791},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2508.08791},
}
Owner
- Name: Bytedance Inc.
- Login: bytedance
- Kind: organization
- Location: Singapore
- Website: https://opensource.bytedance.com
- Twitter: ByteDanceOSS
- Repositories: 255
- Profile: https://github.com/bytedance
GitHub Events
Total
- Issues event: 3
- Watch event: 16
- Issue comment event: 1
- Push event: 1
- Public event: 1
Last Year
- Issues event: 3
- Watch event: 16
- Issue comment event: 1
- Push event: 1
- Public event: 1
Dependencies
- Pillow ==11.3.0
- Pillow ==2.5.1
- Requests ==2.32.4
- accelerate ==1.6.0
- aiohttp ==3.11.18
- aiohttp ==3.11.13
- apex ==0.9.10dev
- byted_wandb ==0.13.87
- cachetools ==5.5.2
- cachetools ==2.0.1
- clearml ==2.0.2
- cloudpickle ==3.1.1
- codetiming ==1.4.0
- cupy_cuda12x ==13.4.1
- datasets ==3.5.0
- distribute ==0.6.26
- einops ==0.8.1
- fastapi ==0.116.1
- filelock ==3.18.0
- flash_attn ==2.7.4.post1
- func_timeout ==4.3.5
- huggingface_hub ==0.30.2
- human_eval.egg ==info
- hydra-core ==1.3.2
- json_repair ==0.42.0
- latex2sympy2_extended ==1.10.1
- liger_kernel ==0.5.8
- mathruler ==0.1.0
- mlflow ==3.1.4
- modelscope ==1.28.0
- numpy ==1.6.2
- numpy ==1.11.1
- omegaconf ==2.3.0
- openai ==1.97.1
- packaging ==25.0
- pandas ==0.14.1
- peft ==0.15.2
- psutil ==7.0.0
- pydantic ==2.11.7
- pyext ==0.6
- pylatexenc ==2.10
- qwen_vl_utils ==0.0.11
- safetensors ==0.5.3
- setuptools ==28.8.0
- setuptools ==32.1.2
- setuptools ==75.8.0
- starlette ==0.47.2
- swanlab ==0.6.7
- sympy ==1.13.1
- tensordict ==0.6.2
- torch ==2.6.0
- torch_npu ==2.5.1
- torchdata ==0.11.0
- tqdm ==4.67.1
- uvicorn ==0.35.0