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:
| Category | Tools | Examples |
|---|---|---|
| Project | 5 | create_project, open_project, save_project |
| Schematic | 22+ | add_schematic_component, add_wire, connect_to_net, annotate_schematic |
| Board | 12 | set_board_size, add_layer, add_board_outline, get_board_2d_view |
| Component | 17 | place_component, move_component, rotate_component, find_component |
| DRC | 8 | run_drc, set_design_rules, get_drc_violations, check_clearance |
| Export | 8 | export_gerber, export_pdf, export_bom, export_3d |
| Routing | 14 | route_trace, add_via, add_copper_pour, route_differential_pair |
| Library | 8 | search_footprints, get_footprint_info, list_libraries |
| 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
# 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-quantizeif needed. - KV cache must be bf16: Use
--cache-type-k bf16 --cache-type-v bf16with 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/nothinkprefix 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
| Category | Score |
|---|---|
| Tool Selection (10 tests) | 10/10 |
| No-Tool Response (2 tests) | 2/2 |
| Refusal (1 test) | 1/1 |
| Domain Knowledge (1 test) | 1/1 |
| Total | 14/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
- Downloads last month
- 806
Hardware compatibility
Log In to add your hardware
16-bit
Model tree for empulse/KiCAD-MCP-Qwen3.5-4B-GGUF
Evaluation results
- Accuracyself-reported100.000