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)# 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=40) 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
Update README with verified ScienceAccelBench results
#4
by leyili6666 - opened
README.md
CHANGED
|
@@ -19,24 +19,61 @@ tags:
|
|
| 19 |
- safetensors
|
| 20 |
---
|
| 21 |
|
| 22 |
-
# PhAI-IDE
|
| 23 |
|
| 24 |
-
**PhAI-IDE
|
| 25 |
|
| 26 |
-
The training
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
## Quick start
|
| 29 |
|
| 30 |
-
Use Transformers 5.16.1, PyTorch and Accelerate.
|
| 31 |
|
| 32 |
```python
|
| 33 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 34 |
|
| 35 |
-
model_id = "AItonomy/PhAI-IDE-
|
|
|
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 37 |
-
model =
|
| 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",
|
|
@@ -45,44 +82,13 @@ 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 |
-
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
|
| 86 |
| --- | --- |
|
| 87 |
| Training dataset | Codex trajectories |
|
| 88 |
| Training examples / tasks | 4,567 segments / 564 tasks |
|
|
@@ -94,6 +100,18 @@ Training uses **ms-swift** supervised fine-tuning with **LoRA across trainable l
|
|
| 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.
|
|
|
|
| 19 |
- safetensors
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# PhAI-IDE
|
| 23 |
|
| 24 |
+
**PhAI-IDE** is a family of models for scientific coding and interaction with tools, available in **4B, 9B, and 72B** sizes. Each model is supervised fine-tuned with [ms-swift](https://github.com/modelscope/ms-swift) and released as full BF16 weights with the final LoRA adapter merged, together with its configuration and tokenizer.
|
| 25 |
|
| 26 |
+
The **training dataset is Codex trajectories**, sourced from [AItonomy/ScienceIDE](https://huggingface.co/datasets/AItonomy/ScienceIDE).
|
| 27 |
+
|
| 28 |
+
## Models
|
| 29 |
+
|
| 30 |
+
| Model | Base model | BF16 weights | License |
|
| 31 |
+
| --- | --- | ---: | --- |
|
| 32 |
+
| [PhAI-IDE-4B](https://huggingface.co/AItonomy/PhAI-IDE-4B) | [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) | 9.08 GB | Apache-2.0 |
|
| 33 |
+
| [PhAI-IDE-9B](https://huggingface.co/AItonomy/PhAI-IDE-9B) | [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) | 18.82 GB | Apache-2.0 |
|
| 34 |
+
| [PhAI-IDE-72B](https://huggingface.co/AItonomy/PhAI-IDE-72B) | [Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct) | 145.41 GB | [Qwen](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/495f39366efef23836d0cfae4fbe635880d2be31/LICENSE) |
|
| 35 |
+
|
| 36 |
+
Weight sizes are approximate; inference also requires memory for runtime allocations and the KV cache.
|
| 37 |
+
|
| 38 |
+
## ScienceAccelBench performance
|
| 39 |
+
|
| 40 |
+
**PhAI-IDE-9B** improves the task-pooled pass rate from **17.09% to 20.89% (+3.80 percentage points)** across all **27 ScienceAccelBench environments**, using **158 valid paired tasks**.
|
| 41 |
+
|
| 42 |
+
Task-held-out, localized scientific-code repair on familiar codebases, with original numerical verification. Each row compares the initial model with its corresponding fine-tuned model on identical tasks. Pass rates are percentages; gains are percentage points.
|
| 43 |
+
|
| 44 |
+
| Model | Environment | Tasks | Initial model | PhAI-IDE | Gain (pp) |
|
| 45 |
+
| --- | --- | ---: | ---: | ---: | ---: |
|
| 46 |
+
| 4B | PLUTO-Particles-Dust | 3 | 0.00 | **33.33** | **+33.33** |
|
| 47 |
+
| 9B | LAPS | 16 | 31.25 | **50.00** | **+18.75** |
|
| 48 |
+
| 9B | MITgcm-biogeo | 8 | 0.00 | **12.50** | **+12.50** |
|
| 49 |
+
| 9B | PLUTO-RMHD | 7 | 0.00 | **28.57** | **+28.57** |
|
| 50 |
+
|
| 51 |
+
## Comparison with published models
|
| 52 |
+
|
| 53 |
+
Scores (%), grouped by benchmark and model size. Each reference entry gives its published score and the **PhAI-IDE score difference in percentage points**. Reference models are approximately the same size: 3–4B, 7–9B, and 67–72B, respectively.
|
| 54 |
+
|
| 55 |
+
| PhAI-IDE | Benchmark | Score | Reference models: score (difference) |
|
| 56 |
+
| --- | --- | ---: | --- |
|
| 57 |
+
| 4B | BBH multistep-arithmetic-two | **97.60** | [Llama-3.2-3B-Instruct](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) (3.21B): 53.2 (**+44.40**); [Phi-3.5-mini-8k-instruct](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) (3.82B): 95.6 (**+2.00**) |
|
| 58 |
+
| 9B | BBH word-sorting | **60.40** | [Llama-3.1-8B-Instruct](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) (8.03B): 51.2 (**+9.20**); [Qwen2.5-7B-Instruct](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) (7.62B): 15.6 (**+44.80**) |
|
| 59 |
+
| 9B | MATH-500 | **92.20** | [InternLM3-8B-Instruct](https://modelscope.cn/models/Shanghai_AI_Laboratory/internlm3-8b-instruct-gptq-int4) (8B): 83 (**+9.20**); [Qwen2.5-7B-Instruct](https://modelscope.cn/models/Shanghai_AI_Laboratory/internlm3-8b-instruct-gptq-int4) (7B): 72.4 (**+19.80**); [Llama-3.1-8B-Instruct](https://modelscope.cn/models/Shanghai_AI_Laboratory/internlm3-8b-instruct-gptq-int4) (8B): 48.4 (**+43.80**) |
|
| 60 |
+
| 72B | AQuA-RAT | **77.56** | [Llama-2-70B-Chat](https://openreview.net/pdf?id=FvfhHucpLd) (70B): 31.32 (**+46.24**) |
|
| 61 |
+
| 72B | ARC-Easy | **84.64** | [Llama-2-70B](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) (70B): 76.5 (**+8.14**); [DeepSeek-LLM-67B-Chat](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) (67B): 81.6 (**+3.04**) |
|
| 62 |
+
| 72B | ARC-Challenge | **64.42** | [Llama-2-70B](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) (70B): 59.5 (**+4.92**); [DeepSeek-LLM-67B-Chat](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/evaluation/more_results.md) (67B): 64.1 (**+0.32**) |
|
| 63 |
+
|
| 64 |
+
Reference scores come from the linked publications, model cards, and independent evaluation reports; evaluation settings and sample counts vary by source. Differences describe reported scores across evaluations, rather than matched-protocol head-to-head gains. BBH entries refer to the named tasks.
|
| 65 |
|
| 66 |
## Quick start
|
| 67 |
|
| 68 |
+
Use Transformers 5.16.1, PyTorch and Accelerate. Set `model_id` to any model in the table above; the example selects the matching model class.
|
| 69 |
|
| 70 |
```python
|
| 71 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForImageTextToText
|
| 72 |
|
| 73 |
+
model_id = "AItonomy/PhAI-IDE-4B"
|
| 74 |
+
loader = AutoModelForCausalLM if model_id.endswith("72B") else AutoModelForImageTextToText
|
| 75 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 76 |
+
model = loader.from_pretrained(model_id, dtype="bfloat16", device_map="auto")
|
|
|
|
|
|
|
| 77 |
inputs = tokenizer.apply_chat_template(
|
| 78 |
[{"role": "user", "content": "Explain how to verify a numerical simulation."}],
|
| 79 |
add_generation_prompt=True, enable_thinking=False, return_dict=True, return_tensors="pt",
|
|
|
|
| 82 |
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
## Training procedure
|
| 86 |
|
| 87 |
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.
|
| 88 |
|
| 89 |
+
All three models use **ms-swift** supervised fine-tuning with **LoRA across trainable linear layers for three epochs**. The release merges each final checkpoint's adapter into its base model. Retained assistant targets provide the next-token training signal, while conversation history and tool observations provide context. The trajectories retain the native `exec` / `wait` interaction format. Heuristic target masking selects assistant actions for supervision while preserving the surrounding interaction history.
|
|
|
|
| 90 |
|
| 91 |
+
| Shared setting | Value |
|
| 92 |
| --- | --- |
|
| 93 |
| Training dataset | Codex trajectories |
|
| 94 |
| Training examples / tasks | 4,567 segments / 564 tasks |
|
|
|
|
| 100 |
|
| 101 |
Long trajectories are organized into segments. Source partition assignments are preserved, with no task identifiers shared between training and validation.
|
| 102 |
|
| 103 |
+
For **4B and 9B**, fine-tuning uses text trajectories with the vision tower and aligner frozen. Their additional settings are:
|
| 104 |
+
|
| 105 |
+
| Setting | 4B and 9B |
|
| 106 |
+
| --- | --- |
|
| 107 |
+
| Maximum training sequence length | 36,864 tokens |
|
| 108 |
+
| Learning rate / schedule | 2e-5 / cosine |
|
| 109 |
+
| Warmup ratio | 0.03 |
|
| 110 |
+
| Batch size per device / accumulation | 1 / 16 |
|
| 111 |
+
| LoRA targets | Linear modules in the unfrozen language model |
|
| 112 |
+
| Optimizer steps | 216 |
|
| 113 |
+
| Packing | Disabled |
|
| 114 |
+
|
| 115 |
### Framework versions
|
| 116 |
|
| 117 |
The release was validated with the following environment.
|