Run this model with HF Jobs
Run Lego-X/ProgramGen-27B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Lego-X/ProgramGen-27B. Ask me which dataset to train on, then push the LoRA adapter to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs and Transformers to run batch inference with https://huggingface.co/Lego-X/ProgramGen-27B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the predictions back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs and Lighteval to evaluate https://huggingface.co/Lego-X/ProgramGen-27B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Lego-X/ProgramGen-27B with Transformers and bitsandbytes. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lego-X/ProgramGen-27B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lego-X/ProgramGen-27B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lego-X/ProgramGen-27B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Lego-X/ProgramGen-27B") model = AutoModelForMultimodalLM.from_pretrained("Lego-X/ProgramGen-27B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lego-X/ProgramGen-27B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lego-X/ProgramGen-27B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lego-X/ProgramGen-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lego-X/ProgramGen-27B
- SGLang
How to use Lego-X/ProgramGen-27B 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 "Lego-X/ProgramGen-27B" \ --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": "Lego-X/ProgramGen-27B", "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 "Lego-X/ProgramGen-27B" \ --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": "Lego-X/ProgramGen-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Lego-X/ProgramGen-27B with Docker Model Runner:
docker model run hf.co/Lego-X/ProgramGen-27B
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 "Lego-X/ProgramGen-27B" \
--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": "Lego-X/ProgramGen-27B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'ProgramGen-27B
Scalable Environment Construction for Long-Horizon Coding Agents
Paper · Code · Documentation · Dataset
Qwen3.8-27B fine-tuned on 2,585 ProgramGen trajectories, in which an agent rebuilds a real open-source project from scratch. Weights and configuration are in the Hugging Face Transformers format.
Tasks and trajectories:
Lego-X/ProgramGen. Paper: ProgramGen: Scalable Environment Construction for Long-Horizon Coding Agents.
Results
| Qwen3.8-27B | ProgramGen-27B | Change | |
|---|---|---|---|
| Building software from scratch | |||
Repository generation NL2Repo-Bench | Pass 39.3 Full 4.8 | Pass 46.6 Full 4.8 | Pass +7.3 Full 0.0 |
Program reconstruction ProgramBench | Avg. 48.0 Almost 4.0 | Avg. 61.0 Almost 10.0 | Avg. +13.0 Almost +6.0 |
| Software repair | |||
DeepSWE resolved, % | 41.6 | 60.2 | +18.6 |
SWE-bench Pro HARD resolved, % | 76.5 | 84.3 | +7.8 |
SWE-bench Pro V2 resolved, % | 92.5 | 94.4 | +1.9 |
SWE-bench Multilingual resolved, % | 78.0 | 79.7 | +1.7 |
| Terminal tasks | |||
Terminal-Bench 2.1 resolved, % | 60.7 | 70.8 | +10.1 |
The supervision is program reconstruction only; the gains on the software-repair benchmarks (DeepSWE, SWE-bench Pro, SWE-bench Multilingual) and on Terminal-Bench 2.1 come without any repair or terminal-task data. The paper gives the protocol and the comparison with other models.
Usage
The model keeps the architecture, tokenizer and tool-calling format of Qwen3.8-27B, so it is served the same way. We evaluated it with SGLang:
sglang serve --model-path Lego-X/ProgramGen-27B \
--context-length 524288 \
--tool-call-parser qwen3_coder --reasoning-parser qwen3 \
--tensor-parallel-size 2
Settings used in our evaluations:
| Setting | Value |
|---|---|
| Context window | 524,288 tokens (the native 262,144 extended with YaRN, factor 2; already set in config.json) |
| Sampling | temperature 1.0, top-p 0.95, top-k 20 |
| Maximum output per call | 128K tokens |
| Agent | OpenHands SDK 1.33, up to 1,000 model calls and six hours per task |
Use the chat template shipped in this repository. It is the template the model was trained with and differs from the one of the base model: it does not add a reasoning-effort instruction to the system prompt.
Fine-tuning used text only. The vision encoder of the base model is kept unchanged and was not evaluated.
Training
| Base model | Qwen/Qwen3.8-27B |
| Data | 2,585 trajectories from DeepSeek-V4.1-Flash-1017, 1,290 in forward mode and 1,295 in reverse mode, each scoring above 0.9 on its task; public in Lego-X/ProgramGen |
| Method | full-parameter supervised fine-tuning; trajectories are kept whole, not split |
| Sequence length | packed to 524,288 tokens with per-example attention masking |
| Optimisation | 8 epochs (184 steps), peak learning rate 4e-5, 10% warmup, cosine decay to 4e-6, AdamW with β = (0.9, 0.98), weight decay 0.04, seed 1105 |
| Batch | 48 packed sequences per step |
| Precision | bfloat16 |
| Framework | LLaMA-Factory with the Megatron-LM backend |
Licence
Apache-2.0, the licence of the base model.
Citation
@misc{xiong2026programgen,
title={ProgramGen: Scalable Environment Construction for Long-Horizon Coding Agents},
author={Conghao Xiong and Chaofan Tao and Jierun Chen and Yuxin Jiang and Ruoyu Wang and Sidi Yang and Xiao-Hui Li and Lifeng Shang and Hao Chen and Joseph J. Y. Sung and Haoli Bai and Irwin King},
year={2026},
eprint={2612.03336},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2612.03336},
}
- Downloads last month
- 15
Model tree for Lego-X/ProgramGen-27B
Base model
Qwen/Qwen3.8-27B
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Lego-X/ProgramGen-27B" \ --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": "Lego-X/ProgramGen-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'