CoolFace
Modelpublic

FrameByFrame/llm-defence-scanner-lfm2.5-1.2b

sourceHugging Faceotherupdated 5mo agoView on Hugging Face
0likes27downloads
Model Card

LLM Defence Scanner — LFM2.5 1.2B

![GitHub](https://github.com/FrameByFrame-AI/llm-defence-scanner)

A fine-tuned LFM2.5-1.2B-Instruct model for AI guardrail classification. Single LLM, six categories, structured JSON verdicts. Works for input guard (scan user prompts before they reach an LLM) and output guard (scan LLM responses before they reach the user).

![Open Notebook](https://huggingface.co/FrameByFrame/llm-defence-scanner-lfm2.5-1.2b/blob/main/releasev1demo.ipynb) — runnable end-to-end with all six categories.

Capabilities

CategoryWhat it catches
piinames, emails, phones, IDs, cards, addresses, credentials
prompt_injectionjailbreaks, instruction overrides, role-hijack attempts
topic_bantenant-configured restricted topics
competitortenant-configured competitor mentions
codecode snippets in disallowed programming languages
malicious_urlphishing, typosquats, known-bad domains

Categories are scoped per request via applied_policies — different tenants enable different scanners with different parameters.

Benchmarks

Held-out test set, 841 records, English only. Model output is post-processed deterministically (apply_policy_postprocess) for code allow-list and competitor list filtering.

metricvalue
mean_total_score0.991
schemavalidityrate1.000
exactcategoryset_rate0.999
meanmatchedscore0.990
meanspanscore0.961
exactoverallblocked_rate0.999
hardfailrate0.001

Per-category matched-accuracy:

categorymatched-accspan F1
pii99.5%0.913
competitor99.7%0.995
topic_ban98.1%0.937
code100.0%0.982
prompt_injection99.3%0.873
malicious_url96.4%0.907

Inference

End-to-end usage — model load, prompt rendering, post-processor, six category examples for both input-leg and output-leg — is in [`release_v1_demo.ipynb`](https://huggingface.co/FrameByFrame/llm-defence-scanner-lfm2.5-1.2b/blob/main/release_v1_demo.ipynb). Download and run in Jupyter or Colab.

For production serving with vLLM:

bash
vllm serve FrameByFrame/llm-defence-scanner-lfm2.5-1.2b \
  --served-model-name llm-defence-scanner \
  --max-model-len 4096 \
  --gpu-memory-utilization 0.85 \
  --no-enable-prefix-caching

p50 latency ~360 ms on RTX PRO 6000 Blackwell, p95 ~870 ms.

Output schema

json
{
  "overall_blocked": true,
  "severity": "high",
  "language": {"dominant": "en", "alternates": [], "script": "latin", "code_mixed": false},
  "scenario": {"name": "banking", "profile": "retail_banking_kyc"},
  "categories": [
    {
      "name": "pii",
      "matched": true,
      "matches": [
        {"text": "alice.tan@example.com", "kind": "email"},
        {"text": "+1-415-555-2244", "kind": "phone"}
      ]
    }
  ],
  "reason": "The input contains personally identifiable information."
}
fieldrole
overall_blockedgateway decision: refuse or allow
categories[].matchedper-category fire flag
categories[].matches[].textverbatim substring — ready to redact
categories[].matches[].kindsubtype label (e.g. email, phone, python, phishing)

Training

  • —Base: LiquidAI/LFM2.5-1.2B-Instruct
  • —Method: LoRA (r=16, α=16) on q/k/v/o + w1/w2/w3, then merged
  • —Dataset (v5): ~11k records spanning synthetic multi-category inputs, ai4privacy/pii-masking-65k PII spans, bantopics safety pairs, embedded prompt-injection synthesis. English only, 8-gram leakage-filtered against the test split.
  • —Hyperparameters: effective batch=32, LR=2e-4, 2 epochs
  • —Hardware: single RTX PRO 6000 Blackwell (96GB)
  • —Final eval_loss: 0.0015

Citation

bibtex
@misc{mariappan2026llmdefence,
  author    = {Mariappan, Vijayachandran},
  title     = {LLM Defence Scanner — LFM2.5 1.2B},
  year      = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/FrameByFrame/llm-defence-scanner-lfm2.5-1.2b}}
}

License

Based on LFM2.5 — subject to the LFM Open License v1.0.