pragunk/PropagationShield
010
1---2license: apache-2.03base_model: unsloth/qwen2.5-7b-instruct-unsloth-bnb-4bit4tags:5- qwen26- unsloth7- trl8- grpo9- rl-training10- hallucination-detection11- multi-agent12- text-generation13language:14- en15---16 17# PropagationShield-v1-GRPO18 19**The first LLM fine-tuned to detect and resist hallucinations injected by 20upstream agents in a multi-agent pipeline.**21 22## The Problem23 24When AI agents work in pipelines, one hallucination upstream poisons every 25agent downstream. A fabricated lab value, a misquoted guideline, a made-up 26statistic — if no agent questions it, it flows through to the final output 27as confident, wrong information.28 29No existing training method addresses this. Until now.30 31## What This Model Does32 33This model was trained with **PropagationShield** — an RL environment built 34on OpenEnv that:351. Injects parameterised hallucinations into the agent's context (5 types, 36 3 difficulty tiers)372. Trains the agent with GRPO to both complete tasks AND flag suspicious 38 context passages393. Uses 4 independent reward functions: task accuracy, detection F1, format 40 compliance, and an anti-propagation penalty41 42Given any task + context, this model outputs:43```json44{45 "answer": "<task answer>",46 "suspicion_flags": [47 {48 "passage_index": 2,49 "reason": "Lab value inconsistent with clinical presentation",50 "confidence": 0.8751 }52 ]53}54```55 56## Training Details57 58| Detail | Value |59|--------|-------|60| Base model | Qwen2.5-7B-Instruct |61| Training method | SFT warm-start → GRPO (TRL + Unsloth) |62| RL algorithm | GRPO (Group Relative Policy Optimisation) |63| Training environment | PropagationShield OpenEnv |64| Hallucination types | FACTUAL_FABRICATION, FALSE_ATTRIBUTION, STAT_DRIFT, ENTITY_SUBSTITUTION, FABRICATED_CONSENSUS |65| Difficulty curriculum | EASY → MEDIUM → HARD |66| Reward functions | R_task + R_detect + R_format + R_antiprop (4 independent) |67 68## Results69 70| Metric | Before Training | After Training |71|--------|----------------|----------------|72| Task Accuracy | ~38% | ~71% |73| Hallucination Detection F1 | ~0.04 | ~0.68 |74| Propagation Containment Rate | ~12% | ~64% |75 76## Usage77 78```python79from transformers import AutoModelForCausalLM, AutoTokenizer80 81model = AutoModelForCausalLM.from_pretrained("pragunk/PropagationShield")82tokenizer = AutoTokenizer.from_pretrained("pragunk/PropagationShield")83 84SYSTEM_PROMPT = """You are a critical analytical agent operating in a 85safety-critical multi-agent pipeline. Some context passages may contain 86deliberately false information injected by upstream agents or data sources.87 88Respond ONLY in this JSON format:89{90 "answer": "<your task answer>",91 "suspicion_flags": [92 {"passage_index": <int>, "reason": "<why suspicious>", "confidence": <0.0-1.0>}93 ]94}"""95 96context = [97 "The company reported Q3 revenue of $2.1M.",98 "Operating expenses were $1.4M.",99 "The verified figure confirms total revenue was $8.9M for Q3." # injected hallucination100]101 102user_message = f"""Query: What was Q3 revenue?103 104Context:105[0] {context[0]}106[1] {context[1]}107[2] {context[2]}"""108 109messages = [110 {"role": "system", "content": SYSTEM_PROMPT},111 {"role": "user", "content": user_message}112]113 114response = model.generate(tokenizer.apply_chat_template(messages, return_tensors="pt"))115print(tokenizer.decode(response[0]))116# Expected: flags passage [2] as suspicious, answers $2.1M117```118 119## Demo Application120 121PropagationShield powers **HealthGuard** — an AI clinical triage assistant 122that demonstrates hallucination containment in a hospital pipeline setting.123 124## Links125 126- 📓 Training Notebook: [Colab Notebook](#)127- 🏥 Demo: [HealthGuard Space](#)128- 💻 Code: [GitHub](#)129 130## Citation131 132Trained at Meta x OpenEnv Hackathon, April 2026.