--- language: - vi license: apache-2.0 base_model: Qwen/Qwen2.5-7B-Instruct tags: - fact-checking - vietnamese - qwen2.5 - qlora - peft - nlp - hallucination-detection pipeline_tag: text-generation --- # VInFi-Check — Qwen2.5-7B QLoRA Vietnamese fact-checking model fine-tuned from **Qwen2.5-7B-Instruct** with **QLoRA**, trained on sentence-level verified Vietnamese news summaries. Given a Vietnamese news article and a summary sentence, the model verifies whether the sentence is grounded in the source document. Inspired by [InFi-Check (arXiv:2601.06666)](https://arxiv.org/abs/2601.06666). --- ## Model Details - **Developed by:** [sunflowerbiii](https://huggingface.co/sunflowerbiii) - **Base model:** [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) - **Method:** QLoRA (4-bit NF4 + bfloat16 + LoRA adapter) - **Language:** Vietnamese (`vi`) - **License:** Apache 2.0 --- ## Training Data Vietnamese news articles across 20 topic categories, with summaries generated by **DeepSeek** and verified via majority vote across 3 LLMs (GPT-4o-mini · Qwen-2.5-72B · LLaMA-3.3-70B). Each sentence is paired with grounding evidence from the source document. Six hallucination types are injected synthetically: Predicate Error, Entity Error, Circumstance Error, Co-reference Error, Discourse Link Error, Extrinsic Error. --- ## How to Use ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, GenerationConfig from peft import PeftModel BASE_MODEL = "Qwen/Qwen2.5-7B-Instruct" ADAPTER_ID = "sunflowerbiii/infi-check-qwen25-7b-qlora-c" # Load with 4-bit quantization bnb_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True, ) tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True) base_model = AutoModelForCausalLM.from_pretrained( BASE_MODEL, quantization_config=bnb_config, device_map="auto", trust_remote_code=True ) model = PeftModel.from_pretrained(base_model, ADAPTER_ID) model.eval() # Build prompt document = "..." # Vietnamese news article summary = "..." # Summary sentence to verify instruction = ( "Your task is to evaluate a summary by comparing it to the original document " "and identifying any errors present in the summary.\n\n" "Possible error types:\n" "- Predicate Error, Entity Error, Circumstance Error\n" "- Co-reference Error, Discourse Link Error\n" "- Extrinsic Error\n\n" "For each error found, output:\n" "- Location: the erroneous sentence\n" "- Explanation: why it is wrong\n" "- Correction: corrected version\n" "- Error Type: one of the types above\n\n" "Write analysis in Vietnamese. End with: 'Therefore, the answer is YES.' or 'Therefore, the answer is NO.'\n\n" f"Document:\n{document}\n\nSummary:\n{summary}" ) prompt = f"<|im_start|>user\n{instruction}<|im_end|>\n<|im_start|>assistant\n" im_end_id = tokenizer.convert_tokens_to_ids("<|im_end|>") eot_id = tokenizer.convert_tokens_to_ids("<|endoftext|>") inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=2048).to(model.device) with torch.no_grad(): output_ids = model.generate( **inputs, max_new_tokens=1024, do_sample=False, repetition_penalty=1.1, eos_token_id=[im_end_id, eot_id], pad_token_id=eot_id, ) gen_ids = output_ids[0][inputs["input_ids"].shape[1]:] print(tokenizer.decode(gen_ids, skip_special_tokens=True)) ``` --- ## Citation ```bibtex @article{bai2026inficheck, title = {InFi-Check: Interpretable and Fine-Grained Fact-Checking of LLMs}, author = {Bai, Yuzhuo and Si, Shuzheng and Luo, Kangyang and Wang, Qingyi and Li, Wenhao and Chen, Gang and Qi, Fanchao and Sun, Maosong}, journal = {arXiv preprint arXiv:2601.06666}, year = {2026} } ```