Text Generation
Transformers
Safetensors
qwen2
phai-ide
science
code
tool-use
sft
lora
conversational
text-generation-inference
Instructions to use AItonomy/PhAI-IDE-72B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AItonomy/PhAI-IDE-72B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AItonomy/PhAI-IDE-72B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AItonomy/PhAI-IDE-72B") model = AutoModelForCausalLM.from_pretrained("AItonomy/PhAI-IDE-72B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AItonomy/PhAI-IDE-72B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AItonomy/PhAI-IDE-72B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AItonomy/PhAI-IDE-72B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AItonomy/PhAI-IDE-72B
- SGLang
How to use AItonomy/PhAI-IDE-72B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AItonomy/PhAI-IDE-72B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AItonomy/PhAI-IDE-72B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AItonomy/PhAI-IDE-72B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AItonomy/PhAI-IDE-72B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AItonomy/PhAI-IDE-72B with Docker Model Runner:
docker model run hf.co/AItonomy/PhAI-IDE-72B
Add PhAI-IDE-72B model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
model_name: PhAI-IDE-72B
|
| 3 |
+
base_model: Qwen/Qwen2.5-72B-Instruct
|
| 4 |
+
base_model_relation: finetune
|
| 5 |
+
datasets:
|
| 6 |
+
- AItonomy/ScienceIDE
|
| 7 |
+
library_name: transformers
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
license: other
|
| 10 |
+
license_name: qwen
|
| 11 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/495f39366efef23836d0cfae4fbe635880d2be31/LICENSE
|
| 12 |
+
tags:
|
| 13 |
+
- phai-ide
|
| 14 |
+
- science
|
| 15 |
+
- code
|
| 16 |
+
- tool-use
|
| 17 |
+
- sft
|
| 18 |
+
- lora
|
| 19 |
+
- safetensors
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# PhAI-IDE-72B
|
| 23 |
+
|
| 24 |
+
**PhAI-IDE-72B** is a supervised fine-tune of [Qwen/Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct) for scientific coding and interaction with tools, trained using [ms-swift](https://github.com/modelscope/ms-swift). The release contains full BF16 weights with the final LoRA adapter merged.
|
| 25 |
+
|
| 26 |
+
The training data is sourced from [AItonomy/ScienceIDE](https://huggingface.co/datasets/AItonomy/ScienceIDE). This model uses **Codex-only repaired trajectories v3 for 3 epochs**.
|
| 27 |
+
|
| 28 |
+
## Quick start
|
| 29 |
+
|
| 30 |
+
Use Transformers 5.16.1, PyTorch and Accelerate. The example loads the model, configuration and tokenizer directly from this repository.
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 34 |
+
|
| 35 |
+
model_id = "leyili6666/PhAI-IDE-72B"
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 38 |
+
model_id, dtype="bfloat16", device_map="auto",
|
| 39 |
+
)
|
| 40 |
+
inputs = tokenizer.apply_chat_template(
|
| 41 |
+
[{"role": "user", "content": "Explain how to verify a numerical simulation."}],
|
| 42 |
+
add_generation_prompt=True, enable_thinking=False, return_dict=True, return_tensors="pt",
|
| 43 |
+
).to(model.device)
|
| 44 |
+
output = model.generate(**inputs, max_new_tokens=128, do_sample=False)
|
| 45 |
+
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
BF16 weights occupy approximately 145.41 GB, plus runtime memory and KV cache.
|
| 49 |
+
|
| 50 |
+
## Benchmark performance
|
| 51 |
+
|
| 52 |
+
### Score improvements
|
| 53 |
+
|
| 54 |
+
Scores (%); gains in percentage points.
|
| 55 |
+
|
| 56 |
+
| Benchmark | Qwen/Qwen2.5-72B-Instruct | PhAI-IDE-72B | Gain (pp) |
|
| 57 |
+
| --- | ---: | ---: | ---: |
|
| 58 |
+
| ARC-Easy | 83.33 | **84.64** | **+1.30** |
|
| 59 |
+
| ARC-Challenge | 63.05 | **64.42** | **+1.37** |
|
| 60 |
+
| OpenBookQA | 48.80 | **49.20** | **+0.40** |
|
| 61 |
+
| LiveCodeBench execution-v2 | 58.46 | **60.13** | **+1.67** |
|
| 62 |
+
| BIG-bench CS algorithms | 75.76 | **82.58** | **+6.82** |
|
| 63 |
+
|
| 64 |
+
### Comparison with published models
|
| 65 |
+
|
| 66 |
+
Scores (%); evaluation settings vary by source.
|
| 67 |
+
|
| 68 |
+
| Benchmark | Reference model | Parameters | Published score | PhAI-IDE-72B result | Source |
|
| 69 |
+
| --- | --- | ---: | ---: | ---: | --- |
|
| 70 |
+
| GSM8K | Llama-3-70B-Instruct | 70B | 93 | **93.75** | [Meta model card](https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct#instruction-tuned-models) |
|
| 71 |
+
| GSM8K | DeepSeek-LLM-67B-Chat | 67B | 84.1 | **93.75** | [DeepSeek official results](https://github.com/deepseek-ai/DeepSeek-LLM#3-evaluation-results) |
|
| 72 |
+
| GSM8K | Qwen2-72B-Instruct | 72B | 93.2 | **93.75** | [Qwen2.5 report, Table 6](https://arxiv.org/html/2412.15115v2#S5.SS2.SSS1) |
|
| 73 |
+
| GSM8K | SciTulu-70B | 70B | 67.5 | **93.75** | [SciRIFF report, Table 7](https://arxiv.org/html/2406.07835v2#A3) |
|
| 74 |
+
| GSM8K | WizardMath-Llama-RL (Llama 2) | 70B | 92.8 | **93.75** | [WizardMath report, Tables 1 & 15](https://arxiv.org/html/2308.09583v2) |
|
| 75 |
+
| ARC-Easy | DeepSeek-LLM-67B-Chat | 67B | 81.6 | **84.64** | [DeepSeek official results](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) |
|
| 76 |
+
| ARC-Challenge | DeepSeek-LLM-67B-Chat | 67B | 64.1 | **64.42** | [DeepSeek official results](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) |
|
| 77 |
+
|
| 78 |
+
## Training procedure
|
| 79 |
+
|
| 80 |
+
ScienceIDE demonstrations were collected with **GPT-5.6-sol** and filtered using a **numerical-equivalence verifier**. They capture code inspection, tool use, and responses to execution feedback.
|
| 81 |
+
|
| 82 |
+
Training uses **ms-swift** supervised fine-tuning with **LoRA across trainable linear layers for three epochs**. The release merges the final checkpoint's adapter into the base model. Retained assistant targets provide the next-token training signal, while conversation history and tool observations provide context. The Codex-only data retains the native `exec` / `wait` interaction format. Heuristic target masking selects assistant actions for supervision while preserving the surrounding interaction history.
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
| Setting | Value |
|
| 86 |
+
| --- | --- |
|
| 87 |
+
| Training subset | Codex-only repaired trajectories v3 |
|
| 88 |
+
| Training examples / tasks | 4,567 segments / 564 tasks |
|
| 89 |
+
| Validation examples / tasks | 544 segments / 81 tasks |
|
| 90 |
+
| Train/validation task overlap | 0 |
|
| 91 |
+
| Training epochs | 3 |
|
| 92 |
+
| LoRA rank / alpha / dropout | 32 / 64 / 0.05 |
|
| 93 |
+
| Released weights | LoRA merged into BF16 Safetensors |
|
| 94 |
+
|
| 95 |
+
Long trajectories are organized into segments. Source partition assignments are preserved, with no task identifiers shared between training and validation.
|
| 96 |
+
|
| 97 |
+
### Framework versions
|
| 98 |
+
|
| 99 |
+
The release was validated with the following environment.
|
| 100 |
+
|
| 101 |
+
| Component | Version |
|
| 102 |
+
| --- | --- |
|
| 103 |
+
| Python | 3.11 |
|
| 104 |
+
| ms-swift | 4.5.3 |
|
| 105 |
+
| Transformers | 5.16.1 |
|
| 106 |
+
| PyTorch | 2.6.0+cu124 |
|
| 107 |
+
| PEFT | 0.20.0 |
|
| 108 |
+
| Datasets | 4.8.4 |
|
| 109 |
+
| Tokenizers | 0.23.2 |
|
| 110 |
+
| Accelerate | 1.14.0 |
|
| 111 |
+
|
| 112 |
+
## Citations
|
| 113 |
+
|
| 114 |
+
The training framework is [ms-swift](https://github.com/modelscope/ms-swift), and adapter training uses [LoRA](https://arxiv.org/abs/2106.09685).
|
| 115 |
+
|
| 116 |
+
```bibtex
|
| 117 |
+
@misc{zhao2024swift,
|
| 118 |
+
title = {SWIFT: A Scalable lightWeight Infrastructure for Fine-Tuning},
|
| 119 |
+
author = {Yuze Zhao and others},
|
| 120 |
+
year = {2024},
|
| 121 |
+
eprint = {2408.05517},
|
| 122 |
+
archivePrefix = {arXiv},
|
| 123 |
+
url = {https://arxiv.org/abs/2408.05517}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
@misc{hu2021lora,
|
| 127 |
+
title = {LoRA: Low-Rank Adaptation of Large Language Models},
|
| 128 |
+
author = {Edward J. Hu and Yelong Shen and Phillip Wallis and Zeyuan Allen-Zhu and Yuanzhi Li and Shean Wang and Lu Wang and Weizhu Chen},
|
| 129 |
+
year = {2021},
|
| 130 |
+
eprint = {2106.09685},
|
| 131 |
+
archivePrefix = {arXiv},
|
| 132 |
+
url = {https://arxiv.org/abs/2106.09685}
|
| 133 |
+
}
|
| 134 |
+
```
|