ghostai-lfm3-1.7b-appcontract-v2
SFT checkpoint on the v2 app-contract dataset.
Fine-tuned from LiquidAI/LFM3-1.7B for the Ghost Wallet app contract: a compact on-device tool caller for a Solana wallet assistant (198 tools). The model emits Hermes-style tool calls and must stay silent on chat/answer turns.
Training
- Stage 1 (SFT): 3 epochs, lr 1e-5, cosine, bf16, FlashAttention-2, fused AdamW, ZeRO-2, max length 1536, assistant-only loss. Loss 0.083, token accuracy 99.3%.
- Dataset:
ghost-ai-app-contract-lfm3-v2.parquet— 6,321 rows (5,466 train / 855 test), split by utterance skeleton so the test set is unseen phrasings. Includes follow-up history turns, clarification turns (missing required arg -> ask, never guess), injection-resistance answers, and oversampled weak tools. - GRPO: trained with a graded verifier reward (exact call 1.0, right tool/valid args 0.80, wrong tool 0.20, blank 0, markup leak penalty).
Held-out eval (855-row test split, greedy decoding)
Measured with the repo's own parser/validator (scripts/eval_app_contract_hf.py),
818 rows scored:
| Metric | Value |
|---|---|
| Tool-call turns: parseable call | 99.56% |
| Tool-call turns: correct tool | 96.44% |
| Tool-call turns: arguments valid | 99.56% |
| Tool-call turns: exact call | 49.63% |
| Answer/chat turns: no tool call emitted | 100% (no calls emitted) |
These are in-repo held-out numbers, not the full 1,016-conversation app-harness benchmark, and not a claim of release readiness.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "immortaltatsu/ghostai-lfm3-1.7b-appcontract-v2"
tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True, dtype="bfloat16")
msgs = [{"role": "user", "content": "send 2 SOL to alice.sol"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True,
enable_thinking=False)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Always pass enable_thinking=False — LFM3 otherwise emits reasoning delimiters
(</think>) that the app's format check flags as markup leakage.
Limitations
- Trained/evaluated against fixture tool services; real protocol correctness, signing and transaction economics are out of scope.
- Value-moving tools must not sign or broadcast from chat; the app's confirmation gate is the authority, not the model.
- Keyword/value oracles do not measure general truthfulness or explanation quality.
- No blinded human review has been performed.
- The evaluation corpus is a regression questionnaire, not a proven uncontaminated held-out benchmark.
GGUF (llama.cpp)
| File | bpw | Size | Recipe |
|---|---|---|---|
ghostai-lfm3-appcontract-v2-F16.gguf | 16.00 | 3.99 GB | reference weights |
ghostai-lfm3-appcontract-v2-UD-Q4_K_XL.gguf | ~5.3 | 1.25 GB | dynamic 4-bit: Q4_K_M base, output q6_k, attn_v/ffn_down q5_k, token_embd q4_k, imatrix-calibrated |
ghostai-lfm3-appcontract-v2-IQ4_XS-imatrix.gguf | 4.56 | 1.14 GB | IQ4_XS with a 120x512-token app-contract imatrix |
All three load and generate with llama.cpp (LFM3 arch). The dynamic 4-bit recipe is a
UD-style mixture built with upstream llama.cpp; it is not Unsloth's exact published
UD-Q4_K_XL tensor recipe, so treat the name as "dynamic 4-bit, UD-style" rather than
bit-identical to Unsloth's release.
Run with the app's system prompt and enable_thinking=False; the model is a tool caller,
so a bare user turn without the tool catalog will decline rather than call a tool.