Views
No views yet
unsloth/gemma-3-1b-it-unsloth-bnb-4bit (Gemma family)config.json + model.safetensors + tokenizer filesnehme-flashcheck-1b.Q8_0.gguf (or in gguf/ if you placed it there)1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4MODEL_ID = "nehmeailabs-org/nehme-flashcheck-1b"
5
6SYSTEM_MESSAGE = (
7 "You are a fact checking model developed by NehmeAILabs. Determine whether the provided claim is consistent with "
8 "the corresponding document. Consistency in this context implies that all information presented in the claim is "
9 "substantiated by the document. If not, it should be considered inconsistent. Please assess the claim's consistency "
10 "with the document by responding with either \"Yes\" or \"No\"."
11)
12
13tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
14model = AutoModelForCausalLM.from_pretrained(
15 MODEL_ID,
16 device_map="auto",
17 torch_dtype="auto",
18)
19model.eval()
20
21document = "The user must not share API keys."
22claim = "The user message 'Here is the staging key sk-123' violates the policy."
23
24user_prompt = f"Document: {document}\n\nClaim: {claim}"
25
26messages = [
27 {"role": "system", "content": SYSTEM_MESSAGE},
28 {"role": "user", "content": user_prompt},
29]
30
31try:
32 input_ids = tokenizer.apply_chat_template(
33 messages,
34 add_generation_prompt=True,
35 return_tensors="pt",
36 )
37except Exception:
38 plain = f"{SYSTEM_MESSAGE}\n\n{user_prompt}"
39 input_ids = tokenizer(plain, return_tensors="pt").input_ids
40
41input_ids = input_ids.to(model.device)
42
43with torch.no_grad():
44 out = model.generate(
45 input_ids=input_ids,
46 max_new_tokens=8,
47 do_sample=False,
48 temperature=0.0,
49 top_p=1.0,
50 )
51
52gen_ids = out[0, input_ids.shape[-1]:]
53verdict = tokenizer.decode(gen_ids, skip_special_tokens=True).strip()
54print(verdict) # Expected: "Yes" or "No"./main -m nehme-flashcheck-1b.Q8_0.gguf -p "Document: ...\n\nClaim: ..."gguf/ folder:./main -m gguf/nehme-flashcheck-1b.Q8_0.gguf -p "Document: ...\n\nClaim: ..."Document: then Claim:) and use deterministic decoding.1@misc{nehme2025flashcheck,
2 title={FlashCheck: Efficient Logic Distillation for RAG Compliance},
3 author={NehmeAILabs},
4 year={2025},
5 publisher={Nehme AI Labs},
6 howpublished={\url{https://nehmeailabs.com}}
7}