Text Generation
Transformers
Safetensors
English
qwen3_5
image-text-to-text
code
agent
software-engineering
conversational
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 fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs 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 outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs 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. 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
Add the paper link and citation
Browse files19 unmodified lines20212223232425252627282930303132333334353654 unmodified lines919293949495969711 unmodified lines10911011111211211311411511611711811912012119 unmodified lines
<h1>ProgramGen-27B</h1>
<b>Scalable Environment Construction for Agents That Develop Software from Scratch</b><b>Scalable Environment Construction for Long-Horizon Coding Agents</b>
<a href="https://github.com/LegoX/ProgramGen">Code</a> 路 <a href="https://programgen-public-docs.pages.dev/">Documentation</a> 路 <a href="https://huggingface.co/datasets/Lego-X/ProgramGen">Dataset</a><a href="https://arxiv.org/abs/2612.03336">Paper</a> 路 <a href="https://github.com/LegoX/ProgramGen">Code</a> 路 <a href="https://programgen-public-docs.pages.dev/">Documentation</a> 路 <a href="https://huggingface.co/datasets/Lego-X/ProgramGen">Dataset</a>
</div>
> [!Note]> **Qwen3.8-27B fine-tuned on 2,600 ProgramGen trajectories**, in which an agent rebuilds a real open-source project from scratch. Weights and configuration are in the Hugging Face Transformers format.> **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.
> [!Tip]> Tasks and trajectories: [`Lego-X/ProgramGen`](https://huggingface.co/datasets/Lego-X/ProgramGen). Paper: *ProgramGen: Scalable Environment Construction for Agents That Develop Software from Scratch*.> Tasks and trajectories: [`Lego-X/ProgramGen`](https://huggingface.co/datasets/Lego-X/ProgramGen). Paper: [*ProgramGen: Scalable Environment Construction for Long-Horizon Coding Agents*](https://arxiv.org/abs/2612.03336).
## Results
54 unmodified lines<table style="display:table;width:100%;table-layout:fixed;border-collapse:collapse;font-size:14px;margin:0"><tbody><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;border-top:2px solid #B3431F;width:30%;">Base model</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;border-top:2px solid #B3431F;width:70%;"><a href="https://huggingface.co/Qwen/Qwen3.8-27B"><code>Qwen/Qwen3.8-27B</code></a></td></tr><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;">Data</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;">2,600 trajectories from DeepSeek-V4.1-Flash-1017, 1,300 per mode, each scoring above 0.9 on its task; 2,585 are public in <a href="https://huggingface.co/datasets/Lego-X/ProgramGen"><code>Lego-X/ProgramGen</code></a></td></tr><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;">Data</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;">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 <a href="https://huggingface.co/datasets/Lego-X/ProgramGen"><code>Lego-X/ProgramGen</code></a></td></tr><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;">Method</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;">full-parameter supervised fine-tuning; trajectories are kept whole, not split</td></tr><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;">Sequence length</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;">packed to 524,288 tokens with per-example attention masking</td></tr><tr><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;font-weight:600;">Optimisation</td><td style="padding:8px 8px;border-bottom:1px solid rgba(128,128,128,0.18);vertical-align:middle;line-height:1.35;text-align:left;">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</td></tr>11 unmodified lines## Citation
```bibtex[TO ADD]@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},}```README.md+14-6