[KongchangAI]
· 1 min read· 825 words

TEA-Bench-BR: Can Coding Agents Turn Branching Clinical Guidelines into Correct Code?

TEA-Bench-BR: Can Coding Agents Turn Branching Clinical Guidelines into Correct Code?

TEA-Bench-BR reveals silent failures in coding agents codifying clinical rules, with model scale and language significantly affecting correctness.

TEA-Bench-BR is the first coding agent benchmark based on the Brazilian autism screening pathway, containing 144 tasks and 6,798 hidden cases across three levels: single scale, multi-specialty referral, and FHIR R4 export. Tests show the 31B model solves over 77% across all three levels, while the 12B model completely fails at the FHIR level. Language switching has a significant impact: when the same tasks are presented in English, the 31B model's third-level solve rate drops from 78.7% to 57.4%. For referral omission, the 12B model reaches 10.10% versus only 0.02% for the 31B model. The main failure mode is input validation rather than clinical decision-making. Contamination probing indicates results do not rely on training data memorization. The benchmark suggests that both model scale and language adaptation affect code correctness, and input validation is the weak point of current agents.

Coding agents are increasingly taking over rules written by domain experts, but defects in this kind of code are often silent: the program runs and returns results that look reasonable. TEA-Bench-BR is a benchmark built specifically to test this kind of "silent failure."

TEA-Bench-BR benchmark

The Unique Challenge of Codifying Clinical Guidelines

Unlike typical algorithm problems, clinical guidelines have complex branching, strict input validation, and outputs that must conform to industry standards. TEA-Bench-BR is built on the Brazilian early autism (TEA) screening pathway and includes three scales that structurally mimic real tools but with fictional content, a multi-specialty referral workflow, and a stage for exporting to FHIR R4 and national RNDS profiles—all specifications written in Portuguese.

This design means the task simultaneously involves clinical decision logic, input validation, and standardized data exchange, and an error in any one of these areas can lead to silently incorrect results.

FHIR (Fast Healthcare Interoperability Resources) is a healthcare data exchange standard developed by HL7, using modular resources (such as Patient and Observation) and a RESTful API design, aimed at solving interoperability between different systems. R4 is the currently widely adopted version. RNDS (Rede Nacional de Dados em Saúde) is Brazil's national health data network, built on the FHIR standard to integrate public health data nationwide. In this benchmark, requiring clinical rule outputs to be exported in a format compliant with FHIR R4 and RNDS profiles means the code must not only implement clinical logic but also ensure data structures and semantics conform to industry specifications—any field mapping or encoding error can cause silent failure.

Benchmark Design and Validation

The benchmark contains 144 tasks and 6,798 hidden test cases. Task parameters are sampled by a generator, and the hidden cases can kill all 1,955 non-equivalent mutants of the reference implementation, meaning the test set has strong discriminative power for code errors.

Multi-level Task Division

Tasks are divided into three levels: the first level targets a single scale, the second involves the referral workflow, and the third requires exporting data compliant with FHIR R4 and RNDS profiles. This layered design allows evaluation to pinpoint where an agent fails.

Mutation testing is a method for evaluating the effectiveness of a test set: by injecting artificial defects (mutants) into a reference implementation, it checks whether the test set can detect these defects. If the test set can "kill" all non-equivalent mutants (i.e., all injected defects are found), the test set has strong error discrimination ability. In this benchmark, the 6,798 hidden cases successfully killed all 1,955 non-equivalent mutants of the reference implementation, indicating that the test set can effectively capture various errors in code and thus reliably evaluate whether agent-generated code is correct.

Agent Performance: The Dual Impact of Scale and Language

Using Gemma 4 as the agent for testing, the results revealed significant effects of model scale and task language on performance.

Model Scale Differences

The 12B model solved 38.0% of the single-scale tasks but had no successes at the FHIR level. The 31B model achieved solve rates of 77.8%, 85.2%, and 78.7% across the three levels, respectively, and passed over 99% of the hidden cases. Interestingly, most of the 31B model's remaining failures occurred in input validation rather than in clinical decision-making itself.

The Impact of Language Switching

When the same tasks were presented in English, the 31B model's third-level solve rate dropped to 57.4%, because its code validated identifiers less frequently; the 12B model showed the opposite pattern, with higher validation frequency. This finding suggests that language context may change the behavioral patterns of models when generating code.

Referral Omission Rate

Among cases requiring referral, the 12B model missed 10.10% of cases, while the 31B model missed only 0.02%. This gap has practical significance in clinical settings.

Contamination Probing and Implications

The study also conducted contamination probing: on a modified PHQ-9 scale, no errors resulting from following the original rules were found. This suggests that the benchmark results are unlikely to stem from memorization of training data.

For teams building clinical decision support systems, this benchmark delivers a clear signal: both model scale and language adaptation significantly affect code correctness, and input validation is the weak point of current agents. Before codifying rules, targeted testing for the target language and validation logic is more practical than simply pursuing larger models.

Key Takeaways

  • TEA-Bench-BR is the first coding agent benchmark based on the Brazilian autism screening pathway, covering multi-specialty referral and FHIR R4 export.
  • The 31B model achieved solve rates above 77% across all three levels, while the 12B model completely failed at the FHIR level.
  • When the same tasks were switched to English, the 31B model's third-level solve rate dropped from 78.7% to 57.4%.
  • The 31B model's omission rate on referral cases was only 0.02%, compared with 10.10% for the 12B model.
  • The primary failure mode of agents is input validation, not clinical decision logic.
#TEA-Bench-BR#coding agents#clinical guidelines#FHIR R4#benchmark#input validation
Share:

Related articles