Instructions to use dcostenco/prism-coder-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use dcostenco/prism-coder-4b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="dcostenco/prism-coder-4b", filename="prism-coder-4b-v43-Q4_K_M.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use dcostenco/prism-coder-4b with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf dcostenco/prism-coder-4b: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 dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf dcostenco/prism-coder-4b: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 dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Use Docker
docker model run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use dcostenco/prism-coder-4b with Ollama:
ollama run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- Unsloth Studio new
How to use dcostenco/prism-coder-4b 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 dcostenco/prism-coder-4b 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 dcostenco/prism-coder-4b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for dcostenco/prism-coder-4b to start chatting
- Pi new
How to use dcostenco/prism-coder-4b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf dcostenco/prism-coder-4b: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": "dcostenco/prism-coder-4b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use dcostenco/prism-coder-4b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf dcostenco/prism-coder-4b: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 dcostenco/prism-coder-4b:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use dcostenco/prism-coder-4b with Docker Model Runner:
docker model run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- Lemonade
How to use dcostenco/prism-coder-4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull dcostenco/prism-coder-4b:Q4_K_M
Run and chat with the model
lemonade run user.prism-coder-4b-Q4_K_M
List all available models
lemonade list
prism-coder:4b — Full Prism Memory Router (Mid-Tier)
Fine-tuned Qwen3-4B for 17-tool Prism Memory routing in the Prism AAC system. Primary deployment: Mac / PC / high-memory mobile via Ollama or llama.cpp GGUF — for devices with ≥8 GB free RAM.
BFCL Routing Benchmark — v43 (Current)
100.0% (64/64 strict, 8 categories)
| Category | Count | Description | Accuracy |
|---|---|---|---|
| simple | 10 | Direct single-tool invocations | 100% |
| relevance_detection | 10 | No-tool abstention for off-topic prompts | 100% |
| hallucination | 10 | Reject fabricated / nonexistent tools | 100% |
| disambiguation | 8 | Pick correct tool from near-neighbors | 100% |
| format_sensitivity | 5 | Varied natural phrasing for same intent | 100% |
| ast_parameter | 5 | Correct argument extraction | 100% |
| edge_case | 8 | Boundary and adversarial inputs | 100% |
| multi_turn_chain | 8 | Two-step tool sequences | 100% |
Eval: Ollama inference, temperature=0, greedy decode. Gate: ≥90% = deploy.
SWE Bench Blind Eval — v43
100.0% (68/68 strict, 7 categories) — held-out test set, no overlap with training data.
| Category | Count | Accuracy |
|---|---|---|
| adversarial_trap | 15 | 100% |
| cascade | 10 | 100% |
| disambiguation | 8 | 100% |
| edge_case | 8 | 100% |
| multi_intent | 4 | 100% |
| natural_phrasing | 15 | 100% |
| verifier | 8 | 100% |
eval-300 — v43
100.0% (300/300 strict, 5 shuffled runs, 0 flaky tests)
| Category | Count | Accuracy |
|---|---|---|
| abstention | 20 | 100% |
| adversarial_trap | 70 | 100% |
| cascade | 25 | 100% |
| disambiguation | 40 | 100% |
| edge_case | 25 | 100% |
| multi_intent | 20 | 100% |
| natural_phrasing | 50 | 100% |
| param_extraction | 25 | 100% |
| verifier | 25 | 100% |
Version History
| Version | BFCL | SWE Bench | eval-300 | Notes |
|---|---|---|---|---|
| v43 | 100% | 100% | 100% | Qwen3-4B base, 17-tool full router, Layer 3 inference-time remapping, 5 surgical patches |
Tools
The model routes to 17 Prism Memory tools:
| Tool | Trigger |
|---|---|
session_load_context |
Load / resume / catch me up on project context |
session_save_ledger |
Jot down / log / note / record what we did |
session_save_experience |
Log milestone / achievement / success event |
session_save_handoff |
Save state for next agent / shift change |
session_search_memory |
Recall / remind me / find what we decided |
session_forget_memory |
Delete a specific memory entry by ID |
session_export_memory |
Export session to file (JSON / Markdown) |
session_compact_ledger |
Compact / prune old session entries |
session_health_check |
Check session integrity |
session_synthesize_edges |
Verify / rebuild session link graph |
session_backfill_links |
Reconnect / patch missing session links |
session_task_route |
Route a task to the right agent tier |
knowledge_search |
Search knowledge base / accumulated docs |
knowledge_forget |
Delete knowledge entries / wipe records |
knowledge_upvote |
Upvote / boost / increase rank of entry |
knowledge_downvote |
Downvote / lower rank of entry |
knowledge_set_retention |
Set TTL / auto-expire / retention policy |
Plain text (no tool) for: greetings, general questions, math, code help, weather, CS concepts.
Model Details
- Base: Qwen/Qwen3-4B
- Format: GGUF Q4_K_M (~2.3 GB)
- Context: 32,768 tokens
- Training: MLX LoRA on Apple Silicon, rank=32, alpha=64, 16/36 layers, LR=1e-4 (full) → 3e-5 (surgical patches), 5 patch rounds
- Corpus: ~30K rows — 36% tool-use, 40% AAC/clinical, 12% abstention, 12% safety
- Merge: direct safetensors delta merge (
delta = (alpha/rank) × B.T @ A.T) — mlx_lm.fuse not used (silently drops LoRA weights) - Quantization: llama.cpp F16 → Q4_K_M
Usage
ollama pull dcostenco/prism-coder:4b-v43
ollama run dcostenco/prism-coder:4b-v43
Or drop the GGUF into any llama.cpp-compatible runtime (LM Studio, Jan, llama-server).
In Prism AAC the app loads this model automatically on devices with ≥8 GB free RAM.
Training Scripts
The training/ folder in this repo contains the full v43 training pipeline:
| Script | Purpose |
|---|---|
build_4b_v43_corpus.py |
Full v43 corpus builder (~30K rows) |
build_4b_v43_patch.py |
Patch 1 — initial BFCL failures |
build_4b_v43_patch2.py |
Patch 2 — param extraction + format |
build_4b_v43_patch4.py |
Patch 4 — task_route + casual phrasing |
build_4b_v43_swe_patch.py |
Patch 5 — SWE bench targeted |
combine_4b_swe_corpus.py |
Merge base + SWE patch corpus |
train_4b_v43_local.sh |
MLX LoRA training (Apple Silicon) |
train_4b_v43_swe_patch.sh |
Surgical SWE patch training run |
merge_4b_v43.py |
Safe LoRA merge (delta = scale × B.T @ A.T) |
export_4b_v43_gguf.sh |
HF safetensors → GGUF F16 → Q4_K_M → Ollama |
orchestrate_4b_to_100.sh |
Autonomous patch→train→eval loop |
bfcl_eval.py |
64-test BFCL eval harness with Layer 3 |
swe_bench_test.py |
68-test SWE blind eval harness |
eval_300.py |
300-test standard eval (9 categories) |
analyze_swe_failures.py |
Parse failures → patch targets |
TRAINING_DECISIONS_4B_V43.md |
Hyperparams, corpus ratios, lessons learned |
Model Family
| Model | GGUF | RAM | Tools | Repo |
|---|---|---|---|---|
| prism-coder:1b7 | 1.2 GB | ≥3 GB | 6 | dcostenco/prism-coder-1.7b |
| prism-coder:4b | 2.3 GB | ≥8 GB | 17 | this repo |
| prism-coder:8b | 4.9 GB | ≥16 GB | 6 | dcostenco/prism-coder-8b |
| prism-coder:14b | 8.4 GB | ≥24 GB | 6 + TypeScript | dcostenco/prism-coder-14b |
| prism-coder:32b | 16 GB | ≥48 GB | 6 | dcostenco/prism-coder-32b |
- Downloads last month
- -
4-bit