Image-Text-to-Text
Transformers
Safetensors
qwen3_5
agents
tool-use
reinforcement-learning
terminal-agent
conversational
Instructions to use twothsnd/ReTerm-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use twothsnd/ReTerm-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="twothsnd/ReTerm-9B") 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("twothsnd/ReTerm-9B") model = AutoModelForMultimodalLM.from_pretrained("twothsnd/ReTerm-9B", 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 twothsnd/ReTerm-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "twothsnd/ReTerm-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "twothsnd/ReTerm-9B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/twothsnd/ReTerm-9B
- SGLang
How to use twothsnd/ReTerm-9B 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 "twothsnd/ReTerm-9B" \ --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": "twothsnd/ReTerm-9B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "twothsnd/ReTerm-9B" \ --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": "twothsnd/ReTerm-9B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use twothsnd/ReTerm-9B with Docker Model Runner:
docker model run hf.co/twothsnd/ReTerm-9B
|
Download README.md from twothsnd/ReTerm-9B: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/twothsnd/ReTerm-9B/resolve/main/README.md
- Command line
-
hf download hf://twothsnd/ReTerm-9B/README.md
-
curl -L -o README.md https://huggingface.co/twothsnd/ReTerm-9B/resolve/main/README.md
2.77 kB
| library_name: transformers | |
| license: apache-2.0 | |
| base_model: Qwen/Qwen3.5-9B | |
| datasets: | |
| - twothsnd/ReTerm-10K | |
| pipeline_tag: image-text-to-text | |
| tags: | |
| - agents | |
| - tool-use | |
| - reinforcement-learning | |
| - terminal-agent | |
| # ReTerm-9B | |
| This repository contains **ReTerm-9B**, presented in [ReTerm: Recovery Training for Self-Improving Terminal Agents](https://arxiv.org/pdf/2610.18484). ReTerm-9B is a self-improving terminal agent built on Qwen3.5-9B through SFT and ReTerm-GRPO. The model uses the Qwen3.5 architecture and chat template. | |
| [**Paper**](https://arxiv.org/pdf/2610.18484) · [**Training code**](https://github.com/twothsnd/ReTerm) · [**ReTerm-10K dataset**](https://huggingface.co/datasets/twothsnd/ReTerm-10K) · [**Base model**](https://huggingface.co/Qwen/Qwen3.5-9B) | |
| ## 👀 About ReTerm | |
| We introduce **ReTerm**, a self-improving terminal agent trained to recover from errors produced during its own execution. | |
| We construct **ReTerm-10K**, a high-quality recovery trajectory dataset generated through a dedicated data pipeline for SFT cold start. Moreover, we propose **ReTerm-GRPO**, an online RL algorithm that branches into multiple independent self-recovery attempts from the agent's own failure states. Their verifier outcomes provide group-relative learning signals, enabling the agent to self-improve through its own recovery experience. | |
| Built on Qwen3.5-9B, **ReTerm-9B** demonstrates strong performance on challenging terminal and software engineering tasks, with generalization across out-of-domain benchmarks and different agent harnesses. | |
| ## 🏆 Performance | |
| ReTerm-9B achieves strong results on terminal and software engineering benchmarks: | |
| | Benchmark | Pass@1 | | |
| | --- | ---: | | |
| | OpenThoughts-TBLite | **60.6%** | | |
| | Terminal-Bench 2.0 | **34.8%** | | |
| | SWE-bench Verified | **58.4%** | | |
| | AIME 2024 | **86.7%** | | |
| | AIME 2025 | **93.3%** | | |
| | Aider Polyglot | **20.4%** | | |
| | SpreadsheetBench Verified | **48.8%** | | |
| Beyond these core evaluations, ReTerm also generalizes to out-of-domain tasks, including mathematical reasoning and spreadsheet processing. The improvement trend persists across different agent harnesses, suggesting transferable capabilities across interaction setups. | |
| ## 🎥 Recovery Example | |
| <div align="center"> | |
| <img src="assets/figure1-white.png" alt="Recovery behavior of GRPO and ReTerm-GRPO on a PyStan installation task" width="95%"> | |
| </div> | |
| ## 🔧 Using the model | |
| ReTerm-9B can be loaded with Qwen3.5-compatible inference frameworks. For terminal-agent use, apply the Qwen3.5 chat template and tool-call protocol with an agent harness that executes commands and returns environment observations. Training code and configurations are available in the [ReTerm repository](https://github.com/twothsnd/ReTerm). | |