---
base_model: thinkingmachines/Inkling-2-Mini
library_name: peft
license: apache-2.0
tags:
- trl
- grpo
- async-grpo
- lora
- agents
- harbor
- codex
- harness-adapter
pipeline_tag: image-text-to-text
---

A LoRA adapter for [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini), trained
with reinforcement learning in TRL to work as the model behind [Codex CLI](https://github.com/openai/codex), at the
default reasoning effort (`high`).
> [!Tip]
> **A third to nearly half fewer output tokens, and more SWE-bench Pro tasks solved.** Under Codex, on the tasks both
> models always solve, this adapter writes 33% fewer output tokens on SWE-bench Pro (hard 51) and 44% fewer on
> Terminal-Bench 2.1, with 42% and 50% less reasoning. Over three attempts per task it solves 74.0% of the SWE-bench
> Pro tasks, against 66.0% for the base model, and keeps the same accuracy on Terminal-Bench 2.1 (65.8% against 64.6%).
- **Higher accuracy:** SWE-bench Pro (hard 51), 2 h per task, pass@3 66.0% → 74.0% (+8.0 ± 12.3 points; 7 tasks
gained, 3 lost), avg@3 46.7% → 60.7% (+14.0 ± 9.9 points).
- **Less reasoning per solved task:** 42% fewer reasoning tokens, 33% fewer output tokens in all.
- **Fewer actions:** 16% fewer tool calls and 16% fewer model turns per solved task.
- **About a fifth faster:** 22.7 → 17.7 minutes per solved task (−22%, 95% interval [−30%, −15%]).
- **Terminal-Bench 2.1: same accuracy, half the reasoning.** pass@3 64.6% → 65.8%, with 50% fewer reasoning tokens,
44% fewer output tokens and 27% fewer tool calls per solved task.
> [!Note]
> All results are under Codex CLI 0.172.0, reasoning effort `high`, temperature 1.0, a 131k-token context and up to
> 32k output tokens per turn, in HF Sandboxes, three attempts per task for each model. Base model and adapter run
> under the same settings and are paired per task. Compare base and adapter only within this card.
**Pick your setup**
[](#results)
[](#use-with-codex)
[](#use-with-llama-cpp)
[](https://huggingface.co/harness-hub/Inkling-2-Mini-codex-adapted-GGUF)
[](#merge)
[](#training)
## Results

| SWE-bench Pro (hard 51), 2 h per task | Inkling-2-Mini | **Inkling-2-Mini-codex-adapted** | Change |
|---|---|---|---|
| pass@3 (50 tasks) | 66.0% | **74.0%** | **+8.0 ± 12.3 points** |
| avg@3 (50 tasks) | 46.7% | **60.7%** | **+14.0 ± 9.9 points** |
| Output tokens per solved task (13 tasks) | 34.7k | **23.4k** | **−33%** [−39, −26] |
| Reasoning tokens per solved task (13 tasks) | 23.5k | 13.7k | −42% [−49, −35] |
| Visible output tokens per solved task (13 tasks) | 11.2k | 9.7k | −14% [−25, −1] |
| Tool calls per solved task (13 tasks) | 55.5 | 46.4 | −16% [−23, −9] |
| Model turns per solved task (13 tasks) | 53.5 | 44.7 | −16% [−23, −9] |
| Minutes per solved task (10 tasks) | 22.7 | 17.7 | −22% [−30, −15] |
pass@3 counts a task as solved if any of the three attempts solves it; avg@3 is the share of solved attempts. The
efficiency rows compare the tasks both models solve in every attempt: same tasks, same outcome, so they measure only
how much work each needed, averaged over the three attempts. Tokens come from Codex's own session log, counted with the
model's tokenizer: reasoning is the model's thinking, visible output is its messages and tool-call arguments. ± is the
95% interval of the paired difference over tasks; brackets are 95% bootstrap intervals.
About a fifth faster

Minutes are each attempt's wall clock, sandbox setup and grading included, on the same tasks without the 3 where the
base model lost its connection to the model server in one run (see Evaluation setup): 22.7 → 17.7 minutes per solved
task, −22% [−30, −15].
Terminal-Bench 2.1: same accuracy, half the reasoning

| Terminal-Bench 2.1, 1 h per task | Inkling-2-Mini | **Inkling-2-Mini-codex-adapted** | Change |
|---|---|---|---|
| pass@3 (79 tasks) | 64.6% | 65.8% | +1.3 ± 8.3 points |
| avg@3 (79 tasks) | 54.0% | 55.3% | +1.3 ± 5.2 points |
| Output tokens per solved task (31 tasks) | 14.9k | **8.3k** | **−44%** [−53, −36] |
| Reasoning tokens per solved task (31 tasks) | 10.4k | 5.2k | −50% [−60, −40] |
| Visible output tokens per solved task (31 tasks) | 4.5k | 3.1k | −31% [−37, −24] |
| Tool calls per solved task (31 tasks) | 20.8 | 15.2 | −27% [−36, −16] |
Same definitions as above. 79 of the 89 tasks have all six attempts graded; the other 10 each have a base-model attempt
that was not graded (the connection to the model server dropped, or the agent's output could not be read) and are
left out for both models. Minutes are not compared on Terminal-Bench: the measured −26% comes mostly from the base
model's stream retries (see Evaluation setup), and without them the difference is within noise.
Evaluation setup
- **Harness.** Codex CLI 0.172.0 (`codex exec`), through a custom provider on the Responses API without WebSockets.
Its tools are `exec_command`, `write_stdin` and `request_user_input`; file edits go through `apply_patch` inside
`exec_command`. Web search, image tools, subagents, goals, plugins and update checks are off. Reasoning effort `high`
(the chat template's default), temperature 1.0, 131k-token context, up to 32k output tokens per turn.
- **Serving.** vLLM nightly `b976fff86af82c559b19aa676f52ea193eb0c188`, the adapter loaded as a runtime LoRA.
- **Sandboxes.** HF Sandboxes, for the base model and the adapter alike.
- **Benchmarks.** [SWE-bench Pro (hard 51)](https://huggingface.co/datasets/harness-hub/swebench-pro-v2-hard51-harbor):
the 51 hardest tasks of SWE-bench Pro, 2 h per task. Terminal-Bench 2.1, all 89 tasks, 1 h per task. Three attempts
per task for each model on both.
- **Failed runs.** SWE-bench Pro: one adapter attempt was not graded (an error reading the agent's output), so its task is left out
of pass@3 and avg@3 (50 of 51 tasks). Every other attempt was graded. One attempt per model ended on a harness error
and counts as a failure. Terminal-Bench 2.1: see its section above.
- **Time.** On SWE-bench Pro, in one base run, the tunnel between the sandboxes and the model server dropped on some attempts (HTTP 530,
retried by Codex), which slows those attempts down: the 3 tasks this touched are left out of the minutes, which use
the other 10. Codex also retries a reply after 5 minutes without data (the serving proxy sends a reply only once it
is complete), which happens more often to the base model; taking 5 minutes off per retry still gives −20%
[−28, −13].
- **Grading.** Every verifier run first resets the repository's tests to their original state and applies the
benchmark's reference tests, so changes the agent makes to tests cannot affect its grade.
Contamination check
No training task shares a name or a repository with SWE-bench Pro hard 51. The training set was not built with an
explicit step that excludes evaluation tasks: we checked it was clean after the fact.
## Use with Codex
Serve the adapter with vLLM and point Codex at it
### 1. Serve the adapter with vLLM
Inkling 2 Mini needs a vLLM nightly; we used commit `b976fff86af82c559b19aa676f52ea193eb0c188`. The adapter under
vLLM's module names is in `vllm/`:
```sh
hf download harness-hub/Inkling-2-Mini-codex-adapted --include "vllm/*" --local-dir inkling-codex
vllm serve thinkingmachines/Inkling-2-Mini \
--enable-lora --max-lora-rank 32 --lora-modules inkling-codex=./inkling-codex/vllm \
--enable-auto-tool-choice --tool-call-parser inkling --reasoning-parser inkling \
--max-model-len 131072
```
The chat template's default reasoning effort is `high`, which is what this adapter was trained and evaluated with, so
no template argument is needed.
### 2. Point Codex at it
Install Codex CLI 0.172.0, the version of the evaluations:
```sh
npm install -g @openai/codex@0.172.0
```
Add the server as a provider in `~/.codex/config.toml`:
```toml
model = "inkling-codex"
model_provider = "local"
model_context_window = 131072
web_search = "disabled"
[model_providers.local]
name = "local"
base_url = "http://localhost:8000/v1"
env_key = "INKLING_API_KEY"
wire_api = "responses"
supports_websockets = false
```
```sh
export INKLING_API_KEY=dummy
codex exec "Find out why the tests in tests/test_parser.py fail and fix the bug."
```
## Use with Codex (llama.cpp)
Serve the GGUF with llama.cpp and point Codex at it
The GGUF version is in
[harness-hub/Inkling-2-Mini-codex-adapted-GGUF](https://huggingface.co/harness-hub/Inkling-2-Mini-codex-adapted-GGUF):
the adapter merged into the base model as one `Q8_0` file, and the adapter alone as an F16 LoRA.
```sh
llama serve -hf harness-hub/Inkling-2-Mini-codex-adapted-GGUF:Q8_0 -c 131072 --alias inkling-codex
```
Or the adapter on top of a GGUF of the base model:
```sh
hf download ggml-org/Inkling-2-Mini-GGUF Inkling-2-Mini-Q8_0.gguf --local-dir .
hf download harness-hub/Inkling-2-Mini-codex-adapted-GGUF Inkling-2-Mini-codex-adapted-lora-F16.gguf --local-dir .
llama serve -m Inkling-2-Mini-Q8_0.gguf --lora Inkling-2-Mini-codex-adapted-lora-F16.gguf \
-c 131072 --alias inkling-codex
```
Then set `base_url = "http://localhost:8080/v1"` in `config.toml` above. Codex talks to the Responses API
(`/v1/responses`): use a llama.cpp build that serves it.
The adapter was trained on the base model's own weights: the closer the base GGUF is to them, the closer you get to the
trained behavior. `Q8_0` is a good default; lower-bit quants drift further. The GGUF version has not been re-evaluated.
## Merge the adapter into the base model
Get a standalone model, with no LoRA at serving time
```python
import torch
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoTokenizer
base = AutoModelForImageTextToText.from_pretrained("thinkingmachines/Inkling-2-Mini", dtype=torch.bfloat16, device_map="cpu")
model = PeftModel.from_pretrained(base, "harness-hub/Inkling-2-Mini-codex-adapted").merge_and_unload()
model.save_pretrained("Inkling-2-Mini-codex-merged")
AutoTokenizer.from_pretrained("thinkingmachines/Inkling-2-Mini").save_pretrained("Inkling-2-Mini-codex-merged")
```
The adapter at the repository root uses PEFT's module names; the copy in `vllm/` is for vLLM. Then serve the merged
model like the base model, without the LoRA flags:
```sh
vllm serve Inkling-2-Mini-codex-merged --served-model-name inkling-codex \
--enable-auto-tool-choice --tool-call-parser inkling --reasoning-parser inkling \
--max-model-len 131072
```
## Training
Method, data, hyperparameters and hardware
| | |
|---|---|
| Method | [AsyncGRPO](https://huggingface.co/docs/trl/main/en/async_grpo_trainer) (TRL), LoRA |
| Environment | [Harbor](https://github.com/laude-institute/harbor) tasks, rollouts in HF Sandboxes |
| Harness | Codex CLI 0.172.0 with the settings above, reasoning effort `high` (the template default) |
| Tasks | 989 tasks from [UltraTerminals](https://huggingface.co/datasets/harness-hub/UltraTerminals): agentic coding tasks (SWE-smith Python and Go, Tasksmith) and cybersecurity tasks (Cedar and OpenFGA authorization), without the tasks an earlier Inkling 2 Mini run always solved |
| Reward | The task's verifier result (0 or 1). Solved rollouts also get a tool-efficiency bonus, 0.1 × clip(1 − tool calls / 30, 0, 1), and a length penalty, −0.2 × min(1, output tokens / 65,536) |
| Guardrails | safeagents checks on every tool call during training: web fetches to hosts that appear nowhere in the task are blocked |
| Steps | 200 (this checkpoint). Steps 121–200 resumed from the step-120 checkpoint, with Codex's context compaction handled in the rollouts from then on |
| Learning rate | 2e-5 |
| LoRA | r = 32, alpha = 64, dropout 0, on the language model's attention projections (q, k, v, o) |
| Rollouts | 8 per task, temperature 1.0 |
| Batch | gradient accumulation 16 |
| Hardware | 4× NVIDIA B300: vLLM on 2, the trainer on 2; about 7 minutes per step |
The model learns to do less during training. On solved rollouts, from the first 10 steps to the last 10, tool calls
drop from 11.7 to 9.2 (−21%) and output tokens from 14.3k to 8.6k (−40%), while the share of solved rollouts rises
from 0.56 to 0.64:

The training scripts are in the [TRL recipe](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/index.html) ([files](https://huggingface.co/spaces/trl-lib/trl-recipes/tree/main/recipes/harness-adapters/Inkling-2-Mini)).
## Links
- Base model: [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (Thinking
Machines Lab, Apache 2.0)
- The same recipe under other harnesses: [pi](https://huggingface.co/harness-hub/Inkling-2-Mini-pi-adapted),
[Hermes](https://huggingface.co/harness-hub/Inkling-2-Mini-hermes-adapted),
[omp](https://huggingface.co/harness-hub/Inkling-2-Mini-omp-adapted)
- Trainer: [TRL AsyncGRPO](https://huggingface.co/docs/trl/main/en/async_grpo_trainer)
- Harness: [Codex CLI](https://github.com/openai/codex)