Image-Text-to-Text
Transformers
Safetensors
qwen3_5
agents
tool-use
reinforcement-learning
terminal-agent
conversational
Run this model with HF Jobs
Run twothsnd/ReTerm-9B 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/twothsnd/ReTerm-9B. 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/twothsnd/ReTerm-9B 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/twothsnd/ReTerm-9B. 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/twothsnd/ReTerm-9B. 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 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
Refresh ReTerm model card presentation
Browse files13 unmodified lines141516171819202122232425262728293031323334353637383913 unmodified lines# ReTerm-9B[**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**ReTerm-9B** is a Qwen3.5-9B terminal agent trained to recover from errors made during its own execution. It learns from successful teacher continuations of failed attempts and from ReTerm-GRPO, which collects new failures as the policy changes and trains multiple recoveries from each preserved failure state.<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>In this example, a failed `import pystan` leads the GRPO-trained agent to repeat installation attempts. ReTerm-GRPO inspects the installed files and identifies the `stan` module provided by PyStan 3.## 🏆 PerformanceThe final checkpoint completes **31/89 Terminal-Bench 2.0 tasks (34.8% Pass@1)** and reaches **58.4% Pass@1 on SWE-bench Verified** under the evaluation settings in our study. Comparisons use the same agent harness, task images, verifier, inference budget, and sampling configuration.## 🔧 Using the modelThe Hugging Face weights run as a terminal agent when paired with a harness that supplies the task instruction, a bash tool, command execution, observations, and the task environment. Use the Qwen3.5 chat template and matching tool-call protocol. The [training repository](https://github.com/twothsnd/ReTerm) describes the interaction and state-preservation interfaces used by ReTerm.## ⚠️ LimitationsThe model can issue incorrect or destructive commands, modify files unexpectedly, and declare completion prematurely. Run it in an isolated environment with resource and permission limits, and independently verify its work on new tasks.13 unmodified lines141516171819202122232425262728293031323334353637383940414243444546474813 unmodified lines# ReTerm-9BThis repository contains **ReTerm-9B**, a terminal agent built on Qwen3.5-9B through SFT and ReTerm-GRPO. The model uses the Qwen3.5 architecture and chat template.[**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 ReTermWe introduce **ReTerm**, a terminal agent with strong recovery capabilities, 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 recovery attempts from the agent's own failure states. Their verifier outcomes provide group-relative learning signals, enabling recovery capability to co-evolve with task-solving capability.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.## 🏆 PerformanceReTerm-9B achieves strong results on terminal and software engineering benchmarks:| Benchmark | Pass@1 || --- | ---: || Terminal-Bench 2.0 | **34.8%** || SWE-bench Verified | **58.4%** |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 modelReTerm-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).
README.md+19-10