From 65a84655a97b2843aade22dbbd7665a99ec0a3a2 Mon Sep 17 00:00:00 2001 From: claude Date: Sat, 18 Jul 2026 14:42:30 +0200 Subject: [PATCH] docs(analyze): refresh DEFAULT_SYSTEM_PROMPT doc-comments after prompt swap The doc-comments still described the old permissive prompt (the c414cf52 sandbox validation, the "AKTIVE KORREKTUR" rationale, the old block layout). Rewrite them to describe the current "flag, don't guess" prompt and to note that DEFAULT_SYSTEM_PROMPT and LLAMA_SYSTEM_PROMPT are now content-identical. --- server/src/analyze/backend.rs | 37 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/server/src/analyze/backend.rs b/server/src/analyze/backend.rs index 077f6ba..f9077b5 100644 --- a/server/src/analyze/backend.rs +++ b/server/src/analyze/backend.rs @@ -42,26 +42,27 @@ const LLAMA_FORMAT_INSTRUCTION: &str = "AUSGABEFORMAT: Antworte ausschließlich /// Default system prompt for the consolidation LLM. Used by all backends /// unless overridden via `with_system_prompt`. /// -/// Sandbox-validated against case `c414cf52` (3 runs each, fair pipeline -/// with pre- and post-LLM gazetteer pass against the current vocab): -/// - eliminates two hallucination classes the previous prompt produced — -/// unmarked "Hypotonie" when the dictation said "Hypertonie" (0/3 vs 2/3), -/// and inventing a unit ("35 ng/l") for a dictated value without unit -/// (0/3 vs 2/3) -/// - keeps Latin terms intact ("Punctum Maximum", "Apex Cordis", "Axilla" -/// in 3/3 vs 2/3) -/// - relies on the gazetteer for drug-name correction (Enoxaparin etc.) — -/// the prompt no longer needs a separate "AKTIVE KORREKTUR" hammer-block -/// because the gazetteer's pre-LLM pass repairs typical typos before the -/// LLM ever sees them -/// - block layout: AUFGABE / QUELLE / KORREKTUR-POLITIK / TREUE / CHRONOLOGIE -/// / DOSIERUNGSSCHEMA / MARKIERUNGEN — each rule appears exactly once +/// This is the "flag, don't guess" prompt: the model keeps the dictated +/// (ASR) wording verbatim and only wraps uncertain stretches in `==...==` +/// for the doctor to check. It must never substitute a term with a guess, +/// drop a negation / finding / value, invert meaning, or invent facts — +/// term repair is delegated to the gazetteer's pre-LLM pass, so the prompt +/// stays purely about clinical fidelity. +/// +/// It replaced an earlier permissive prompt that let the model rewrite +/// terms and merely bracket the original — which, when the guess was wrong, +/// inverted meanings, deleted negations, or invented drugs/doses. A/B'd in +/// the experiments sandbox against 16 real alpha-test cases (full pipeline, +/// three runs each, independently judged): it cut the per-run dangerous-error +/// rate several-fold and eliminated the occasional empty-output run +/// (reasoning length-exhaustion) the old prompt produced. Content-identical +/// to [`LLAMA_SYSTEM_PROMPT`]. const DEFAULT_SYSTEM_PROMPT: &str = include_str!("../../prompts/default_system_prompt.md"); -/// Llama-specific system prompt. Currently identical to the default; kept -/// as a separate file so adjustments for Llama-3.1's behaviour (e.g. -/// stricter "do not hallucinate" wording) can be tuned independently of -/// gpt-oss without forking the default for everyone. +/// Llama system prompt. Content-identical to [`DEFAULT_SYSTEM_PROMPT`] — the +/// default was replaced by this same "flag, don't guess" prompt. Kept as a +/// separate file so Llama-3.1-specific wording can diverge later without +/// forking the default for everyone. const LLAMA_SYSTEM_PROMPT: &str = include_str!("../../prompts/llama_system_prompt.md"); #[derive(Debug)]