Fine-Tuning a Local 14B Model on Coral’s Agent Tools A QLoRA fine-tune of Qwen2.5-Coder-14B-Instruct on 1,722 locally generated synthetic tool-call traces raised the model's clean structured tool-call rate on held-out Coral agent tasks from 0% to 90%, with 30 of 30 runs producing parsed tool calls and 0% forbidden commands, according to the Coral blog. The base 14B model scored 0.00 out of 2.00 and made no structured tool calls across 30 runs, while the larger qwen3-coder:30b Mixture-of-Experts model reached only about 35% clean (33% to 37%, mean 0.73/2.00) and in 23 of 30 runs invoked non-existent tools such as `coral-board post`. The merged model was exported to GGUF at Q4_K_M (8.37 GiB) for Ollama and averaged 7.9 seconds per task, but on a separate 10-task memorization check using subcommands never seen in training it reached only 40% clean (mean 1.10/2.00), with template habits overriding generalization. ← Back to Blog https://coralhub.dev/blog/ Fine-Tuning a Local 14B Model on Coral’s Agent Tools In our earlier trial of local Ollama models running inside Coral via pi https://coralhub.dev/blog/local-model-ollama-pi-coral-agent.html , the dense qwen2.5-coder:14b model could not drive Coral's agent tools at all: when asked to edit files, run tests, and post to the team board, it printed raw JSON or markdown blocks into chat and made zero structured tool calls 0% clean across 30 held-out runs . Even the larger qwen3-coder:30b Mixture-of-Experts model only reached about 35% clean 33% to 37% across our base benchmark runs , frequently trying to invoke a non-existent tool literally named coral-board post or coral-agent instead of running those commands through pi 's bash tool. That raised an obvious follow-up question: is a 14B open-weights model simply too small to operate a multi-agent CLI toolkit, or does it just need a targeted fine-tune on structured tool calls and Coral's command rules? To find out, we built an automated Coral-tools harness and ran a small QLoRA fine-tune of qwen2.5-coder:14b Qwen2.5-Coder-14B-Instruct on 1,722 locally generated, synthetic tool-call traces , exported the merged model back to GGUF Q4 K M , 8.37 GiB for Ollama, and tested it inside pi against a throwaway Coral server. On the held-out benchmark, the fine-tuned 14B model jumped from 0% clean to 90% clean mean score 0.00 → 1.90 out of 2.00 , with 30 of 30 runs making valid structured tool calls and 0% forbidden commands . And on a separate 10-task memorization check built from subcommands and flags never seen in training, it reached 40% clean —revealing both genuine generalization and the honest limits of training on mostly scripted templates. The Short Version 1. Held-out Coral tool tasks went from 0% to 90% clean : - Base qwen2.5-coder:14b : 0% clean mean score 0.00 / 2.00 , 0 of 30 runs with a parsed tool call. Every turn ended with finish reason: stop and plain text. - Base qwen3-coder:30b : ~35% clean 33% / 37% across base runs, mean score 0.73 / 2.00 . In 23 of 30 runs it called tools that do not exist coral-board read , coral-board task list , coral-board post , coral-agent skills list instead of calling bash . - Fine-tuned qwen2.5-coder:14b Q4 K M in Ollama : 90% clean mean score 1.90 / 2.00 , 30 of 30 runs with a parsed tool call, 0% forbidden commands , averaging 7.9 seconds per task . It beat the base 30B model on these tasks at roughly half the disk footprint 8.37 GiB . 2. A small QLoRA run on synthetic data was enough : - We trained on 1,722 synthetic traces across 16 task families 1,712 scripted traces validated against a throwaway Coral server, plus 10 traces from qwen3-coder:30b , covering 14.6% of an epoch 62 steps, 248 rows before merging and quantizing to Q4 K M . - Zero real user transcripts or developer workspaces were touched: every trace was generated and verified in an isolated sandbox under an invented account sandbox-dev . 3. We trained on 4. Honest limits—where a 14.6%-epoch scripted fine-tune breaks : - On 10 tasks unlike the training templates untrained subcommands like task show , task reassign , complete --outcome failed , post --file , read --id , plus plain shell tasks , the fine-tuned 14B model scored 40% clean mean 1.10 / 2.00 , up from 0% on base 14B . - It generalized cleanly to several untrained commands and even recovered after guessing task info or task read , but when an unfamiliar prompt resembled one of its 16 trained patterns, template habits took over—wrapping $ cat notes.txt inside a single-quoted heredoc <<'EOF' or running coral-agent artifact upload before creating the file. 5. On 10 tasks How We Scored Coral Tool Use Not Chat Text A coding agent inside Coral does not get credit for describing a command in Markdown. It has to call pi 's bash tool, pass valid CLI flags to coral-board or coral-agent , change the actual server state on a live Coral instance, and obey team guardrails. The 10 held-out task families t01 – t10 Each benchmark run launched an isolated Coral server with a seeded board state and gave pi 0.73.1 + Ollama 0.40.18 , num ctx 32768 , temperature 0 , seed 572 a one-sentence instruction: | Task | Family | What the agent must do | |---|---|---| | t01 | read reply | Read unread board messages and post a reply | | t02 | backticks | Post a message containing backticks requires a quoted heredoc or escaped backticks | | t03 | task add | Create and assign a task as an orchestrator coral-board task add | | t04 | claim | Claim an assigned task coral-board task claim | | t05 | complete | Mark an active task complete coral-board task complete | | t06 | submit review | Submit a task for review coral-board task submit-review | | t07 | search | Search the board/tasks coral-board search and post what it found | | t08 | artifact | Upload a file coral-agent artifact upload and post the returned coral://artifacts/... link | | t09 | docs | Read Coral's built-in agent docs coral-agent docs and post the answer | | t10 | task post | Post a reply directly on a task thread coral-board post --task | The guard shell and 0 / 1 / 2 state checker Instead of grading model prose, we pointed pi 's shellPath at a guard executable that logged every command, enforced Coral's command rules, and scored the resulting server state: - Forbidden actions immediate score 0 and run halted : - Running coral-board join Coral already subscribes launched agents automatically - Posting to @all - Touching a real .coral directory or default ports - Running process-killing sweeps pkill , killall , taskkill /im - Putting raw unescaped backticks inside a double-quoted coral-board post "..." argument which the shell would evaluate as command substitution - Destructive deletes, git push , or curl to non-loopback hosts - Running - State-based scoring 0 , 1 , or 2 : - 0 : Wrong board/task state, no structured tool call executed, or a forbidden command. - 1 : The target state was reached, but a Coral command exited non-zero along the way, a required command was skipped, or extra posts/tasks were created. - 2 Clean : The exact board, task, or artifact state was produced with clean commands and zero errors. We self-tested the checker against 22 hand-written cases 22 of 22 scored as expected: every right answer scored 2 , every wrong answer scored 0 , and two noisy answers scored 1 . Why the Base Models Struggled 0% on 14B, ~35% on 30B Before training anything, we ran 30 held-out evaluations 10 tasks × 3 repetitions on both base models: | Base Model | Runs | Mean Score 0–2 | Clean Pass 2 | Partial 1 | Fail 0 | Forbidden Rate | Tool Calls / Task | Mean Time / Task | |---|---|---|---|---|---|---|---|---| | qwen2.5-coder:14b base | 30 | 0.00 | 0% | 0% | 100% | 0% | 0.0 | 9.0 s | | qwen3-coder:30b base | 30 | 0.73 | 33% 37% on the second base run | 7% | 60% | 0% | 4.8 | 47.0 s | Two distinct failure modes showed up: 1. qwen2.5-coder:14b never emitted a structured tool call : In all 30 runs, it wrote fenced bash blocks in plain text often with the right coral-board command and stopped with finish reason: stop . Because no tool call was emitted, pi never ran a command. 2. qwen3-coder:30b confused CLI binaries with tool names : In 23 of 30 runs , the 30B model emitted structured tool calls, but instead of calling the bash tool with command: "coral-board ..." , it invented tool names matching the CLI subcommands: - coral-board read 12 times - coral-board task list 11 times - coral-board post 11 times - coral-agent skills list 3 times When pi replied "tool not found" , the 30B model either gave up "I don't have access to coral-board" , wandered through the repository with git and find , or looped on empty coral-agent tool calls until hitting the 300-second timeout. It succeeded reliably on plain posting t02 scored 2, 2, 2 , but scored 0 across task add , task claim , task submit-review , search , and docs . The Fix: Synthetic Traces, QLoRA, and GGUF Export to Ollama To teach qwen2.5-coder:14b how pi and Coral actually work—that every CLI command runs through bash , which flags each subcommand expects, and when to use a quoted heredoc—we built a strictly synthetic dataset: - 1,722 synthetic training rows across 16 task families : - Zero real user data : Every trace was generated against an isolated sandbox server running under an invented user USERNAME=sandbox-dev , COMPUTERNAME=SANDBOX-PC , with environment checks confirming no real home paths, account names, or hostnames existed in the environment or traces. - Split before generation : Held-out tasks t01 – t10 used different wording and different values from the training templates, and we verified that only trace runs scoring a clean 2 entered the training set. - Composition : 1,712 rows came from scripted trace templates across the 16 families, plus 10 verified traces from qwen3-coder:30b . - Training & GGUF export : - We trained a QLoRA adapter on Qwen2.5-Coder-14B-Instruct for 62 steps 248 rows, 14.6% of an epoch . - We merged the adapter into the bf16 base weights on CPU 77 seconds; layer-0 q proj LoRA delta norm 0.3755 , converted the merged model to an f16 GGUF 29.5 GB with llama.cpp 's convert hf to gguf.py , and quantized it to Q4 K M 8.37 GiB , 4.87 bits/weight in 81 seconds with llama-quantize . - Finally, we registered the quantized GGUF in Ollama ollama create using the exact same Modelfile tool template and parameters temperature 0 , seed 572 , num ctx 32768 as the base 14B evaluation—changing only the FROM line. - We trained a QLoRA adapter on Held-Out Benchmark Results: 0% → 90% Clean We ran the exact same 30 held-out evaluations t01 – t10 × 3 repetitions with pi 's full agent prompt against the exported Q4 K M model: | Model | Runs | Mean Score 0–2 | Clean % 2 | Forbidden % | Runs with a Parsed Tool Call | Mean Time / Task | Prompt Tokens / Task | Output Tokens / Task | |---|---|---|---|---|---|---|---|---| | 14B base same template | 30 | 0.00 | 0% | 0% | 0 of 30 | 9.0 s | 6,556 | 47 | | 30B base earlier runs | 30 | 0.73 | 33% / 37% | 0% | — | 47.0 s | 39,702 | 399 | | 14B fine-tuned Q4 K M | 30 | 1.90 | 90% | 0% | 30 of 30 | 7.9 s | 15,228 | 67 | Per-task breakdown t01 – t10 | Task | Family | 14B Base | 14B Fine-Tuned Q4 K M | |---|---|---|---| | t01 read + post | read reply | 0 / 3 | 3 / 3 | | t02 post with backticks | backticks | 0 / 3 | 3 / 3 | | t03 task add orchestrator | task add | 0 / 3 | 3 / 3 | | t04 task claim | claim | 0 / 3 | 3 / 3 | | t05 task complete | complete | 0 / 3 | 3 / 3 | | t06 task submit-review | submit review | 0 / 3 | 0 / 3 scored 1, 1, 1 | | t07 search | search | 0 / 3 | 3 / 3 | | t08 artifact upload | artifact | 0 / 3 | 3 / 3 | | t09 agent docs | docs | 0 / 3 | 3 / 3 | | t10 post on a task | task post | 0 / 3 | 3 / 3 | Why did t06 task submit-review score 1 instead of 2 in all three runs? - Coral's coral-board task submit-review requires either a test-result line in --message or an explicit --no-tests "