Text Classification
Laya
LiteRT
Safetensors
GGUF
LiteRT
English
Spanish
child-safety
content-moderation
risk-detection
grooming-detection
encoder
modernbert
mmbert
calibrated-decisions
on-device
research
feature-extraction
Instructions to use safecircleai/vigil with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use safecircleai/vigil with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- LiteRT
How to use safecircleai/vigil with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use safecircleai/vigil with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible embeddings server: llama serve -hf safecircleai/vigil:Q8_0 --embeddings
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible embeddings server: llama serve -hf safecircleai/vigil:Q8_0 --embeddings
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible embeddings server: ./build/bin/llama serve -hf safecircleai/vigil:Q8_0 --embeddings
- Llama new
- LM Studio
- Jan
- Ollama
How to use safecircleai/vigil with Ollama:
ollama run hf.co/safecircleai/vigil:Q8_0
- Unsloth Desktop
- Docker Model Runner
How to use safecircleai/vigil with Docker Model Runner:
docker model run hf.co/safecircleai/vigil:Q8_0
- Lemonade
How to use safecircleai/vigil with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull safecircleai/vigil:Q8_0
Run and chat with the model
lemonade run user.vigil-Q8_0
List all available models
lemonade list
- Atomic Chat
Add run-locally guide, Ollama note and run_vigil.py helper
Browse filesFiles changed (3)
- README.md+47-7
- gguf/__pycache__/run_vigil.cpython-315.pycAdded
- gguf/run_vigil.pyAdded+79
58 unmodified lines5960616263646 unmodified lines7172737475767778798081828384858658 unmodified lines| `gguf/vigil-f16.gguf` | Full model (encoder + decision head) as GGUF, f16 (659 MB). **Needs a llama.cpp fork, see [GGUF](#gguf-llamacpp)** || `gguf/vigil-Q8_0.gguf` | Same, encoder matrices in Q8_0 (542 MB). Slightly less faithful, see below || `gguf/vigil_spec.json` | Per-category thresholds (same file as `litert/vigil_spec.json`) |## GGUF (llama.cpp)6 unmodified lines> fork [`Clauszy/llama.cpp`](https://github.com/Clauszy/llama.cpp) at commit `ffc55c93`. Not affiliated with> SafeCircle. `llama-cli`, `llama-server` and Ollama will **not** load them.```bashgit clone https://github.com/Clauszy/llama.cpp && cd llama.cpp && git checkout ffc55c93cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j --target llama-laya-cli# input.json: {"state": "<conversation text>", "questions": {"category": {...}, "severity": {...}}}# (the two choice8 questions are vigil.questions.build_questions("choice8") in github.com/safecircleia/vigil)./build/bin/llama-laya-cli -m vigil-f16.gguf -f input.json```The CLI prints per-category probabilities and the severity score. Decisions still need the per-categorythresholds in `gguf/vigil_spec.json` (or `thresholds.json`); they are not applied by the CLI.Fidelity against the PyTorch checkpoint, 150 held-out conversations (1,050 category decisions) plus the 12 goldenconversations, decided at the shipped thresholds:58 unmodified lines596061626364656 unmodified lines7273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512658 unmodified lines| `gguf/vigil-f16.gguf` | Full model (encoder + decision head) as GGUF, f16 (659 MB). **Needs a llama.cpp fork, see [GGUF](#gguf-llamacpp)** || `gguf/vigil-Q8_0.gguf` | Same, encoder matrices in Q8_0 (542 MB). Slightly less faithful, see below || `gguf/vigil_spec.json` | Per-category thresholds (same file as `litert/vigil_spec.json`) || `gguf/run_vigil.py` | Helper that runs `llama-laya-cli` on a chat and applies the thresholds (standard library only) |## GGUF (llama.cpp)6 unmodified lines> fork [`Clauszy/llama.cpp`](https://github.com/Clauszy/llama.cpp) at commit `ffc55c93`. Not affiliated with> SafeCircle. `llama-cli`, `llama-server` and Ollama will **not** load them.### Run it locally (macOS / Linux, CPU or Metal)Tested on macOS (Apple Silicon) with the default CMake settings. You need `git`, `cmake`, a C++ compiler and Python 3.```bash# 1. Build the Laya CLI from the pinned fork commit (a few minutes)mkdir vigil-gguf && cd vigil-ggufgit init -q llama.cpp && cd llama.cppgit remote add origin https://github.com/Clauszy/llama.cppgit fetch --depth 1 origin ffc55c93bc33c1935983c0177375669bf0d7de35 && git checkout FETCH_HEADcmake -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFFcmake --build build -j --target llama-laya-clicd ..# 2. Download the model and helper scripthf download safecircleai/vigil gguf/vigil-f16.gguf gguf/vigil_spec.json gguf/run_vigil.py --local-dir .# 3. Classify a conversation (plain text file, one message per line)printf 'Other: hey, how old are you?\nChild: 12, why?\nOther: you seem really mature for your age. dont tell your mom we talk, ok? its our secret\nChild: ok i guess\nOther: add me on snapchat, its private there and nobody checks it\n' > chat.txtpython3 gguf/run_vigil.py --cli llama.cpp/build/bin/llama-laya-cli \--gguf gguf/vigil-f16.gguf --spec gguf/vigil_spec.json chat.txt```Output (real, from the f16 file):```json{"probabilities": {"grooming": 0.9906, "bullying": 0.0021, "sexual_content": 0.0014, "isolation": 0.0012,"personal_info": 0.0009, "platform_migration": 0.0017, "threats": 0.0013},"flagged": ["grooming"],"severity_score": 2.9916,"severity": "high"}```A harmless chat ("are you coming to practice tomorrow?") gives every probability near 0.001, `flagged: []` and`severity_score` 0.25 (`none`).How it works: `run_vigil.py` sends the conversation to `llama-laya-cli` together with Vigil's two fixed questions (an8-way category choice and a severity score), then flags every category whose probability reaches its threshold in`vigil_spec.json`. Do not change the question wording; the model was trained on it. Each call loads the model (about2 s on an Apple Silicon Mac once the file is cached; the first run is slower while it is read from disk), so scriptbatches if you need throughput. Metal and CPU give identical probabilities.### Ollama**Not supported.** Ollama is built on upstream llama.cpp, which cannot tokenize this model and has no Laya head, so`ollama create` / `ollama run` on these files fails at load. The classifier also does not generate text, which iswhat Ollama's endpoints expect. Use the CLI above, or wrap `run_vigil.py` in your own service.Fidelity against the PyTorch checkpoint, 150 held-out conversations (1,050 category decisions) plus the 12 goldenconversations, decided at the shipped thresholds:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879#!/usr/bin/env python3"""Run Vigil's GGUF through llama-laya-cli and apply the shipped thresholds. Standard library only.
python run_vigil.py --cli build/bin/llama-laya-cli --gguf vigil-f16.gguf --spec vigil_spec.json chat.txt
`chat.txt` is the conversation as plain text, one message per line, e.g. "Other: hi\nChild: hello".Use "-" to read stdin. Prints JSON: per-category probability, which categories are flagged, expected severity."""import argparseimport jsonimport subprocessimport sysimport tempfile
CATEGORIES = ("grooming", "bullying", "sexual_content", "isolation", "personal_info", "platform_migration", "threats")
# The two questions Vigil was trained on (vigil/questions.py, design "choice8"). The wording must not change.QUESTIONS = { "category": { "type": "choice", "instructions": "Which kind of child-safety risk does this conversation show?", "criteria": { "benign": "no risk, an ordinary harmless chat", "grooming": "an older person builds trust to exploit the child", "bullying": "insults, humiliation or harassment", "sexual_content": "sexual content directed at the child", "isolation": "cutting the child off from family and friends", "personal_info": "asking for or sharing personal information", "platform_migration": "moving the chat to a less monitored app", "threats": "threats, blackmail or self-harm", }, }, "severity": { "type": "score", "instructions": "How severe is the child-safety risk in this conversation?", "criteria": [ "no risk: an ordinary, harmless conversation", "low risk: a mild warning sign that needs no action yet", "medium risk: a clear warning sign that a guardian should review", "high risk: a serious risk that needs prompt action", "critical risk: immediate danger to the child", ], },}SEVERITY = ("none", "low", "medium", "high", "critical")
def classify(cli: str, gguf: str, thresholds: dict, text: str, threads: int) -> dict: with tempfile.NamedTemporaryFile("w", suffix=".json", delete=False, encoding="utf-8") as f: json.dump({"state": text, "questions": QUESTIONS}, f) proc = subprocess.run([cli, "-m", gguf, "-f", f.name, "-t", str(threads)], capture_output=True, text=True) if proc.returncode != 0: sys.exit(f"llama-laya-cli failed ({proc.returncode}):\n{proc.stderr[-2000:]}") answers = json.loads(proc.stdout)["answers"] probs = {c: answers["category"]["probabilities"][c] for c in CATEGORIES} score = answers["severity"]["score"] return { "probabilities": probs, "flagged": [c for c in CATEGORIES if probs[c] >= thresholds[c]], "severity_score": score, "severity": SEVERITY[min(4, round(score))], }
def main() -> None: p = argparse.ArgumentParser() p.add_argument("--cli", required=True, help="path to llama-laya-cli") p.add_argument("--gguf", required=True) p.add_argument("--spec", required=True, help="vigil_spec.json (holds the per-category thresholds)") p.add_argument("--threads", type=int, default=4) p.add_argument("chat", help="text file with the conversation, or - for stdin") args = p.parse_args() thresholds = json.load(open(args.spec, encoding="utf-8"))["thresholds"] text = sys.stdin.read() if args.chat == "-" else open(args.chat, encoding="utf-8").read() print(json.dumps(classify(args.cli, args.gguf, thresholds, text.strip(), args.threads), indent=2))
if __name__ == "__main__": main()README.md+47-7
gguf/__pycache__/run_vigil.cpython-315.pycAdded
gguf/run_vigil.pyAdded+79