CoolFace
Modelpublic

empulse/KiCAD-MCP-Qwen3.5-4B-GGUF

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
9likes398downloads
Model Card

KiCAD-MCP-Qwen3.5-4B

A fine-tuned Qwen3.5-4B model specialized for KiCAD PCB design assistance via the Model Context Protocol (MCP). Trained to select and invoke the correct tools from a 159-tool KiCAD MCP server covering schematic capture, PCB layout, DRC, export, library management, and more.

Capabilities

  • —Tool Selection: Correctly identifies which of 159 KiCAD MCP tools to call based on natural language requests
  • —Parameter Extraction: Extracts component references, coordinates, net names, and other parameters from user requests
  • —Multi-Step Reasoning: Plans sequences of tool calls for complex PCB design tasks
  • —Error Handling: Interprets tool error responses and suggests fixes
  • —Refusal: Declines off-topic or destructive requests appropriately
  • —Domain Knowledge: Understands PCB design concepts (DRC rules, clearances, layer stacks, component placement)

Tool Categories

The model was trained on a KiCAD MCP server with tools across these categories:

CategoryToolsExamples
Project5createproject, openproject, save_project
Schematic22+addschematiccomponent, addwire, connecttonet, annotateschematic
Board12setboardsize, addlayer, addboardoutline, getboard2dview
Component17placecomponent, movecomponent, rotatecomponent, findcomponent
DRC8rundrc, setdesignrules, getdrcviolations, checkclearance
Export8exportgerber, exportpdf, exportbom, export3d
Routing14routetrace, addvia, addcopperpour, routedifferentialpair
Library8searchfootprints, getfootprintinfo, listlibraries
And more...Symbol creation, JLCPCB integration, freerouting, UI management

See tool_schema.json for the complete 159-tool schema with descriptions and parameter definitions.

Usage

With llama.cpp

bash
# Download the model
huggingface-cli download empulse/KiCAD-MCP-Qwen3.5-4B-GGUF --local-dir ./model

# Run with llama-server (requires Qwen3.5 support — llama.cpp build from Feb 2026+)
llama-server \
  -m model/kicad-mcp-4b-sft-v3-bf16.gguf \
  -ngl 99 \
  --cache-type-k bf16 --cache-type-v bf16 \
  -c 4096 \
  --port 8080

# Query via OpenAI-compatible API
curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "system", "content": "You are a KiCAD PCB design assistant with MCP tools."},
      {"role": "user", "content": "Run a DRC check on the board"}
    ],
    "temperature": 0.1
  }'

Important Notes

  • —GGUF format: bf16 (full precision, 8.4GB). Quantize with llama-quantize if needed.
  • —KV cache must be bf16: Use --cache-type-k bf16 --cache-type-v bf16 with llama.cpp. The Gated Delta Network architecture produces incorrect results with f16 cache.
  • —Qwen3.5 support required: llama.cpp builds from February 2026+ include Qwen3.5 GDN support (PR #19435).
  • —Thinking mode: The model uses <think>...</think> blocks for reasoning by default. Use /nothink prefix to disable.

Training

  • —Base model: Qwen/Qwen3.5-4B
  • —Architecture: Gated Delta Network (GDN) — hybrid attention, not standard transformer
  • —Method: LoRA (rank 32, alpha 64) with two-phase training
  • —Phase 1: Continual Pre-Training on domain-specific corpora (MCP protocol, KiCAD documentation, PCB design knowledge)
  • —Phase 2: Supervised Fine-Tuning on tool-calling examples
  • —Framework: ms-swift 4.0.2 with DeepSpeed ZeRO-2
  • —Hardware: 2x NVIDIA RTX 3090 (48GB total)
  • —Precision: bfloat16 throughout (required for GDN architecture)

Evaluation

CategoryScore
Tool Selection (10 tests)10/10
No-Tool Response (2 tests)2/2
Refusal (1 test)1/1
Domain Knowledge (1 test)1/1
Total14/14 (100%)

Limitations

  • —Trained primarily on a specific KiCAD MCP server implementation — tool names and schemas may differ from other servers
  • —4B parameter model — complex multi-step reasoning chains may be less reliable than larger models
  • —Domain knowledge is focused on KiCAD v10 and common PCB design patterns
  • —Not trained for vision/image tasks despite Qwen3.5's multimodal capabilities

License

Apache 2.0