--- license: apache-2.0 language: - en - multilingual base_model: Qwen/Qwen3.5-9B base_model_relation: finetune datasets: - flintglass/PrismVerify-Corpus pipeline_tag: text-generation library_name: transformers tags: - qwen3_5 - hallucination-detection - groundedness - rag - llm-as-a-judge - verification - structured-outputs - rlvr - grpo - flintglass - prismverify --- # Flintglass PrismVerify-9B **Flintglass PrismVerify-9B** is a **Pure On-Policy RLVR (PPO-Clipped GRPO)** RAG groundedness & hallucination verification judge built on [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) (9.65B params, 262K context, Apache-2.0). Given a retrieved `[CONTEXT]` and a candidate `[CLAIM]`, it outputs a **strict, 100% schema-valid JSON verdict** with a concise, evidence-based justification (`~55` tokens, `<1s` on consumer GPUs): ```json {"verdict": "CONTRADICTION", "hallucinated": true, "reason": "Context reports Q3 revenue of $42M, whereas the claim states $58M."} ``` Across **8,857 strictly held-out zero-leakage RAG verification tasks (5 benchmarks)**, Pure On-Policy GRPO boosts `Qwen/Qwen3.5-9B` by **`+9.83 pts` on RAGTruth F1 (`0.7027 -> 0.8010`)**, **`+8.98 pts` on 5-Benchmark Macro F1 (`0.6802 -> 0.7700`)**, and **`+5.31 pts` on out-of-domain Financial QA (`FinQA-OOD`)**, improving **every single benchmark simultaneously**—and **outperforming 3× larger Base `Qwen/Qwen3.8-27B` on RAGTruth (`+4.92 pts`), DocNLI, LongRAG-8K, and overall 5-Benchmark Macro F1 (`0.7700` vs `0.7559`)**! - **Quantized GGUFs (`Q4_K_M`, `Q5_K_M`, `Q6_K`, `Q8_0`)**: [flintglass/PrismVerify-9B-GGUF](https://huggingface.co/flintglass/PrismVerify-9B-GGUF) - **Zero-Leakage Training Dataset (`68.6K` rows)**: [flintglass/PrismVerify-Corpus](https://huggingface.co/datasets/flintglass/PrismVerify-Corpus) - **Fast Encoder Companion (`16 ms` CPU) & Live Demo**: [PrismVerify-Large](https://huggingface.co/flintglass/PrismVerify-Large) | [PrismVerify-Multilingual](https://huggingface.co/flintglass/PrismVerify-Multilingual) | [Live Demo](https://huggingface.co/spaces/flintglass/PrismVerify-Demo) - **Standalone PEFT LoRA (`r=64`)**: Included in [`lora/`](./lora/) alongside full merged **BF16 Safetensors**. --- ## Strictly Held-Out 5-Benchmark Results (8,857 Tasks) All evaluations were run deterministically (`temperature=0.0`, non-thinking mode) on the exact same zero-leakage 8,857-task benchmark suite (3,646 training overlaps strictly blocked prior to training). | Benchmark (Held-Out Tasks) | Base `Qwen3.5-9B` F1 | Base `Qwen3.8-27B` (3× Larger) F1 | **PrismVerify-9B F1** | Delta vs 9B Base | **PrismVerify-9B Macro F1** | Valid JSON | Avg Tok | |---|---:|---:|---:|---:|---:|---:|---:| | **RAGTruth Test** (2,700) | 0.7027 | 0.7518 | **0.8010** | **+9.83%** | **0.8447** | 99.96% | 52.9 | | **HaluEval Test** (1,500) | 0.7193 | 0.7425 | **0.7359** | **+1.66%** | **0.7249** | 100.0% | 45.5 | | **DocNLI Test** (2,000) | 0.7996 | 0.7995 | **0.8059** | **+0.63%** | **0.8085** | 100.0% | 54.7 | | **FinQA-OOD** (1,657) | 0.2663 | 0.3938 | **0.3194** | **+5.31%** | **0.5361** | 99.88% | 57.6 | | **LongRAG-8K Bench** (1,000) | 0.9339 | 0.9341 | **0.9376** | **+0.37%** | **0.9360** | 100.0% | 53.8 | | **5-Benchmark Average** | **0.6844** | **0.7243** | **0.7200** | **+3.56%** | **0.7700 (+8.98% vs 9B, +1.41% vs 27B)** | **99.97%** | **52.9** | > *Why Macro F1 jumped +8.98%*: Base `Qwen/Qwen3.5-9B` over-flagged faithful responses on `RAGTruth` and `FinQA-OOD`. Pure On-Policy GRPO sharply calibrated both precision and recall across all 5 benchmarks while maintaining `~99.9%` strict JSON schema validity. --- ## Quickstart ### Local Inference (`llama.cpp` / Ollama — 5.5 GB VRAM!) ```bash llama-server -hf flintglass/PrismVerify-9B-GGUF:Q4_K_M --jinja --ctx-size 32768 --port 8080 ``` ### Python (`transformers`) ```python import json, torch from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "flintglass/PrismVerify-9B" tok = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto") SYSTEM = ( "You are Flintglass PrismVerify, a strict RAG groundedness and hallucination verifier. " "Compare the [CLAIM] against the [CONTEXT] ONLY (never rely on outside knowledge). " 'Respond ONLY with a valid JSON object matching this exact schema:\n' '{"verdict": "FAITHFUL" | "UNSUPPORTED" | "CONTRADICTION", "hallucinated": false | true, "reason": "concise evidence-based justification (<=30 words)"}\n' "Rules:\n" "- FAITHFUL (hallucinated=false): Every factual claim is directly supported by [CONTEXT].\n" "- UNSUPPORTED (hallucinated=true): Introduces facts, numbers, or entities absent from [CONTEXT].\n" "- CONTRADICTION (hallucinated=true): Directly contradicts information stated in [CONTEXT]." ) messages = [ {"role": "system", "content": SYSTEM}, {"role": "user", "content": "[CONTEXT]\nAcme Corp reported Q3 revenue of $42M, up 10% YoY.\n\n[CLAIM]\nAcme Corp reported Q3 revenue of $58M."}, ] prompt = tok.apply_chat_template(messages, enable_thinking=False, tokenize=False, add_generation_prompt=True) inputs = tok(prompt, return_tensors="pt").to(model.device) out = model.generate(**inputs, max_new_tokens=160, do_sample=False) verdict = json.loads(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)) print(verdict) ``` --- ## The Complete 6-Pillar Flintglass Prism Open-Source Agent & RAG Stack All models are **100% Apache-2.0** and evaluated on zero-leakage held-out benchmarks: 1. **Ingest**: [PrismParse-4B](https://huggingface.co/flintglass/PrismParse-4B) / [PrismParse-2B](https://huggingface.co/flintglass/PrismParse-2B) 2. **Embed**: [PrismEmbed-Multilingual](https://huggingface.co/flintglass/PrismEmbed-Multilingual) | [PrismEmbed-Large](https://huggingface.co/flintglass/PrismEmbed-Large) | [PrismEmbed-Small](https://huggingface.co/flintglass/PrismEmbed-Small) ([Live Demo](https://huggingface.co/spaces/flintglass/PrismEmbed-Demo)) 3. **Rerank**: [PrismRerank-Large](https://huggingface.co/flintglass/PrismRerank-Large) | [PrismRerank-Multilingual](https://huggingface.co/flintglass/PrismRerank-Multilingual) | [PrismRerank-Small](https://huggingface.co/flintglass/PrismRerank-Small) ([Live Demo](https://huggingface.co/spaces/flintglass/PrismRerank-Demo)) 4. **Protect**: [PrismGuard-Multilingual](https://huggingface.co/flintglass/PrismGuard-Multilingual) ([Live Demo](https://huggingface.co/spaces/flintglass/PrismGuard-Demo)) 5. **Execute**: [Inkling-2-Mini-PrismAgent](https://huggingface.co/flintglass/Inkling-2-Mini-PrismAgent) | [PrismAgent-27B](https://huggingface.co/flintglass/PrismAgent-27B) | [PrismAgent-35B-A3B](https://huggingface.co/flintglass/PrismAgent-35B-A3B) | [PrismAgent-9B](https://huggingface.co/flintglass/PrismAgent-9B) | [PrismAgent-8B](https://huggingface.co/flintglass/PrismAgent-8B) 6. **Verify**: **PrismVerify-9B** | [PrismVerify-4B](https://huggingface.co/flintglass/PrismVerify-4B) | [PrismVerify-Large](https://huggingface.co/flintglass/PrismVerify-Large) | [PrismVerify-Multilingual](https://huggingface.co/flintglass/PrismVerify-Multilingual) ([Live Demo](https://huggingface.co/spaces/flintglass/PrismVerify-Demo)) ## License Released under **Apache-2.0**.