Skip to content

MedLean: a small step toward reviving formalized medical verification as a safety world model in the MLLM eraMedLean: A Modest Step Toward Reviving Formal Medical Verification as a Safety World Model in the Era of MLLMs

Zhihao Tang, Chao Li, Jun Zhao
Tsinghua University; JD Health International Inc.
arXiv: 其他 AI 安全论文arXiv:2612.06157Originally published Indexed by this site · 2 days agoDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose MedLean, using Lean 4 to verify oncology treatment plans; on 428 synthetic cases, high-risk pass-through for both models dropped to 0.

Threat modelThe defense target is the structured diagnosis and treatment plan proposed by the LLM: it may permit contraindicated or evidence-unsupported treatment and omit mandatory clinical duties. MedLean verifies all rules before release, records missing evidence as unk rather than negative, allows at most two revision rounds, and finally releases through a deterministic safety filter.

Questions
Traditional formal medical verification has heavy coding and record-extraction burdens and produces hard-to-read outputs; recent language-model hybrid systems mostly verify only a single rule or a single action, making it difficult to handle missing tests, omitted duties, and complete plan revision.
Methods
MedLean offline compiles four oncology guidelines into Lean 4 rules and audits the full space with Z3; online it verifies the entire plan with three-valued evidence semantics, providing structured revision feedback, an exact certification reward, and pre-release safety filtering.
Experiments and results
On 428 synthetic cases, after MedLean both models had 0 high-risk releases in each cohort, and all mandatory duties were completed; Main certification was 299/300 and 300/300, respectively. Binary rules harm duty completion, and the exact gate did not let through any harmful plan in the 50-pair stress test.
Limitations and future work
The authors note that all cases are structured synthetic vignettes, that raw record extraction errors were not evaluated, and that no real-patient efficacy validation or independent blinded review by oncology experts was conducted; end-to-end RLVF weight updates remain future work, and the rules cover only four lung cancer and gastric cancer guidelines.
Experimental setupDeepSeek-V4.1-Flash、GPT-6.2-Astra · 428 fixed synthetic cases(Main、Expanded、New-Gap)、v4 guideline library(NCCN NSCLC v5.2026、NCCN SCLC v2.2026、CSCO NSCLC 2026、CSCO Gastric Cancer 2026) et al. · Certification、Mandatory-duty completion et al.
AI summaryThe authors propose MedLean, a two-stage Lean 4 framework that treats formalized medical verification as an interactive safety world model for MLLMs, used to audit oncology diagnosis and treatment plans. The offline MedLean-Compiler compiles four NCCN and CSCO guidelines into 1,861 executable rules and uses Z3 for full-space auditing; the correctness of the online verification kernel MedLean-Verifier is proven by 23 machine-checked theorems; static auditing found 362 binary negative-default leaks and real contradictions in the published guidelines. On 428 multi-cancer cases, MedLean reduces high-risk passes by DeepSeek-V4.1-Flash and GPT-6.2-Astra to 0%, and raises the overall plan certification rate to 98.4% and 100%, respectively.

The authors propose MedLean, a two-stage Lean 4 framework that treats formalized medical verification as an interactive safety world model for MLLMs, used to audit oncology diagnosis and treatment plans. The offline MedLean-Compiler compiles four NCCN and CSCO guidelines into 1,861 executable rules and uses Z3 for full-space auditing; the correctness of the online verification kernel MedLean-Verifier is proven by 23 machine-checked theorems; static auditing found 362 binary negative-default leaks and real contradictions in the published guidelines. On 428 multi-cancer cases, MedLean reduces high-risk passes by DeepSeek-V4.1-Flash and GPT-6.2-Astra to 0%, and raises the overall plan certification rate to 98.4% and 100%, respectively.

Related events and news

