From bc7f4a67cb1fd03fadfc1d44eb97b17967b7623c Mon Sep 17 00:00:00 2001 From: Dotty Dotter Date: Wed, 8 Apr 2026 11:31:21 +0200 Subject: [PATCH] Analyzer prompt: strict citation rule against LLM hallucination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even after format_quotes_for_prompt was fixed to expose the fully-qualified programme name + page in each chunk, Qwen continued to hallucinate familiar source labels (typically "CDU Wahlprogramm NRW 2022") for parties whose actual MV/BE chunks were thematically off-topic for the Antrag at hand. The model preferred its training prior over the prompt context. Smoke test: MV Drucksache 8/6390 (CDU "Krisenmechanismus Kraftstoffpreise"). The CDU MV chunks the embedder retrieved were about Senioren and Aussenwirtschaft — not about energy prices — so qwen pulled what it knew about CDU NRW transport policy and wrote that as the source, even though the prompt listed only "CDU Mecklenburg-Vorpommern Wahlprogramm 2021" chunks. The new explicit ZITATEREGEL block in the user prompt forbids cross-Bundesland citations and instructs the model to leave zitate empty rather than fabricate when no listed chunk fits. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/analyzer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/analyzer.py b/app/analyzer.py index ef3d7aa..e9279b0 100644 --- a/app/analyzer.py +++ b/app/analyzer.py @@ -261,6 +261,15 @@ Bewerte nach GWÖ-Matrix 2.0 für Gemeinden: 4. Bis zu 3 Verbesserungsvorschläge in Redline-Syntax 5. Themen-Tags für Kategorisierung +**ZITATEREGEL — STRIKT:** In jedem ``wahlprogrammScores[].wahlprogramm.zitate[].quelle`` +und ``parteiprogrammScores[].parteiprogramm.zitate[].quelle`` musst du **wortgleich** +einen der oben in ```` aufgelisteten Quellen-Labels (Programm-Name + +Seite) übernehmen — z.B. ``"CDU Mecklenburg-Vorpommern Wahlprogramm 2021, S. 33"``. +Erfinde keine Quellen aus deinem Trainingswissen. Nimm keine Quelle aus einem anderen +Bundesland (z.B. NRW 2022) als die hier aufgelisteten — selbst wenn dir die dortigen +Programme bekannter sind. Findest du oben für eine Partei keinen passenden Chunk, lass +``zitate`` leer (``[]``) und vermerke das in der ``begruendung``. + Ausgabe als reines JSON ohne Markdown-Codeblöcke.""" # Retry loop for JSON parsing errors