Downloads · 30 days
4
9% of all-time downloads
orangefabercastell/gemma-2-2b-it-pi-mono-sft
gemma-2-2b-it-pi-mono-sft is a machine learning model from orangefabercastell. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Supervised fine-tuned Gemma 2 2B (google/gemma-2-2b-it / unsloth/gemma-2-2b-it-bnb-4bit) trained on real-world autonomous coding-agent execution traces from badlogicgames/pi-mono.
Downloads · 30 days
4
9% of all-time downloads
All-time downloads
46
Public
Parameters
2.6B
5.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.2 GB · 99%
From the Hugging Face model README
Supervised fine-tuned Gemma 2 2B (google/gemma-2-2b-it / unsloth/gemma-2-2b-it-bnb-4bit) trained on real-world autonomous coding-agent execution traces from badlogicgames/pi-mono.
The model was adapted using 4-bit Quantized Low-Rank Adaptation (QLoRA) with completion-only loss masking. This enables autonomous workspace navigation, file reading and editing, shell command execution, and multi-turn developer workflows without degrading foundational Python programming capabilities.
Evaluated under identical execution conditions using the Inspect AI benchmarking framework in a local sandboxed execution environment:
| Benchmark Task | Base Gemma 2 2B | Fine-Tuned Agent SFT | Net Delta | Assessment |
|---|---|---|---|---|
HumanEval (openai_humaneval) | 26.4% | 28.6% | +2.2% | Zero catastrophic forgetting; modest gain on zero-shot Python synthesis. |
MBPP (google-research-datasets/mbpp) | 32.8% | 34.2% | +1.4% | Consistent improvement on elementary algorithmic problem solving. |
[!NOTE] Understanding the Benchmark Delta: HumanEval and MBPP test isolated algorithmic coding puzzles ("write a function that checks if two numbers are coprime"). The primary capability acquired through trace fine-tuning is autonomous workspace tool calling (
bash,read,edit,write,grep), where the base model scores 0% (it refuses file operations) while the fine-tuned model actively invokes structured workspace actions.
Task Prompt:
"Please inspect 'src/server.py' to find where the database connection port is defined, and change it to 5432 using the available workspace tools."
I can't access files or specific filesystems, including your project's src/server.py.
However, I can guide you on how to find the database connection port in your code:
1. Locate the Database Connection: Look for imports related to database connections...
2. Identify the Connection String: The string contains host, port, username...
3. Change the Port: Replace the existing port number with 5432...
(Base model refuses file interactions and gives passive, theoretical advice).
I will search for the port configuration in 'src/server.py' and update it.
Action: read
Path: src/server.py
Limit: 50
[After receiving file content]:
Action: edit
Path: src/server.py
OldText: PORT = 8080
NewText: PORT = 5432
(Fine-tuned model assumes the role of an autonomous agent and emits structured workspace actions).
A 3-job parameter sweep was executed on Kaggle GPU hardware (80 optimization steps per configuration) tracked via TrackIO:
| Job ID | Learning Rate | LoRA Rank ($r$) | LoRA Alpha ($\alpha$) | Training Loss | Held-Out Eval Loss | Status |
|---|---|---|---|---|---|---|
lr1e4-r16-len2k | 0.0001 | 16 | 32 | 1.5094 | 0.2988 | Selected Best |
lr5e5-r16-len2k | 5e-05 | 16 | 32 | 1.8206 | 0.3158 | Sweep Variant |
lr1e4-r8-len2k | 0.0001 | 8 | 16 | 1.7425 | 0.3044 | Sweep Variant |
lr1e4-r16-len2k1.50940.298892.63%1.25 down to 0.54 without loss spikes or weight divergence.+2.2%, confirming the optimizer preserved pre-trained knowledge.This pipeline generates two distinct weight formats:
| Artifact | Typical Size | Description | Primary Location |
|---|---|---|---|
| LoRA Adapter Checkpoint | ~50 MB | Low-rank weight update matrices ($\Delta W$). | Hugging Face Adapter Repositories |
| 16-Bit Merged Model | ~5.2 GB | Full standalone base model with LoRA baked in ($W_{\text{base}} + \Delta W$). | Hugging Face Model Hub / Local Cache |
All trained adapters and the final 16-bit merged model are permanently hosted on the Hugging Face Model Hub:
https://huggingface.co/orangefabercastell/gemma-2-2b-it-pi-mono-adapter-lr1e4-r16-len2khttps://huggingface.co/orangefabercastell/gemma-2-2b-it-pi-mono-sftBecause weights are stored on Hugging Face, ephemeral cloud sessions (such as Kaggle or Google Colab) can be terminated immediately after upload without data loss.
To advance this system toward competitive software engineering agent performance, the following upgrades are planned:
Qwen 2.5 Coder 7B or Gemma 2 9B):
Qwen 2.5 Coder 7B achieves approximately 82% on HumanEval out-of-the-box, providing a substantially stronger reasoning foundation.pi-mono dataset contains over 20,000 developer turns across complex multi-turn debugging sessions.include_reasoning=True):
<thinking> tokens provides the model with test-time planning compute. Models trained with Chain-of-Thought reasoning typically gain +10% to +18% on code synthesis benchmarks.the-stack or python_code_instructions_18k (30%) prevents domain overfitting and improves algorithmic problem solving.import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "orangefabercastell/gemma-2-2b-it-pi-mono-sft"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.float16,
device_map="auto"
)
messages = [
{
"role": "user",
"content": "Find where the database port is configured in src/server.py and update it to 5432 using workspace tools."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False)
print(response)
unsloth/gemma-2-2b-it-bnb-4bit pre-quantized weights)r=16, alpha=32, dropout=0.05)q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projpaged_adamw_8bit with Cosine Warmup Decaysft-on-trace-v1)