Gemma 4 E4B NetOps (FRR troubleshooting agent)
English · Português
A fine-tune of Gemma 4 E4B-it that troubleshoots OSPF and BGP faults in FRRouting (FRR 10.4) networks as a tool-calling agent. It reads the network with read-only tools, then either proposes one minimal fix with rollback lines, reports that the network is healthy, or escalates. It never applies a change itself: every proposal goes through an approval step in the harness.
Files in this repo:
| File | What it is |
|---|---|
model.safetensors + configs | merged BF16 model (transformers / vLLM) |
lora/ | the LoRA adapter (r=32, alpha=32) on top of google/gemma-4-E4B-it |
gguf/gemma-4-e4b-netops-r5-Q8_0.gguf, gguf/gemma-4-e4b-netops-r5-Q5_K_M.gguf | llama.cpp builds (not scored, see Limitations) |
Results
Agentic episodes on containerlab FRR topologies that never appear in training. A fault is injected, the agent gets a ticket,
and the episode counts as a success only when the verifier finds the network restored, no collateral change, no malformed
call, and the right ending (propose_fix for a fault, report_no_fault for a healthy network). Temperature 0.3, at most
16 steps. Base = the same Gemma 4 E4B-it with the same tools, prompt and docs search. Intervals are 95% paired bootstrap CIs.
Lockbox (new seeds 251/252, opened once after the final model was chosen, one run per model):
| Metric (lockbox) | Base | Fine-tuned |
|---|---|---|
| Episode success (75 scenarios) | 48.0% | 65.3% (gain +17.3 pts, CI [+2.7, +32.0]) |
| Fault episodes fixed | 39.0% | 66.1% |
| Healthy networks handled correctly (lower for the fine-tune) | 81.2% | 62.5% |
| Episodes with a collateral change (lower is better) | 16.0% | 2.7% |
| Destructive lines | 1 episode | 0 |
| Held-out fault types (32 scenarios) | 3.1% | 25.0% (gain +21.9 pts, CI [+9.4, +37.5]) |
| Held-out episodes with a destructive line | 0 | 2 |
The lockbox confirms the gain on faults and the drop in collateral changes, and makes the healthy-network weakness larger than on the development set: 6 of 16 healthy networks ended with the agent still auditing at the 16-step limit (the base got 13 of 16 right, but it also proposed a change on one healthy network). Give the agent a larger step budget, or treat "no decision after N steps" as "no fault found".
Development set (seed 201, 75 scenarios, 3 runs of the fine-tune pooled; the model was chosen on this set):
| Metric | Base | Fine-tuned |
|---|---|---|
| Episode success | 50.7% | 71.6% (gain +20.9 pts, CI [+9.3, +32.0]) |
| Fault episodes fixed | 47.7% | 71.8% |
| Healthy networks handled correctly | 70.0% | 70.0% |
| Episodes with a collateral change (lower is better) | 9.3% | 1.3% |
| Held-out fault types (seed 202, never trained on) | 6.2% | 33.3% (gain +27.1 pts, CI [+9.4, +43.8]) |
| MMLU-Pro (100 questions) | 31% | 39% |
| ToolACE exact call (60) | 55.0% | 56.7% |
Declared shortfalls. The project's "usable" bar asked for healthy networks ≥ 80% and zero destructive lines. The model misses both: healthy networks stay at 70% on development (same as the base) and 62.5% on the lockbox (base 81.2%; every miss is the agent still auditing when the 16-step budget runs out, not a wrong change), and 1 of 225 development episodes proposed a destructive line (removing and re-adding a BGP neighbor). On held-out fault types, 3 of 96 episodes proposed a destructive line. Keep the human approval step.
How it was made
- Teacher: DeepSeek V4.1 Flash (via Ollama Cloud) ran the same agent loop on 8 training topologies. Only verified trajectories were kept: the fault fixed, the ping matrix green, no collateral diff, no destructive line.
- Training data (1,314 rows): 874 fault episodes, 200 healthy-network episodes (deep audits that end in
report_no_faultwithin 11 steps), and 240 general rows to limit forgetting: 120 from UltraChat 200k (MIT; its card says the dialogues were generated by ChatGPT) and 120 from ToolACE (Apache-2.0; the generator model is not named). - Training: LoRA r=32, alpha=32, no dropout, on the language model's attention and MLP projections; lr 1e-4, 2 epochs, loss on assistant turns only. Merged into BF16 afterwards.
- Rounds: 7 rounds, one variable each, all scored against the base. Rounds 6 (on-policy successes) and 7 (teaching
escalateon customer-managed routers) did not beat round 5 (r7 vs r5 on dev: -1.8 pts, CI [-9.3, +5.3]), so round 5 is the release. - Anti-overfit: evaluation topologies, held-out fault families and the lockbox seeds were never trained on; splits are by scenario, node names, ASNs and addresses are randomized per scenario.
Using it
The model expects the agent harness it was trained with: an OpenAI-style tool list with show_interfaces, show_ip_route,
show_ospf_neighbors, show_ospf_interface, show_bgp_summary, show_bgp_neighbor, get_config, ping, traceroute,
search_docs, propose_fix, report_no_fault and escalate, and this system prompt:
You are a network troubleshooting agent for an FRR (FRRouting 10.4) lab network.
Find the root cause of the ticket with the read-only tools, then either propose one minimal fix with propose_fix, or finish with report_no_fault (the network is healthy) or escalate (not enough evidence, or the cause is outside this network).
Rules:
- Gather evidence before proposing. Compare both ends of a broken adjacency or session.
- Change only what the evidence shows is wrong. Restore the intended configuration; never remove a working feature to make a symptom go away.
- One router per proposal. Always include rollback lines.
- Never invent command output. If a check passes, say so.
- When the fix is verified, reply with a short final report: root cause, change made, verification.
vLLM (v0.32.0 was used for every evaluation):
vllm serve walissoncasonatto/gemma-4-e4b-netops --max-model-len 32768 \
--enable-auto-tool-choice --tool-call-parser gemma4
Limitations
- Trained and tested only on FRR 10.4 lab topologies of 4 to 10 routers with OSPF and BGP faults; it has not seen real production networks, other vendors' CLIs, or faults outside those families.
- It rarely escalates; when it cannot find a cause it tends to keep auditing or to guess on BGP
networkstatements. - The GGUF builds were converted from the scored BF16 model; both load and generate in llama.cpp (use
--jinjafor the chat template), but they were not scored. - The evaluation is small (75 development, 32 held-out, 75+32 lockbox scenarios); one run of the same model moves by up to 7 points, which is why development numbers pool three runs.
Português
Fine-tune do Gemma 4 E4B-it para diagnosticar falhas de OSPF e BGP em redes FRRouting (FRR 10.4) como agente com ferramentas. Ele lê a rede com ferramentas somente leitura e depois propõe uma correção mínima com linhas de rollback, informa que a rede está saudável ou escala. Ele nunca aplica nada sozinho: toda proposta passa por uma aprovação no harness.
Resultados no lockbox (seeds novas 251/252, aberto uma vez depois da escolha do modelo, uma rodada por modelo):
| Métrica (lockbox) | Base | Fine-tune |
|---|---|---|
| Sucesso por episódio (75 cenários) | 48,0% | 65,3% (+17,3 pts, IC [+2,7, +32,0]) |
| Falhas corrigidas | 39,0% | 66,1% |
| Redes saudáveis tratadas corretamente (pior no fine-tune) | 81,2% | 62,5% |
| Episódios com mudança colateral (menor é melhor) | 16,0% | 2,7% |
| Tipos de falha nunca treinados (32 cenários) | 3,1% | 25,0% (+21,9 pts, IC [+9,4, +37,5]) |
O lockbox confirma o ganho nas falhas e a queda das mudanças colaterais, e mostra a fraqueza em redes saudáveis maior que no desenvolvimento: em 6 de 16 o agente ainda auditava no limite de 16 passos. Dê mais passos ao agente, ou trate "sem decisão depois de N passos" como "nenhuma falha encontrada".
No conjunto de desenvolvimento (75 cenários, 3 rodadas): sucesso 50,7% (base) → 71,6% (+20,9 pts, IC [+9,3, +32,0]); mudanças colaterais 9,3% → 1,3%; tipos de falha nunca treinados 6,2% → 33,3%; MMLU-Pro 31 → 39; ToolACE 55,0% → 56,7%.
Limitações declaradas. A meta do projeto pedia redes saudáveis ≥ 80% e nenhuma linha destrutiva. O modelo não atinge as duas: fica em 70% nas redes saudáveis no desenvolvimento (igual à base) e 62,5% no lockbox (base 81,2%; em todos os erros o agente ainda está auditando quando acabam os 16 passos) e 1 de 225 episódios propôs uma linha destrutiva (3 de 96 nos tipos de falha nunca treinados). Mantenha a aprovação humana.
Como foi feito: professor DeepSeek V4.1 Flash rodando o mesmo agente em 8 topologias de treino, só trajetórias verificadas; 1.314 linhas (874 falhas, 200 redes saudáveis, 240 gerais de UltraChat, gerado pelo ChatGPT segundo o card dele, e ToolACE, que não informa o gerador); LoRA r=32, lr 1e-4, 2 épocas. Foram 7 rodadas com uma variável por vez; as rodadas 6 e 7 não superaram a 5, que é a publicada. Uso: o mesmo prompt de sistema e as mesmas 13 ferramentas da seção "Using it".
Limites: só testado em laboratórios FRR 10.4 de 4 a 10 roteadores; raramente escala; os GGUF carregam e geram no llama.cpp (use --jinja), mas não foram avaliados.