1 events · 0 news mentions

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors attempt to turn formal medical verification into an interactive safety world model for MLLMs, auditing complete oncology diagnosis and treatment plans.

    Core question: Can MLLMs be used to revive formal medical verification and make it an interactive safety world model that checks complete diagnosis and treatment plans rather than only single recommendations?

    • Clinical setting and risks: The authors focus on multi-step clinical decision-making such as oncology, where a plan must simultaneously coordinate staging, tests, prior treatment, and safety exclusions; the authors state that MLLMs may still permit contraindicated treatment when tests are missing, or omit mandatory clinical duties.
    • Three obstacles of traditional tools: As summarized in the introduction, traditional formal tools have a heavy coding burden, tedious record extraction, and unreadable formal outputs, referring respectively to the burden of encoding guidelines and proofs, the burden of extracting unstructured medical records, and the difficulty for physicians to understand proof outputs.
    • Gaps in existing hybrid systems: The authors state that recent hybrid systems of language models with logic solvers or proof checkers mostly verify isolated rules, a single diagnostic impression, or a single proposed action, and do not handle unreported tests, omitted duties, and structured revision feedback.
    • Core design assumption: Patient records are often incomplete, so missing evidence cannot be defaulted to negative; at the same time, omitting a mandatory action already approved by rules may be as dangerous as prescribing a contraindicated drug. The authors accordingly adopt three-valued clinical states and whole-case verification.
    • Proposed system: MedLean includes an offline MedLean-Compiler and an online MedLean-Verifier, compiles four NCCN/CSCO guidelines into 1,861 Lean 4 rules, performs full-space static auditing with Z3, and uses 23 machine-checked theorems to support online verification, revision, and a {0,1} reward.
    • Protection boundary: The protected object is the structured plan P=(A,C) proposed by the LLM, where A is the proposed clinical action and C is the requested additional tests; the system checks unsafe actions, blind permits under missing evidence, omitted duties, and superfluous or missing tests, and filters before release. The paper does not set it as a defense against malicious attackers or prompt injection.
  2. What related research exists?

    Related work is divided into traditional guideline formalization, language-model hybrid verification, clinical information extraction, and Lean 4 verifiable feedback.

    Formalization of traditional clinical protocols and guidelines

    • Marcos et al. (2003), ten Teije et al. (2006), Hommersom et al. (2008): use formal methods to express, improve, or verify medical protocols and clinical practice guidelines; Hommersom et al. is included by the authors in the discussion of traditional tool usability barriers and the gap in complete plan verification.
    • Chen & de Roo (2007), Saxena et al. (2023): the former uses semantic web and proof techniques to reduce radiology order errors, and the latter proposes MediK, aimed at guideline-based clinical decision support. The introduction also summarizes the formalization of independent protocols such as neonatal, radiology orders, and pediatric sepsis.

    Hybrid systems of language models and formal logic

    • Basu et al. (2026): studies formal safety constraints for agentic clinical AI and proposes a whole-person longitudinal benchmark.
    • Singh et al. (2026), Gupta et al. (2026), Bressler (2026): respectively concern using formal verification to provide guarantees for clinical reasoning of vision-language models, using LLMs to automatically convert NICE guidelines into executable computational models, and a clinical rule prototype in which LLMs make judgments and Lean proves the logic. The authors state that these recent hybrid works still mainly verify isolated rules, diagnostic impressions, or single actions, and do not cover missing checks, omitted duties, and structured revision for complete plans.

    Clinical language models and information extraction

    • Singhal et al. (2023), Sellergren et al. (2025): respectively study large language models encoding clinical knowledge and MedGemma; the authors use them to illustrate that MLLMs/LLMs are participating in multi-specialty clinical reasoning and can assist in explaining symbolic diagnoses in plain language.
    • Agrawal et al. (2022): studies few-shot clinical information extraction with LLMs; the authors accordingly suggest that MLLMs can help convert unstructured clinical records into standardized inputs, but the online experiments in this paper do not evaluate this extraction step.

    Lean 4, verifiable feedback, and self-correction

    • de Moura & Ullrich (2021), Xin et al. (2024): respectively introduce the Lean 4 theorem prover and DeepSeek-Prover-V1.5; the authors regard exact proof checking in mathematics and RLVF as precedents for transferring formal verification to healthcare. Z3 is cited from de Moura & Bjørner (2008).
    • Huang et al. (2024): studies that LLMs cannot yet reliably self-correct reasoning; the authors use it after the feedback experiments to support the importance of external feedback.

    Experimental controls and data: the method controls are Direct LLM, Single-Claim, and Plain Rule, plus LLM-as-Judge, graded partial score, and Best-of-N reranking; the data are 428 fixed synthetic cases constructed by the authors and experiments on the v2/v3/v4 rule bases, not public benchmarks provided by the above works. The authors position their own work between two gaps: using MLLMs to lower the barrier to formalization, and then using a proven Lean 4 kernel to provide complete plan checking and deterministic rewards.

  3. How does the paper address this problem?

    MedLean connects offline guideline compilation with online closed-loop revision through three-valued evidence, full-rule scanning, and an exact certification gate.

    The overall approach separates guideline authoring from kernel proof: MedLean-Compiler generates and audits the rule base offline, while MedLean-Verifier online performs three-valued logic checks, structured revision, and deterministic release filtering on the model's entire plan. The proven functions are the code compiled into the native executable.

    Three-valued states and whole-case rule classification

    • Patient state maps each standard clinical fact key to E={⊤,⊥,unk}, denoting confirmed positive, confirmed negative, and unreported, respectively; unk preserves evidential uncertainty and is not forcibly converted to negative.
    • Each rule records its scope of applicability, positive preconditions, exclusions, action, whether it is a mandatory duty, alternative indication group, and guideline version, section, and page source. Exclusions are converted into negative guards that require explicit confirmation of their absence.
    • For every rule in the library, not only for actions proposed by the model, classify as notApplicable, blocked, approved, or deferred. deferred means at least one condition remains unk, so even if the model does not write a certain action, the system can detect omitted duties corresponding to approved rules.

    Multi-path release and exact certification

    • An action can be approved via multiple indication paths, but ungrouped independent safety exclusions remain a hard veto and cannot be overridden by another approved path.
    • For deferred duties, proposed actions, or consultation goals, requestedTestsWith deterministically selects the pending path requiring the fewest unrequested tests, and computes missing checks Mchk and extra checks Echk.
    • Certification requires all five violation sets to be simultaneously empty: Rcert=𝕀[U=∅∧ B=∅∧ O=∅∧ Mchk=∅∧ Echk=∅]. Here U is unsafe actions, B is blind release that can still be proposed but should be deferred due to missing checks, and O is omitted duties.
    • There is also a consultation certificate Rcons (consultationScore): in addition to Rcert=1, it requires that for each goal in T, a judgment of eligible, blocked, deferred, or not applicable be given with no duplicates, no omissions, no surprises, and no mismatches.

    Offline compilation, coverage accounting, and Z3 audit

    • Inputs are the upstream OCR parse path tables and flowcharts of four guidelines: NCCN NSCLC v5.2026, NCCN SCLC v2.2026, CSCO NSCLC 2026, CSCO Gastric Cancer 2026; 1,029 source records were normalized into declarative Lean 4 Rules.
    • Each record is labeled complete, partial, pending, or flow/index, rather than silently discarding ambiguous text; rules retain page anchors and can be deterministically rebuilt from SHA fingerprint inputs into 41 rule, mapping, and Lean source modules.
    • Z3 audits all reachable states over the three-valued domain, checking rule reachability, binary negative-default leakage, positive witnesses and exclusion safety, mutually exclusive options, and equivalence between the native implementation and an independent symbolic reference; the latter covers 107,338 input combinations. Counterexamples are used to fix rules before building the release binary.

    Proven kernel and online closed loop

    • RuleIR.lean, Verifier.lean, and Proofs.lean total approximately 410 lines of kernel and proof code; Proofs.lean contains 23 theorems, zero sorry, and no external axioms beyond the Lean standard core.
    • The five invariant classes are evidence soundness, whole-case completeness, veto and pathway dominance, exact-gate certification, and consultation accountability; full theorem names are in Table A1. The guarantee scope is limited to the encoded rule IR and structured input semantics.
    • Algorithm 1 starts from the same initial draft, scans all rules each round, and generates field-aligned feedback in five categories: keep_actions, add_actions, drop_actions, add_checks, drop_checks, rather than only rule IDs.
    • At most Kmax=2 revisions; stop after reaching exact certification or exhausting rounds. The final safety filter retains only allowed actions and returns the filtered plan, Rcert, and audit report, so the certification score and the final release plan are computed separately.
  4. What experiments did the paper conduct?

    The experiments cover static rule auditing, whole-plan verification of 428 cases, feedback and sampling ablations, and 50 pairs of reward-speculation stress tests.

    Experimental setup

    • Models tested: DeepSeek-V4.1-Flash uses no reasoning and zero temperature; GPT-6.2-Astra (abbreviated Astra in the table) uses low reasoning and API default temperature. Both have a 1,800 output tokens budget and at most two revisions, and for the same model and case, each method starts from the same draft.
    • Cases and cohorts: Under v4 there are 428 fixed synthetic cases in total. Main has 300 cases, of which 127 have duty cases and 77 have eligible targets; Expanded is 96/56/25, and New-Gap is 32/16/8. Main has 75 cases per scenario type, Expanded is used to improve balance across guidelines, and New-Gap checks new coding paths.
    • Method comparison: Direct LLM returns the draft; Single-Claim only filters proposed actions; Plain Rule treats missing facts as false; MedLean checks the complete plan and can request revisions. The certification of non-revision baselines is the same as Direct LLM.
    • Metric definitions: Certification scores the final proposal before release filtering; Duty, HR (blind releases in parentheses), and eligible-target coverage are measured on the post-filter release plan. Rev/ms is the average number of revisions and the cumulative Lean kernel time per case.
    • Diagnostic experiments: The feedback ablation uses 11 frozen v2 drafts; Best-of-N uses 100 v3 cases and DeepSeek; reward-hacking resistance uses 50 pairs of v3 harmful plans and matched valid controls. LLM-as-Judge is non-reasoning DeepSeek-V4.1-Flash, and the pass threshold for both judge and graded score is 0.8.
    • Repetition and human review: The paper does not report the number of random repetitions, confidence intervals, or statistical significance tests, nor does it report that these synthetic cases and trajectories underwent independent blinded oncologist review.

    Main results

    The table below is based on Table 2; Cert. is pre-filter certification, Duty is duty completion, the parentheses after HR are blind releases, and Target is eligible-target coverage. Each model is listed in full for each cohort.

    Swipe horizontally to read the table

    ModelCohortMethodCert.DutyHR (blind)Target
    DeepSeekMainDirect LLM0/30010/127161 (98)75/77
    DeepSeekMainSingle-Claim0/30010/1270 (0)75/77
    DeepSeekMainPlain Rule0/3008/1277 (7)75/77
    DeepSeekMainMedLean299/300127/1270 (0)71/77
    AstraMainDirect LLM23/30078/12721 (21)50/77
    AstraMainSingle-Claim23/30078/1270 (0)50/77
    AstraMainPlain Rule23/30049/1278 (8)50/77
    AstraMainMedLean300/300127/1270 (0)52/77
    • Remaining cohorts: In Table 2, MedLean's Cert. on Expanded is DeepSeek 95/96 and Astra 96/96, and on New-Gap is 27/32 and 32/32; both models complete all duties on both cohorts, and HR is 0 (0) for both. Target is Expanded 22/25 and 24/25, and New-Gap 7/8 and 5/8.
    • Authors' interpretation: The authors state that MedLean makes both models complete all mandatory duties and eliminates high-risk and blind releases, and certification is usually obtained after one revision; DeepSeek's uncertified proposals contain additional checks or unconfirmed actions. Although Single-Claim also avoids high-risk releases, duty completion remains at the Direct LLM level.
    • Exceptions and trade-offs: MedLean's Target is not always higher than Direct LLM, for example DeepSeek on Main and Astra on New-Gap; the authors relate this to base certification possibly rewarding conservative omissions and requiring consultation-target accountability, rather than equating base certification with target coverage.

    Binary defaults, scenario results, and static guideline audit

    • Duty cost of binary defaults: Plain Rule reduces the number of cases with all duties completed in five of the six model–cohort combinations, and the remaining combination ties at zero. The Figure 3(a) caption reports that on Astra, Plain Rule is lower than Direct LLM by 22.8, 35.7, and 43.8 percentage points on Main, Expanded, and New-Gap, respectively; the authors explain that filling missing findings as false eliminates the conditions that would otherwise trigger checks.
    • Per-scenario results: Among the four Main scenarios in Table 3, MedLean's Cert. for DeepSeek is Clean 74/75 and 75/75 for the other three; Astra is 75/75 for all four. Both models complete all duties in each scenario with HR 0/75; Direct LLM's DeepSeek has HR of 72/75 and 67/75 on Missing-Test and Exclusion-Trap, respectively.
    • Offline defects: 1,861 rules pass all clause tests, each rule is satisfiable, and they agree with an independent symbolic reference on 107,338 input combinations; however, the same library's binary defaults allow blind releases under 362 rules. Compilation also exposes conflicts within the CSCO gastric cancer guideline regarding the number of docetaxel cycles in JACCRO GC-07 and the size threshold for endoscopic treatment.

    Feedback, reranking, and exact gating

    • Feedback ablation: In Table 4, the old-style feedback that only lists rule IDs recovers duties 2/11 (18.2%) on DeepSeek's 11 frozen v2 drafts, while MedLean's structured feedback is 11/11 (100%); Astra is 11/11 for both. The main text states that the old feedback often causes DeepSeek to put mandatory actions in the checks field.
    • Best-of-N: On 100 v3 cases with DeepSeek, the first candidate's certification/duty/high-risk release is 1%/17.5%/49%, LLM-as-Judge (N=8) is 0%/22.5%/44%, and Lean-reward reranking (N=8) is 2%/2.5%/29%; the reference MedLean closed loop (v3/v4 Main) is 99.7%/100%/0%. The authors state that Lean reranking prefers sparse plans, trading reduced high-risk releases for omitted duties.
    • Reward-hacking resistance: Among 50 pairs of v3 samples, LLM-as-Judge misses harmful plans 7/50 (14%) and passes valid controls 10/50 (20%); graded partial score is 9/50 (18%) and 50/50 (100%), respectively; MedLean exact gate is 0/50 (0%) and 50/50 (100%), respectively. The Figure 3(b) caption also reports that in the empty-plan audit, the base gate passes 108/300 (36%) and the consultation gate passes 0/227 (0%).

    Other ablations and analyses

    • Guideline updates: Frozen v3 plans are rescored under the expanded v4 library, all existing Main and New-Gap certificates are preserved, and plans lacking new evidence are identified in Expanded (Section 4.4).
    • Runtime cost: MedLean's Rev/ms in Table 2 on Main is DeepSeek 1.07/1.32 and Astra 0.92/0.73; the main text summarizes that kernel verification in the v4 online cohort averages about one millisecond per case.
    • Formal examples: Appendix B gives three worked examples, illustrating respectively that a missing check defers an action, that an omitted duty makes the certificate zero, and that a base certificate does not imply consultation coverage; the corresponding kernel times are labeled 0.80 ms and 0.70 ms, and the third example has no labeled time.
  5. What are some points that can be further explored?

    The authors explicitly list six boundaries, including synthetic inputs, no expert blinded review, end-to-end RLVF not yet conducted, and specialty scope.

    Limitations and future directions noted by the authors

    • Structured synthetic inputs: Section 5 notes that the 428 online cases are all synthetic structured vignettes using standardized fact keys and standard action IDs, rather than raw free-text electronic medical records; upstream extraction errors from noisy clinical notes are not evaluated within the Lean kernel and remain an independent source of risk.
    • Public free-text benchmarks are outside the scope of inference: Section 5 notes that free-text public exam and vignette benchmarks may omit clinical details or use old answers inconsistent with 2026 guidelines, are outside the scope of this structured-input verification, and cannot be inferred to improve solely from the synthetic guideline-compliance gains.
    • Clinical validity and expert review: Section 5 notes that conforming to encoded guidelines does not equal real-patient clinical efficacy; the rule base and synthetic trajectories have not yet undergone independent blinded review by board-certified oncologists.
    • RLVF has not yet been trained end-to-end: Section 5 notes that what is currently validated is the exact {0,1} RLVF reward environment and at most two rounds of test-time closed-loop correction; end-to-end reinforcement learning weight updates using the MedLean reward remain future work.
    • Some source records cannot be generically encoded: Section 5 notes that 143 of the 1,029 source records remain partial or pending because they involve individual patient anatomy, preferences, sequential toxicity history, or hospital SOPs and require local institutional encoding.
    • Specialty and temporal semantic extension: Section 5 notes that the current rules cover only four lung cancer and gastric cancer guidelines; generalizing to multi-specialty multimorbidity and temporal longitudinal state transitions requires richer time-indexed formal semantics.

    Scope of experimental coverage

    • Models and generation settings: the online tested models are two: DeepSeek-V4.1-Flash and GPT-6.2-Astra; the two differ in reasoning and temperature settings, and the authors state that the comparison reflects the models and their reasoning settings (Section 4.1).
    • Case and rule scope: the experiments use 428 fixed synthetic cases and four 2026-version NCCN/CSCO lung cancer and gastric cancer guidelines; Main, Expanded, and New-Gap are 300, 96, and 32 cases, respectively (Table 1, Table 2).
    • Controls and diagnostic experiments: whole-plan controls include Direct LLM, Single-Claim, and Plain Rule; there are also an 11-draft v2 feedback ablation, a 100-case v3 Best-of-N, and a 50-pair v3 anti-reward-speculation test (Table 4).
    • Proof and checking scope: the 23 theorems target the encoded rule IR and structured input semantics, and the Z3 equivalence check covers 107,338 input combinations; the paper does not report the number of repeated runs or statistical significance tests for the online results (Section 3, Section 4).
    • Reward validation stage: the experiments validate test-time gating, closed-loop revision, and the reward environment; end-to-end reinforcement learning weight updates are not reported as completed experiments (Section 5).
  6. Summarize the main content of the paper

    MedLean uses a provable Lean 4 kernel for whole oncology plan gating and quantifies the safety gains and the duty and coverage trade-offs.

    MedLean is a two-stage formal verification system for oncology diagnosis and treatment, whose goal is to extend traditional guideline formalization from isolated rule checking to an interactive safety world model for MLLMs. The authors focus on two types of plan errors: permitting treatment when evidence is missing, and the model omitting mandatory duties already supported by guideline rules.

    • Method core: An offline compiler organizes 1,029 source records from four NCCN/CSCO guidelines into 1,861 page-anchored Lean 4 rules, and uses Z3 to audit all reachable evidence states; the online kernel scans all rules with three-valued semantics ⊤, ⊥, unk, handling multi-path approval and independent safety vetoes.
    • Closed-loop gating: The system generates structured feedback from five sets—unsafe actions, blind permits, omitted duties, missing tests, and superfluous tests—with at most two revision rounds; only when all five sets are empty is Rcert=1 given, and final release also passes through a deterministic safety filter. 23 machine-checked theorems cover evidence, whole-case integrity, vetoes, certification, and consultation accountability.
    • Main experimental results: On the Main 300 cases in Table 2, DeepSeek-V4.1-Flash's Direct LLM high-risk permits were 161/300 and duty completion 10/127; after MedLean these were 0/300 and 127/127, with certification 299/300; GPT-6.2-Astra correspondingly changed from 21/300 and 78/127 to 0/300 and 127/127, with certification 300/300.
    • Cross-cohort and exceptions: In Expanded and New-Gap, both models after MedLean also completed all duties and had 0 high-risk permits; however, eligible target coverage did not always improve—for example, Main's DeepSeek changed from 75/77 under Direct LLM to 71/77 under MedLean. The authors accordingly distinguish basic certification from consultation target accountability.
    • Diagnostic findings: Static auditing found that a binary negative default would permit blind permits under 362 rules; Plain Rule reduced duty completion in five of six model–cohort combinations. In 50 pairs of v3 stress tests, the exact gate missed harmful plans 0/50 and passed valid controls 50/50, whereas LLM-as-Judge was 7/50 and 10/50 respectively (Table 4).
    • Authors' conclusion: The authors state that MedLean provides a foundation for test-time verifiable clinical plans and future rule-driven RLVF, while exposing trade-offs among binary-engine duty loss, model conservative omission, and exact gating's resistance to reward speculation. Their conclusions are limited to structured synthetic cases and already-encoded guidelines; real-patient efficacy, independent expert blinded review, upstream record extraction, and end-to-end RLVF training remain unanswered by these experiments.

Research lineage

Connected via shared benchmarks in library
Explore in knowledge graph →
Read originalarxiv.org