import torchfrom transformers import AutoModelForCausalLM, AutoTokenizer model_id = "flintglass/PrismVerify-35B-A3B"tok = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto").eval() SYSTEM_PROMPT = ( "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_PROMPT}, {"role": "user", "content": "[CONTEXT]\nQ3 revenue rose 14% YoY to $2.4B.\n\n[CLAIM]\nQ3 revenue grew 24% YoY to $2.4B."},]prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)inputs = tok(prompt, return_tensors="pt").to(model.device)with torch.inference_mode(): out = model.generate(**inputs, max_new_tokens=160, do_sample=False)print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))