Buckets:
Policy-NLI: everything from the Mercity policy-compliance sprint
This bucket holds the complete record of a one-day sprint (23–24 Nov 2026) that trained small models to check whether a customer-service AI followed its business's rules: code, derived data, every training run's logs and predictions, final model weights, ONNX exports, benchmark outputs, Claude-judge responses, the analysis and the reports.
Result in one line: decision model v2 (Mercity's 4B decision model + our LoRA, reading the conversation) catches 67 of 80 real policy violations at 1% false alarms on two business domains it never saw in training. Claude Sonnet 5.5 as a judge catches 33–34 and the best open guard model (DynaGuard-8B) catches 8. On DynaBench, v2 ties DynaGuard-8B.
Start here
| If you want… | Open |
|---|---|
| The story, charts and real model outputs | results/report/policy-nli-report.html (needs report_data.json next to it; serve the folder over HTTP, e.g. python -m http.server) |
| Every claim with its number, interval and caveat (for blogs and launch posts) | results/LAUNCH_BRIEF.md |
| The full technical record (methods, results, deviations) | results/REPORT.md |
| Where every file is | results/MANIFEST.md |
| One row per training run | results/runs_index.csv |
| All metrics for all models, with 95% intervals | results/final/all_models.csv, results/final/launch_numbers.json |
| Real model outputs (inputs, verdicts, written reasons) | results/report/examples.json |
| Dataset card for Mercity/policy-nli (build, labels, coverage, agreement, biases) | docs/dataset_card/README.md |
| How to serve v2 with vLLM (tested commands) | recipes/vllm/README.md |
| Measured speed per check, GPU and CPU | recipes/vllm/LATENCY.md, docs/cpu_latency.md |
Released models
| Model | Weights here | Hugging Face |
|---|---|---|
Decision model v2 (release): LoRA on Mercity/decision-model-qwen3.5-4b, trained with conversation context, DynaBench dialogues and written reasons |
deploy/hf/policy-nli-decision-model-4b-lora-v2/ (also runs/dm/F_ctx_dyna_chain_full_lr2e-4/adapter/) |
Mercity/policy-nli-decision-model-4b-lora (main) |
| Decision model v1 (no context) | deploy/hf/policy-nli-decision-model-4b-lora/ |
same repo, branch v1 |
| Encoder (screening model), ModernBERT-large 395M, no context | deploy/hf/policy-nli-modernbert-large/ (PyTorch, ONNX fp32, weight-only 8-bit and 4-bit) |
Mercity/policy-nli-modernbert-large |
Recommended deployment: the encoder scores every check and sends its top 20% to v2. That catches the same 67 of 80 as v2 alone, at about $5 instead of $20 per million checks on one A100.
Layout
src/ all code: data + metrics (pnli/), encoder trainer (encoder/), decision-model trainer, vLLM readout,
LoRA merge (dm/), guard baselines (baselines/), DynaBench (dynabench/), Claude judge (judge/),
evaluation + tables (eval/), report builders (report/), ONNX export + latency (deploy/)
data/ derived data: conversations, folds, DynaBench test/practice-set pairs, DynaBench training rows,
policy paraphrases (the raw policy-nli dataset is on HF: Mercity/policy-nli)
runs/dm/<run>/ decision-model runs: config.json, log.txt, train_log.jsonl (every step), stdout.txt,
per-epoch predictions (<split>_ep<k>.npz), final LoRA adapter (adapter/)
runs/enc/F/<run>/ final encoder runs: config, logs, per-step train_log.jsonl, predictions, final weights (ckpt/)
runs/enc/{S,B1,C,C_inter}/ encoder screening and ablation runs (cross-validation folds)
runs/{baselines,llm,judge,dynabench,bench,robust,context}/ logs of every benchmark job and every GPU queue script that ran
results/final/ aggregated metrics (CSV/JSON), paired comparisons, cascade analysis
results/preds/ predictions of every baseline: guard models, untrained LLMs, Claude judges (every API response
in *.jsonl, cost in *_cost.json), DynaBench (all models and protocols), robustness
results/report/ report page, its data, real examples
results/cards/ model cards; results/REPORT.md, LAUNCH_BRIEF.md, MANIFEST.md
deploy/ ONNX exports (fp32, weight-only 8/4-bit) per encoder + latency notes; deploy/hf = release folders
analysis_natural_vs_edited/ study of real vs AI-edited violations
logs/, queue/ install/download logs and the early job queue
docs/ dataset card, CPU speed write-up
recipes/vllm/ vLLM serving recipe, client (policy_check.py), latency benchmark
cpu_bench/ CPU benchmark scripts and logs (llama.cpp source and GGUF files not included; commands in docs/cpu_latency.md)
What is deliberately not here
- Merged decision-model weights (
runs/dm/*/merged, ~8 GB each): they are the base model plus the LoRA adapter. Rebuild withpython src/dm/merge_lora.py --adapter runs/dm/<run>/adapter --out <dir>(needed for vLLM, which ignores LoRA on Qwen3.5). - Broken quantised exports (
deploy/*/model.dyn_*.onnx): standard dynamic int8 destroyed encoder accuracy; the measurements are kept indeploy/*/int8_variants*.json, the working weight-only variants are included. - Third-party raw downloads: DynaBench (
tomg-group-umd/DynaBench, MIT), base models and guard models; get them from their Hugging Face pages. Everything derived from DynaBench that we trained or evaluated on is indata/. - Python environments and caches, and no optimizer states or intermediate checkpoints (none were kept).
- No API keys or tokens: the code reads them from the environment (
HF_TOKEN,ANTHROPIC_API_KEY).
Paths inside logs and docs are absolute paths from the training machine (/root/workspace/...); they map to the bucket root.
Reproducing
Environments used torch 2.x, transformers 5.x, peft, vLLM 0.34 and flash-linear-attention on 2× A100-80GB. Commands for every run
are in its config.json and in the queue scripts under runs/context/, runs/dynabench/, runs/bench/, runs/judge/.
Training a decision model with context takes ~1–2.5 h on one A100; an encoder ~13 min.
Licences and attribution
Training and evaluation data: Mercity/policy-nli (CC-BY-4.0) and DynaBench
from the DynaGuard paper (MIT). Base models: Mercity/decision-model-qwen3.5-4b (Qwen3.5), tasksource/ModernBERT-large-nli.
Our code and weights are released by Mercity as open source.
- Total size
- 29.4 GB
- Files
- 1,113
- Last updated
- Nov 23
- Pre-warmed CDN
- US EU US EU