Downloads · 30 days
8
28% of all-time downloads
MrWoRmMrLabs/prompt-surgeon-lfm2.5
prompt-surgeon-lfm2.5 is a text generation model from MrWoRmMrLabs. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as other.
A tiny, fully local prompt surgeon for AI agents. Given an agent's current prompt and evidence of a failure (a hallucination case plus a groundedness auditor's verdict), it proposes a single surgical fix — one rule to…
Downloads · 30 days
8
28% of all-time downloads
All-time downloads
29
Public
Repo size
116 MB
Likes
0
Public
Click a slice to open those files.
.safetensors97.9 MB · 85%
From the Hugging Face model README
A tiny, fully local prompt surgeon for AI agents. Given an agent's current prompt and evidence of a failure (a hallucination case plus a groundedness auditor's verdict), it proposes a single surgical fix — one rule to ADD to the prompt that prevents that whole class of failure — or says no change needed when the response was actually fine.
It is the companion to the groundedness-judge: the judge detects the hallucination, this model prescribes the cure. Together they close a measure → fix → re-measure loop that a local agent stack can run on itself, offline.
Built as a LoRA adapter on LiquidAI/LFM2.5-2.6B — small enough to run on a phone at Q4, trained on a single Tesla P100.
Trained by MrWoRmMr.
Input: the agent's current prompt (excerpt) + the failure evidence (bad response + auditor verdict). Output: a JSON object with
| field | type | meaning |
|---|---|---|
diagnosis | str | the failure pattern, in one line |
proposed_rule | str | the exact instruction to add (or "" if none) |
target | str | append_to_system | prepend_to_system | none |
rationale | str | why this rule fixes the pattern |
It is surgical, not a rewrite: it adds one targeted rule instead of rewriting the whole prompt —
safer (won't break the persona), composable, and learnable. It also learns restraint: on
grounded responses (or anti-artifact cases like naming the operator), it returns target: "none"
and adds nothing.
bf16: false, fp16: true, flash_attn: disabled.Like its judge sibling, the model reliably reaches the correct fix, but on out-of-distribution
inputs it tends to reason in prose before emitting JSON. Force structured output at inference
(llama.cpp / Ollama JSON grammar or format: json; transformers constrained decoding). The fine-tune
supplies the judgment, the grammar supplies the format.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
tok = AutoTokenizer.from_pretrained("MrWoRmMrLabs/prompt-surgeon-lfm2.5")
base = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2.5-2.6B")
model = PeftModel.from_pretrained(base, "MrWoRmMrLabs/prompt-surgeon-lfm2.5")
# feed: system rubric + (agent prompt + failure evidence). Prefer constrained JSON decoding.
LoRA weights under the LFM Open License v1.0 (inherited from the base model): free for organizations under $10M annual revenue; commercial licensing above that threshold.