Text Generation
Transformers
Safetensors
qwen3
code
software-engineering
agent
conversational
text-generation-inference
Instructions to use TIGER-Lab/FIM-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/FIM-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/FIM-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/FIM-8B") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/FIM-8B", 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 TIGER-Lab/FIM-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/FIM-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/FIM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/FIM-8B
- SGLang
How to use TIGER-Lab/FIM-8B 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 "TIGER-Lab/FIM-8B" \ --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": "TIGER-Lab/FIM-8B", "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 "TIGER-Lab/FIM-8B" \ --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": "TIGER-Lab/FIM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/FIM-8B with Docker Model Runner:
docker model run hf.co/TIGER-Lab/FIM-8B
Update model card: official GitHub/dataset links, unified training configs, results, citation
Browse files
README.md
CHANGED
|
@@ -4,31 +4,49 @@ library_name: transformers
|
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
base_model:
|
| 6 |
- Qwen/Qwen3-8B
|
|
|
|
|
|
|
|
|
|
| 7 |
tags:
|
| 8 |
- code
|
| 9 |
- software-engineering
|
| 10 |
- agent
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# FIM-8B
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
- Base model: `Qwen/Qwen3-8B`
|
| 22 |
-
- FIM mid-training: FIM
|
| 23 |
-
- Post-training: SFT on SWE-Lego trajectories
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
```bash
|
| 29 |
CUDA_VISIBLE_DEVICES=0 \
|
| 30 |
python -m vllm.entrypoints.openai.api_server \
|
| 31 |
-
--model
|
| 32 |
--served-model-name FIM-8B \
|
| 33 |
--host 127.0.0.1 \
|
| 34 |
--port 8400 \
|
|
@@ -39,17 +57,15 @@ python -m vllm.entrypoints.openai.api_server \
|
|
| 39 |
> vllm_fim8b.log 2>&1 &
|
| 40 |
```
|
| 41 |
|
| 42 |
-
The checkpoint ships `max_position_embeddings: 163840` and its own chat template, so no rope or template overrides are needed.
|
| 43 |
-
|
| 44 |
Wait until the server is up (model load takes ~1 minute):
|
| 45 |
|
| 46 |
```bash
|
| 47 |
curl -s http://127.0.0.1:8400/v1/models
|
| 48 |
```
|
| 49 |
|
| 50 |
-
## 2. Run the agent on SWE-Bench Verified
|
| 51 |
|
| 52 |
-
Inference uses OpenHands 0.53.0. Define the LLM in `config.toml`:
|
| 53 |
|
| 54 |
```toml
|
| 55 |
[llm.eval_fim]
|
|
@@ -83,6 +99,17 @@ poetry run python evaluation/benchmarks/swe_bench/run_infer.py \
|
|
| 83 |
|
| 84 |
For SWE-Bench Lite, use `--dataset princeton-nlp/SWE-bench_Lite`.
|
| 85 |
|
| 86 |
-
## 3. Score with the SWE-bench harness
|
| 87 |
|
| 88 |
Convert the OpenHands `output.jsonl` to a predictions file with `evaluation/benchmarks/swe_bench/scripts/eval/convert_oh_output_to_swe_json.py`, then evaluate it with the official SWE-bench harness (`python -m swebench.harness.run_evaluation`). The reported score is `resolved_instances / total_instances`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
base_model:
|
| 6 |
- Qwen/Qwen3-8B
|
| 7 |
+
datasets:
|
| 8 |
+
- TIGER-Lab/FIM-Midtraining-400K
|
| 9 |
+
- SWE-Lego/SWE-Lego-Synthetic-Data
|
| 10 |
tags:
|
| 11 |
- code
|
| 12 |
- software-engineering
|
| 13 |
- agent
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# FIM-8B
|
| 17 |
|
| 18 |
+
[📄 Paper (PDF)](https://github.com/TIGER-AI-Lab/FIM-Midtraining/blob/main/paper.pdf) · [💻 GitHub](https://github.com/TIGER-AI-Lab/FIM-Midtraining) · [🤗 Dataset](https://huggingface.co/datasets/TIGER-Lab/FIM-Midtraining-400K) · [🤗 Collection](https://huggingface.co/collections/TIGER-Lab/fim-midtraining)
|
| 19 |
|
| 20 |
+
**FIM-8B** is the strongest released model of *"Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models"*: `Qwen3-8B`, mid-trained on function-aware FIM data, then post-trained on SWE-Lego agent trajectories. The mid-training stage is the only difference from a standard SWE-Lego reproduction — worth **+3.2 points on SWE-Bench-Verified and +5.4 on SWE-Bench-Lite**. Unlike FIM-7B and FIM-14B (R2E-Gym scaffold), this model is evaluated with the SWE-Lego setup: OpenHands `CodeActAgent` for inference and the official SWE-bench harness for scoring.
|
| 21 |
|
| 22 |
+
## Training pipeline
|
| 23 |
|
| 24 |
+
- **Base model**: [`Qwen/Qwen3-8B`](https://huggingface.co/Qwen/Qwen3-8B)
|
| 25 |
+
- **FIM mid-training**: [`midtraining/configs/fim_midtrain.yaml`](https://github.com/TIGER-AI-Lab/FIM-Midtraining/blob/main/midtraining/configs/fim_midtrain.yaml) on [TIGER-Lab/FIM-Midtraining-400K](https://huggingface.co/datasets/TIGER-Lab/FIM-Midtraining-400K) (as-run copy: [`FIM_Midtrain_8B.yaml`](https://github.com/TIGER-AI-Lab/FIM-Midtraining/blob/main/midtraining/configs/FIM_Midtrain_8B.yaml)) → intermediate checkpoint released as [TIGER-Lab/FIM-Mid-8B](https://huggingface.co/TIGER-Lab/FIM-Mid-8B)
|
| 26 |
+
- **Post-training**: SFT on SWE-Lego trajectories (real + synthetic, `resolved`-filtered, 2 epochs) — [`posttraining/swe_lego/`](https://github.com/TIGER-AI-Lab/FIM-Midtraining/tree/main/posttraining/swe_lego) (as-run copy: [`FIM_Posttrain_8B.yaml`](https://github.com/TIGER-AI-Lab/FIM-Midtraining/blob/main/posttraining/swe_lego/FIM_Posttrain_8B.yaml))
|
| 27 |
|
| 28 |
+
## Results
|
| 29 |
|
| 30 |
+
Means over three evaluation seeds, identical harness for both arms (paper Table 1):
|
| 31 |
+
|
| 32 |
+
| Setting | SWE-Bench-Verified | SWE-Bench-Lite |
|
| 33 |
+
|---|---|---|
|
| 34 |
+
| Qwen3-8B + SWE-Lego (reproduced) | 31.80 | 27.30 |
|
| 35 |
+
| **FIM-8B (+ FIM mid-training)** | **35.00** | **32.70** |
|
| 36 |
+
| Δ | +3.20 | +5.40 |
|
| 37 |
+
|
| 38 |
+
## Evaluate on SWE-Bench Verified
|
| 39 |
+
|
| 40 |
+
The complete pinned walkthrough lives at [`evaluation/swebench/released_checkpoints.md`](https://github.com/TIGER-AI-Lab/FIM-Midtraining/blob/main/evaluation/swebench/released_checkpoints.md).
|
| 41 |
+
|
| 42 |
+
### 1. Serve the model with vLLM
|
| 43 |
+
|
| 44 |
+
The checkpoint ships `max_position_embeddings: 163840` and its own chat template, so no rope or template overrides are needed:
|
| 45 |
|
| 46 |
```bash
|
| 47 |
CUDA_VISIBLE_DEVICES=0 \
|
| 48 |
python -m vllm.entrypoints.openai.api_server \
|
| 49 |
+
--model TIGER-Lab/FIM-8B \
|
| 50 |
--served-model-name FIM-8B \
|
| 51 |
--host 127.0.0.1 \
|
| 52 |
--port 8400 \
|
|
|
|
| 57 |
> vllm_fim8b.log 2>&1 &
|
| 58 |
```
|
| 59 |
|
|
|
|
|
|
|
| 60 |
Wait until the server is up (model load takes ~1 minute):
|
| 61 |
|
| 62 |
```bash
|
| 63 |
curl -s http://127.0.0.1:8400/v1/models
|
| 64 |
```
|
| 65 |
|
| 66 |
+
### 2. Run the agent on SWE-Bench Verified
|
| 67 |
|
| 68 |
+
Inference uses OpenHands 0.53.0 with `CodeActAgent`. Define the LLM in `config.toml`:
|
| 69 |
|
| 70 |
```toml
|
| 71 |
[llm.eval_fim]
|
|
|
|
| 99 |
|
| 100 |
For SWE-Bench Lite, use `--dataset princeton-nlp/SWE-bench_Lite`.
|
| 101 |
|
| 102 |
+
### 3. Score with the SWE-bench harness
|
| 103 |
|
| 104 |
Convert the OpenHands `output.jsonl` to a predictions file with `evaluation/benchmarks/swe_bench/scripts/eval/convert_oh_output_to_swe_json.py`, then evaluate it with the official SWE-bench harness (`python -m swebench.harness.run_evaluation`). The reported score is `resolved_instances / total_instances`.
|
| 105 |
+
|
| 106 |
+
## Citation
|
| 107 |
+
|
| 108 |
+
```bibtex
|
| 109 |
+
@article{wang2026fim,
|
| 110 |
+
title={Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models},
|
| 111 |
+
author={Wang, Yubo and Liang, Jiarong and Zhang, Yuxuan and Liu, Xuye and Wei, Cong and Zhang, Yuyu and Nie, Ping and Chen, Wenhu},
|
| 112 |
+
journal={arXiv preprint},
|
| 113 |
+
year={2026}
|
| 114 |
+
}
|
| 115 |
+
```
|