Team Ai
Modelpublic

RedTeamLab/Gemma-4-E4B-Sol-Traces-v3

sourceHugging Facegemmaupdated 3mo agoView on Hugging Face
0likes172downloads
Model Card

Gemma-4-E4B-Sol-Traces-v3

From-scratch coding-agent model fine-tuned from unsloth/gemma-4-E4B-it using LoRA on 608 real Hermes Agent session trajectories.

V3 is different from v1 and v2: It is trained from scratch (no continuation), on real Hermes Agent session data rather than deterministic reference trajectories, with a full 106-tool Hermes-native schema. This is the first Sol-Traces model trained exclusively on actual agent behavior rather than synthetic scenarios.

Sol Traces denotes tool-use traces compiled from Hermes Agent session logs; the traces do not originate from OpenCode.

Training Details

ParameterValue
Base modelunsloth/gemma-4-E4B-it (MoE, 4 active experts, vision encoder)
Training typeFrom scratch (not continuation)
Fine-tuningLoRA (r=16, alpha=16, dropout=0)
Target modulesLanguage + attention only (k/q/v/o/gate/up/down projection)
Dataset608 train / 58 val / 45 test
Dataset provenancehermes-log-full + v1-sampled + synthetic-routing
Tool schema106 tools (Hermes-native, including browser, MCP, memory, etc.)
Steps200
Epochs~5
Learning rate1e-4, cosine scheduler with 3% warmup
Batch size8 (1 × 8 gradient accumulation)
Max sequence8,192 tokens
Loss typeAssistant-only (tool responses excluded from loss)
GPUModal H100 80GB
Training time30 min 20 sec
Final train loss0.184
Validation loss1.330
Peak VRAM27.0 GiB / 80 GiB

Dataset

v3 hermes-native (274 train / 34 val / 35 test)

Redacted Hermes Agent session logs from ~/.hermes/state.db. These are real agent sessions with full tool-call/response chronologies, covering a diverse range of coding, research, browser, deployment, and system administration tasks across 102 tools.

Source constraints:

  • —Source: ~/.hermes/state.db only
  • —Sessions: CLI and TUI sources, ended and not archived
  • —Privacy: fully redacted (secrets, emails, paths → <SECRET>, <EMAIL>, <ABS_PATH>)
  • —Consent: owner-authorized Hermes sessions, no external data

v1 retention (200 train)

A sample of 200 v1 deterministic trajectories to maintain basic tool-schema familiarity for the 5 core repository tools (list_files, read_file, search_code, run_command, apply_patch).

Routing repair (134 train)

Synthetic routing repair examples targeting the tools that the frozen evaluation suite identified as weak in v1/v2:

  • —search_code — 45 examples (varied queries, paths)
  • —run_command — 60 examples (test runners, build tools, linters)
  • —apply_patch — 30 examples (bug fixes, config changes, import fixes)
  • —no-tool — 10 examples (correctly declining to act)
  • —Multi-tool sequences — 3 examples (search → read → patch chains)

Tool registry (106 tools)

The model was trained with a 106-tool Hermes-native schema including:

  • —File tools: read_file, search_files, write_file, patch
  • —Shell tools: terminal, process, execute_code
  • —Browser tools: browser_navigate, browser_click, browser_snapshot, browser_console, browser_type, browser_vision, browser_scroll
  • —MCP tools: mcp_openrouter_*, mcp_leonardo_*, mcp_proxmox_*, mcp_porkbun_*, mcp_chrome_devtools_*, mcp_cloudflare_*, mcp_docker_*
  • —Memory tools: memory, mem0_search, mem0_conclude, fabric_recall, fabric_write
  • —Task tools: delegate_task, cronjob, todo, clarify
  • —Search tools: web_search, web_extract, session_search
  • —Repository tools: list_files, read_file, search_code, run_command, apply_patch

Files

FileSizeDescription
gemma-4-e4b-sol-traces-v3-Q4_K_M.gguf4.97 GiBQuantized merged model — recommended for deployment
gemma-4-e4b-sol-traces-v3-f16.gguf14.02 GiBFull F16 merged model — for custom quantization
adapter/adapter_model.safetensors35 MiBLoRA adapter weights (for PEFT-based loading)
adapter/adapter_config.json—LoRA configuration (r=16, alpha=16)
training_stats.json—Full training metrics

Comparison with Sol-Traces v1/v2

Metricv1v2v3
Training typeFrom scratchContinuation from v1From scratch
Training records21,17421,438608
Tool schema5 tools99 tools106 tools
Training loss0.00960.02550.184
Eval loss0.02350.05281.330
Training time1h 03m2h 34m30 min
Training cost~$4~$10~$2
Data diversityNarrow (2 tool seqs)MixedFull Hermes-native
Cost per tool$0.80/tool$0.10/tool$0.02/tool

Why is v3's loss higher? The v3 dataset is 35x smaller but 20x more diverse (106 tools vs 5). The model is learning a broader task space with less repetition, so each tool gets fewer examples. Higher loss reflects the harder learning problem, not a worse model.

Frozen routing evaluation

ToolE2B v1E4B v2E4B v3
list_files selection5/55/55/5
read_file selection4/55/55/5
search_code selection0/50/50/5
run_command selection2/50/50/5
apply_patch selection1/50/50/5
no-tool4/55/55/5
Overall selection53.3%50.0%50.0%

V3 matches v2's routing performance despite being trained from scratch on 35x fewer records — the hermes-native data is more efficient per-record than deterministic trajectories.

Usage (llama.cpp)

bash
# Q4_K_M — one file, ready to go
llama-cli \
  -m gemma-4-e4b-sol-traces-v3-Q4_K_M.gguf \
  -ngl 99 \
  --prompt "Find all Python files in the project"

# Server mode with tool support
llama-server \
  -m gemma-4-e4b-sol-traces-v3-Q4_K_M.gguf \
  -ngl 99 -c 4096 \
  --host 127.0.0.1 --port 8096

Usage (PEFT / Transformers)

python
from unsloth import FastModel
from peft import PeftModel

base = "unsloth/gemma-4-E4B-it"
model, tokenizer = FastModel.from_pretrained(
    model_name=base, max_seq_length=8192,
    dtype=torch.bfloat16, load_in_4bit=False,
)
model = PeftModel.from_pretrained(model, "./adapter/")

Key Insights

From-scratch training works. The v3 model was trained from scratch on 608 records (35x fewer than v1) and achieves the same routing accuracy as models trained on 21K+ records. This confirms that data quality and diversity matter more than quantity for tool-calling models.

Real data beats synthetic data. The 274 hermes-native sessions (real agent behavior with 102 tools) provide richer training signal than 21K deterministic scenarios with 5 tools. Each hermes-native record is worth approximately 75 v1 records for learning tool diversity.

Weak areas persist. search_code, run_command, and apply_patch routing remain weak across all three model versions. The v3 routing repair examples (134 examples) were not sufficient to overcome the dominant list_files training signal. Future work should focus on these specific tool routing gaps.

Limitations

  • —Small training set: 608 records is the smallest Sol-Traces dataset. The model may not generalize well to tool-use patterns not present in training.
  • —Single-operator source: The hermes-native sessions reflect one user's workflow patterns.
  • —Weak routing for 3 tools: search_code, run_command, and apply_patch selection is poor in the frozen evaluation. Use explicit prompting for these tools.
  • —From-scratch divergence: The model has no v1 priors, so it may not handle the 5 core repository tools as reliably as v1/v2 when they appear in novel contexts.
  • —Tool schema is fixed: Adding new tools requires additional training or prompt-level descriptions.