Testing a Safety-Critical Matching Component of an LLM-Based Simulated Patient: Blind Test Sets, Overfitted Cut-offs and a Cascade
Abstract
Components that decide what an LLM application may say are ordinary software and need tests, but their correct behaviour is defined by meaning, so no specification lists their inputs. We report a case study of testing one such component: the matcher in Rapport, a spoken simulated psychiatric patient, which decides which of the patient's memories a student's question is about. If it misses a question about suicidal thoughts, plans or means, the code can let the patient deny something it should disclose. Of the 8 bugs logged during the simulator's evaluation, 4 were matching faults, including all 3 rated major; each was fixed by adding keywords and a regression test for one wording. We built the test oracle from the specification instead of the code: a blind test set of 512 doctor questions over four cases written from what each memory means by a writer that never saw the matching rules, split by checksum into tuning and test halves. On the test half, keyword tags found 35.1% of risk questions; the deployed hybrid of tags and a sentence encoder with 33 million parameters found 72.7% while wrongly matching 15.2% of non-risk questions. Five small encoders and BM25 gave overlapping threshold-free results (AUROC 0.86-0.91 for risk), so the encoder choice was not the bottleneck; the cut-off was. The 4-billion-parameter model that voices the patient, used zero-shot, found 94.8% of risk questions with 4.8% wrong matches, at a median of 416 ms per question; screening with the hybrid first kept 93.5% recall while sending 63% of questions to the model. On two further test sets written by other local models, the deployed rules found 58.9% and 47.5% of risk questions and the zero-shot model 87.7% and 91.5%: the first writer's test set flattered the component. The test sets, every method's output and a machine-checked trace of every reported number to the committed results are public.
Create a lesson
Metadata
- Categories
- cs.SE, cs.CL, cs.HC
Related papers
Beyond Static GUI Agent: Evolving LLM-based GUI Testing via Dynamic Memory
Shared title terminologycs.SEMengzhuo Chen, Zhe Liu, Chunyang Chen et al.
Who Checks the Model Checkers: Hardened Testing of TLA+ Tools
Shared title terminologycs.SEIgor Konnov
What Do Code Judges Add Beyond Public Tests and Generator Priors?
Shared title terminologycs.SETaleb Alhajji, Yonghong He
Test-Centric Code Generation: Enhancing Test Diversity, Reliability, and Utilization
Shared title terminologycs.SEChaohang Wen, Zhao Tian, Shiqi Kuang et al.
Standing on the Shoulders of Giants: Bug-Aware Automated GUI Testing via Retrieval Augmentation
Shared title terminologycs.SEMengzhuo Chen, Zhe Liu, Chunyang Chen et al.
Think Outside the Box: Automating Inter-App Functionality Testing via Memory Implanting and Reasoning
Shared title terminologycs.SEMengzhuo Chen, Zhe Liu, Chunyang Chen et al.