GhostAI Pro — MiniCPM5-2B app-contract (v5)
On-device tool-calling model for the GhostWallet Solana app. Given the app's system prompt and a retrieved slice of its 175-tool catalog, it emits a single Hermes-style tool call, then answers in one grounded line from the tool result.
<tool_call>{"name":"get_wallet_balance","arguments":{}}</tool_call>
Fine-tuned from openbmb/MiniCPM5-2B
(Apache-2.0) on the app's real contract. Same output shape as the other Ghost AI tiers, so it
drops into the existing parser, validator, execution loop, and confirm gate unchanged.
What changed in v5
Rebuilt from scratch on the app's current tool surface. Versus the deleted NFT/MagicBlock surface:
- +5 tools:
list_accounts,privacycash_register,privacycash_deposit,privacycash_send,privacycash_withdraw - −4 tools:
get_nft,list_nfts,magicblock_swap,magicblock_swap_quote - params:
execute_swap/get_swap_quote+routeSource;web_fetch+query - enums:
get_privacy_status/balance/activity+privacy-cash
Corpus: 5,270 traces (rebuilt from 5,520 specs; 250 dropped as catalog-miss), split 4,381 train / 889 held-out.
Results
Held-out app-contract corpus (HF, greedy, 889 rows)
| bucket | n | emitted call | correct tool | valid args | exact call |
|---|---|---|---|---|---|
| tool_call | 464 | 100% | 96.1% | 97.8% | 49.8% |
| answer | — | — | — | — | grounded one-liner, no spurious call |
| chat | — | — | — | — | refusal, no spurious call |
Tool selection improved from 94.6% (v4 surface) to 96.1% while adding the privacy-cash rail.
App-pipeline harness
src/sdk/chat/ghostai-app.test.ts (21 tests) drives the app's real ChatSession.send() with
canned model outputs and asserts the parser → validator → security gates → executor hold,
including the confirm gate for send_sol and all four privacycash_* tools. Absolute
invariants: 0 confirm-gate bypasses, 0 planted injection strings reaching a tool
argument.
Quants
Both 4-bit quants use an importance matrix computed from 1,200 v5 calibration traces.
| File | Size | BPW | Notes |
|---|---|---|---|
ghostai-pro-Q4_K_M.gguf | 1.56 GB | 4.95 | production (llama.rn / llama.cpp) |
ghostai-pro-IQ4_XS.gguf | 1.42 GB | 4.51 | smaller 4-bit alternative |
Serving with llama.cpp (important)
MiniCPM5-2B tokenizes <tool_call> / </tool_call> as special tokens. llama.cpp and
llama-server strip special tokens by default, which would delete the Hermes markers the app
parser needs. Serve with --special, disable reasoning extraction, and keep the empty think
block:
llama-server -m ghostai-pro-Q4_K_M.gguf \
-ngl 99 -c 8192 --jinja --special \
--reasoning-format none \
--chat-template-kwargs '{"enable_thinking": false}'
Files
| File | Size | Notes |
|---|---|---|
model.safetensors | 5.0 GB | bf16 weights, epoch 2 (for further fine-tuning) |
ghostai-pro-Q4_K_M.gguf | 1.56 GB | imatrix 4-bit, production |
ghostai-pro-IQ4_XS.gguf | 1.42 GB | imatrix 4-bit alternative |
config.json, tokenizer*, chat_template.jinja | — | standard HF sidecars |
Training
- Objective: SFT (TRL
SFTTrainer, DeepSpeed ZeRO-3, bf16, 2×A100-40GB), lr 1e-5, effective batch 32, max length 2048, assistant-only loss. - Chat template: MiniCPM5 ships no
{% generation %}markers, so training used a copy of the upstream template with the assistant branch wrapped in{% generation %}; the inference template shipped here is the original. - Epochs: 3 run, epoch 2 shipped (eval loss 0.1826 → 0.1804 → 0.2098).
Base model: openbmb/MiniCPM5-2B, Apache-2.0.