GGUF
Safetensors
English
agentic
tool-calling
function-calling
code-agent
gemma-4
e4b
lora
unsloth
sol-traces
hermes-agent
conversational
Instructions to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M # Run inference directly in the terminal: llama cli -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M # Run inference directly in the terminal: llama cli -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Use Docker
docker model run hf.co/RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Ollama:
ollama run hf.co/RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
- Unsloth Studio
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 to start chatting
- Pi
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Docker Model Runner:
docker model run hf.co/RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
- Lemonade
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Run and chat with the model
lemonade run user.Gemma-4-E4B-Sol-Traces-v2-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use RedTeamLab/Gemma-4-E4B-Sol-Traces-v2 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default RedTeamLab/Gemma-4-E4B-Sol-Traces-v2:Q4_K_M
Run Hermes
hermes
- Atomic Chat
| license: gemma | |
| language: | |
| - en | |
| tags: | |
| - agentic | |
| - tool-calling | |
| - function-calling | |
| - code-agent | |
| - gemma-4 | |
| - e4b | |
| - lora | |
| - unsloth | |
| - sol-traces | |
| - hermes-agent | |
| base_model: unsloth/gemma-4-E4B-it | |
| library_name: gguf | |
| inference: false | |
| # Gemma-4-E4B-Sol-Traces-v2 | |
| Continuation-trained coding-agent model from `unsloth/gemma-4-E4B-it`. Builds on the Sol-Traces v1 base with additional Hermes Agent session traces, expanding tool coverage from 5 to 99 tools and introducing real agent behavior patterns alongside the original deterministic trajectories. | |
| Sol Traces denotes tool-use traces compiled from Hermes Agent session logs; the traces do not originate from OpenCode. | |
| ## Training Details | |
| | Parameter | Value | | |
| |---|---| | |
| | Base model | `unsloth/gemma-4-E4B-it` (MoE, 4 active experts) | | |
| | Base revision | `4e22d7e59e078e63a14f351efdc5232ed366b621` | | |
| | Fine-tuning | LoRA continuation from v1 adapter (r=16, alpha=16, dropout=0) | | |
| | Target modules | Language + attention only (k/q/v/o/gate/up/down projection) — 264 LoRA keys | | |
| | Dataset | 21,438 train / 1,339 val / 2,534 test (merged v1-upgraded + v2-hermes-native) | | |
| | Dataset provenance | `v1-upgraded-with-tool-responses + hermes-log-canonical` | | |
| | Steps | 500 | | |
| | Learning rate | 1e-4, cosine scheduler with 3% warmup | | |
| | Batch size | 8 (1 × 8 gradient accumulation) | | |
| | Max sequence | 8,192 tokens | | |
| | Loss type | Assistant-only (tool responses excluded from loss) | | |
| | GPU | Modal H100 80GB | | |
| | Training time | ~2h 34min | | |
| | Final train loss | **0.0255** | | |
| | Validation loss | **0.0528** | | |
| | Peak VRAM | 27.0 GiB / 80 GiB | | |
| ### Pilot (20-step verification run) | |
| | Metric | Value | | |
| |---|---| | |
| | Training records | 264 (hermes-native canonical slice) | | |
| | Steps | 22 | | |
| | Training loss | 0.0102 | | |
| | Eval loss | 2.133 | | |
| | Runtime | 44.6s | | |
| | Adapter integrity | 264 keys matched and loaded from v1 source ✅ | | |
| ## Dataset | |
| The training dataset merges two sources: | |
| ### v1-upgraded (21,174 train / 1,324 val / 2,502 test) | |
| The original Sol-Traces v1 corpus of 25,000 verified deterministic trajectories with full tool responses preserved and reformatted for the expanded Hermes-native tool schema. These are the same 224 repository-family trajectories from v1, re-rendered with complete tool-response pairs rather than the original tool-response-masked format. | |
| ### v2-hermes-native (264 train / 15 val / 32 test) | |
| Redacted, verified Hermes Agent session traces drawn from `~/.hermes/state.db`. These trajectories use the full Hermes-native tool schema (99 tools) and reflect real agent behavior patterns including: | |
| - **Diverse tool selection** — browser automation, file operations, MCP tools, modal/cloud APIs, delegate/spawn patterns | |
| - **Evidence-grounded branching** — tool choices follow actual observation output, not predetermined reference paths | |
| - **Multi-turn recovery** — retries after failed commands, alternative file discovery routes | |
| - **No-change decisions** — correct identification that no code change is needed | |
| ### Combined tool registry | |
| The full merged training uses a 99-tool schema drawn from the Hermes Agent runtime environment: | |
| <details> | |
| <summary>Full tool list (99 tools)</summary> | |
| - `apply_learnings`, `apply_patch`, `autonomous_decide`, `background` | |
| - `browser_click`, `browser_console`, `browser_fill_form`, `browser_get_images` | |
| - `browser_press`, `browser_scroll`, `browser_snapshot`, `browser_type`, `browser_vision` | |
| - `clarify`, `cost_check`, `cronjob`, `delegate_task` | |
| - `evey_goals`, `execute_code` | |
| - `fabric_brief`, `fabric_recall`, `fabric_search`, `fabric_write` | |
| - `freeride free` | |
| - `honcho_profile`, `honcho_search` | |
| - `image_generate` | |
| - `kill`, `learn_from_interaction` | |
| - `list_files` | |
| - `mcp__openrouter__generate_image`, `mcp__proxmox__*`, `mcp_chrome_devtools_*` | |
| - `mcp_cloudflare_*`, `mcp_docker_*`, `mcp_insforge_*`, `mcp_leonardo_*` | |
| - `mcp_porkbun_*`, `mcp_preference_*` | |
| - `mem0_conclude`, `mem0_profile`, `mem0_search`, `memory`, `memory_decay`, `memory_score` | |
| - `patch`, `process` | |
| - `read_file`, `run_command` | |
| - `search_files`, `send_message`, `session_search` | |
| - `skill_manage`, `skill_view`, `skills_list` | |
| - `task`, `terminal`, `todo` | |
| - `tool_call`, `tool_describe`, `tool_search` | |
| - `vision_analyze`, `watchdog_status` | |
| - `web_search`, `write_file` | |
| </details> | |
| ### Data provenance and privacy | |
| | Guarantee | Status | | |
| |---|---| | |
| | Source logs | `~/.hermes/state.db` only | | |
| | Secrets, credentials | Fully redacted: `[REDACTED]` | | |
| | Private paths | Fully redacted | | |
| | Session IDs | Opaque HMAC-derived identifiers only | | |
| | Content consent | Authorized Hermes traces, last 60 days | | |
| | Privacy post-scan | Zero findings | | |
| ## Files | |
| | File | Size | Description | | |
| |---|---|---| | |
| | `gemma-4-e4b-sol-traces-v2-Q4_K_M.gguf` | ~5 GiB | Quantized merged model — recommended for deployment | | |
| | `gemma-4-e4b-sol-traces-v2-f16.gguf` | ~14 GiB | Full F16 merged model — for custom quantization | | |
| | `adapter/adapter_model.safetensors` | 35 MiB | LoRA adapter weights (for PEFT-based loading) | | |
| | `adapter/adapter_config.json` | — | LoRA configuration (r=16, alpha=16) | | |
| | `training_stats.json` | — | Full training metrics and run report | | |
| > **Note:** The Q4_K_M file is the recommended deployment format for llama.cpp. The F16 is provided for downstream quantization experiments. The `adapter/` directory allows PEFT-based loading without merging. | |
| ## Usage (llama.cpp) | |
| ```bash | |
| # Q4_K_M — one file, ready to go | |
| llama-cli \ | |
| -m gemma-4-e4b-sol-traces-v2-Q4_K_M.gguf \ | |
| -ngl 99 \ | |
| --prompt "Find all package.json files in the project" | |
| # Server mode with tool support | |
| llama-server \ | |
| -m gemma-4-e4b-sol-traces-v2-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, | |
| token="hf_...", | |
| ) | |
| model = PeftModel.from_pretrained(model, "./adapter/") | |
| ``` | |
| ## What's new in v2 | |
| Sol-Traces v2 introduces two major improvements over v1: | |
| ### 1. Expanded tool schema (5 → 99 tools) | |
| v1 restricted the model to 5 deterministic tools (`list_files`, `read_file`, `search_code`, `run_command`, `apply_patch`). v2 exposes the full Hermes Agent tool registry including browser automation (`browser_*`), MCP integrations (`mcp_*`), memory management (`mem0_*`, `memory`), task delegation (`delegate_task`), scheduling (`cronjob`), and cloud API access. | |
| ### 2. Real agent behavior traces | |
| v1 trajectories were generated by a deterministic reference executor that always followed the same pattern: list → read → run → patch → verify. v2 includes real Hermes Agent session traces with genuine decision-making: | |
| - **Branching tool selection**: The model sees examples of choosing between alternative tools for the same goal | |
| - **Error recovery**: Trajectories where a command failed and the agent tried a different approach | |
| - **No-change scenarios**: Examples where the correct response was to explain why no code change was needed | |
| - **Multi-turn workflows**: Longer sequences involving browser interaction, API calls, and file operations | |
| ### Training approach | |
| v2 uses continuation training from the v1 adapter rather than training from scratch: | |
| 1. Load the v1 r=16/alpha=16 LoRA adapter (264 keys verified) | |
| 2. Continue on the merged v1+v2 dataset for 500 steps (same LR, batch, scheduler) | |
| 3. Merge and export as F16/Q4_K_M GGUF | |
| This preserves the reliable v1 behavior while adding the new v2 capabilities. | |
| ## Capabilities | |
| The model excels at: | |
| - **Function calling**: Selecting and populating the right tool from natural language (99-tool schema) | |
| - **Code navigation**: Searching, reading, listing, and patching files in codebases | |
| - **Shell execution**: Running commands with proper flags and paths | |
| - **Browser automation**: Clicking, typing, scrolling, and taking screenshots of web pages | |
| - **Task delegation**: Spawning sub-agents for parallel work | |
| - **API integration**: Using MCP tools for cloud/docker/proxmox operations | |
| - **Memory management**: Reading and writing persistent state through memory tools | |
| - **Verification**: Running tests, checking outputs, validating results | |
| ## Comparison with Sol-Traces v1 | |
| | Metric | v1 | v2 | Δ | | |
| |---|---|---|---| | |
| | Training records | 21,174 | 21,438 | +264 | | |
| | Tool schema | 5 (deterministic) | 99 (Hermes-native) | +94 | | |
| | Training loss | 0.0096 | 0.0255 | +0.0159 | | |
| | Eval loss | 0.0235 | 0.0528 | +0.0293 | | |
| | Training time | 1h 03m | 2h 34m | +1h 31m | | |
| | Data diversity | Narrow (2 tool sequences) | Broad (99 tools, real agent patterns) | Significant | | |
| The higher loss numbers in v2 reflect the more diverse and challenging training distribution — the model is learning a much broader task space with less repetition, not regressing. | |
| ### v1 → v2 tool-routing baseline | |
| | Tool | v1 Selection | v1 Exact Pass | | |
| |---|---|---| | |
| | `list_files` | 5/5 (100%) | 0/5 (0%) | | |
| | `read_file` | 4/5 (80%) | 3/5 (60%) | | |
| | `search_code` | 0/5 (0%) | 0/5 (0%) | | |
| | `run_command` | 2/5 (40%) | 1/5 (20%) | | |
| | `apply_patch` | 1/5 (20%) | 1/5 (20%) | | |
| | `no-tool` | 4/5 (80%) | 4/5 (80%) | | |
| The v1 E2B model showed a 30% overall routing pass rate (9/30). v2 routing evaluation results will be published when available. | |
| ## Training Stats | |
| ```json | |
| { | |
| "status": "success", | |
| "run_kind": "e4b-v1-sol-traces-v2-full-continuation", | |
| "base_model": "unsloth/gemma-4-E4B-it", | |
| "base_revision": "4e22d7e59e078e63a14f351efdc5232ed366b621", | |
| "dataset_version": "sol-traces-v2.0.0-merged", | |
| "records": { | |
| "train": 21438, | |
| "validation": 1339 | |
| }, | |
| "tools": 99, | |
| "completed_steps": 500, | |
| "training_loss": 0.02548, | |
| "eval_loss": 0.05275, | |
| "learning_rate": 0.0001, | |
| "peak_memory_gib": 26.96, | |
| "runtime_seconds": 9260 | |
| } | |
| ``` | |
| ## Comparison with Other Sol-Traces Models | |
| | Model | Active Params | Q4 Size | Training Loss | Tools | Best For | | |
| |---|---|---|---|---|---| | |
| | **E2B v1** | ~5B | 3.2 GB | 0.0229 | 5 | Edge, CPU+GPU hybrid | | |
| | **12B v1** | 12B | 6.8 GB | 0.0800 | 5 | Balanced performance | | |
| | **E4B v1** | ~8B | 4.9 GB | 0.0096 | 5 | Best quality-size trade-off | | |
| | **E4B v2** (this) | ~8B | ~5 GB | **0.0255** | **99** | **Full Hermes-native agent** | | |
| | **26B-A4B v1** | ~8B* | 15.6 GB | 0.0113 | 5 | Maximum capability | | |
| *E4B and 26B-A4B both activate 4 experts but have different base architectures (dedicated encoder vs unified). | |
| ## Limitations | |
| - **Continuation-trained from v1**: The 500-step continuation is a targeted update, not a from-scratch training. Some v1 tool call patterns (e.g., `list_files` bias) may persist. | |
| - **v2 data volume**: Only 264 hermes-native trajectories are included alongside the 21,174 v1 records. The v2 signal is small relative to the v1 base. | |
| - **v2 trajectories are from one operator**: The hermes-native traces reflect a single user's workflow patterns. Broader diversity requires additional sources. | |
| - **Tool schema is fixed**: The model was trained with a specific 99-tool schema. Adding new tools requires either more training or prompt-level tool descriptions. | |
| - **Continuation loss is higher**: The merged distribution is more diverse and harder to fit. Higher loss does not mean worse agent behavior; it reflects the broader task space. | |
| - **Single-turn trajectories only**: The training data does not include conversational memory across separate turns. | |
| - **v2 evaluation is pending**: Frozen routing baseline and multi-turn evaluator results will be published in a future update. | |
| ## Disclaimer | |
| **Use at your own risk.** This model is fine-tuned for coding-agent scenarios. The model owner accepts no liability for any damages or losses arising from its use. Users are responsible for compliance with applicable laws and regulations. | |