Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
the official code for "ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases"
| Date | Stars |
|---|---|
| 2026-07-31 | 880 |
| 2026-08-05 | 880 |
| 2026-08-06 | 880 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases
[](https://arxiv.org/abs/2306.05301)
[](https://huggingface.co/TangQiaoYu/ToolAlpaca-7B)
[](https://huggingface.co/TangQiaoYu/ToolAlpaca-13B)
<div align=center><img src="./figures/ToolAlpaca.png" width="400px" /></div>
`ToolAlpaca` is a framework designed for learning generalized tool-use abilities in compact language models with minimal human supervision. It addresses the challenge of tool learning by generating a tool-use corpus via a multi-agent simulation environment, providing 3.9k tool-use instances from more than 400 tools.
<div align=center><img src="./figures/pipeline.png" width="500px" /></div>
## Data
Dataset list:
- train_data.json: training data with 400+ APIs
- eval_simulated.json: evaluation data with 10 simulated APIs
- eval_real.json: evaluation data with 11 real APIs, some APIs require authentication.
Data format:
```json
{
"Name": "name, from public-apis",
"Description": "description, from public-apis",
"Category": "category, from public-apis",
"Introduction": "introduction, generated by LLM",
"Functions": "NLDocumentation in paper v1, generated by LLM",
"Documentation": "str(json), OpenAPI Specification documentation, generated by LLM",
"NLDocumentation": "natural language documentation, similar to Functions, converted from Documentation",
"Function_Description": "each functions description in NLDocumentation",
"Function_Projection": "function to HTTP request method",
"Instructions": "instructions, generated by LLM",
"Instances": [
{
"input": "use's init instruction, from use agent",
"output": "final output, from assistant agent",
"Final Thought": "the final thought before output, from assistant agent",
"intermediate_steps": [
[
[
"action, from assistant agent",
"action input, str(json), from assistant agent",
"thought + action + action input, assistant agent's output"
]
"bbservation, from [user agent, type check python code, tool executor agent]"
]
]
}
]
}
```
## Dataset Generation
- Clone this repository and install packages
```bash
git clone [email protected]:tangqiaoyu/ToolAlpaca.git
cd ToolAlpaca
pip install -r requirements.txt
```
- download public-api data
```bash
python tool_maker/preprocess_public_apis.py -api data/public_apis.json
```
- toolset construction
```bash
export PYTHONPATH=$PYTHONPAT:$(pwd)
export OPENAI_API_KEY=""
python tool_maker/get_elements.py -api data/public_apis.json -out ./data
python tool_maker/natural_language_documentation.py -api ./data/api_data.json
```
- tool-use instances generation
```bash
python instance_generation/instruction.py -api ./data/api_data.json -out ./data
python instance_generation/simulator.py -api ./data/api_data.json
python instance_generation/generation.py -api ./data/api_data.json -out ./data --use_cache
```
## Train
To train Toolapaca, we need to create a prompt to organize the dataset in a format that the standard SFT training code can read, similar to what is done in `build_dataset.py`. Afterward, we can proceed with training using the standard SFT method, only optimizing the loss on `thought`, `action`, and `action input`.
```bash
deepspeed --num_gpus=2 --master_port=12345 train.py \
--deepspeed ${deepspeed config path} \
--model_name_or_path ${path to base model like vicuna-7b} \
--data_path ${data path} \
--bf16 True \
--output_dir outputs/vicuna-7b-toolalpaca/ \
--num_train_epochs 3 \
--per_device_train_batch_size 32 \
--per_device_eval_batch_size 1 \
--gradiExcerpt of 5,748 characters
Read on GitHub17
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:910d318aed3086b8, llm:Repository described as official code for paper 'ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases' — implements tool learning for LMs
matched fp:910d318aed3086b8, llm:Repository described as official code for paper 'ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases' — implements tool learning for LMs
matched fp:910d318aed3086b8, llm:Repository described as official code for paper 'ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases' — implements tool learning for LMs