Large language models as medical code selectors: a benchmark using the International Classification of Primary Care

Read full text
Authors: Vinicius Anjos de Almeida, Vinicius de Camargo, Raquel Gómez-Bravo, Kees van Boven, Egbert van der Haring, Marcelo Finger, Luis Fernández López
Cited by: 2
References: 20

Abstract

Objectives: Medical coding structures health-care data for research, quality monitoring, and policy. This study assesses the potential of large language models (LLMs) to assign International Classification of Primary Care, 2nd edition (ICPC-2) codes using the output of a domain-specific search engine. Materials and Methods: A dataset of 437 Brazilian Portuguese clinical expressions, each annotated with ICPC-2 codes, was used. A semantic search engine (OpenAI's text-embedding-3-large) retrieved candidates from 73 563 labeled concepts. Thirty-three LLMs were prompted with each query and retrieved results to select the best-matching ICPC-2 code. Performance was evaluated using F1-score, along with token usage, cost, response time, and format adherence. Results: Twenty-eight models achieved F1-score>0.8; 10 exceeded 0.85. Top performers included gpt-4.5-preview, o3, and gemini-2.5-pro. Retriever optimization can improve performance by up to 4 points. Most models returned valid codes in the expected format, with reduced hallucinations. Smaller models (

Fields of Study & Subjects

Machine Learning in Healthcare Medical Coding and Health Information Biomedical Text Mining and Ontologies

Publication details

Journal / source
JAMIA Open
Publisher
Oxford University Press (OUP)
Volume
9
Issue
1
Pages
ooag017–ooag017
Publication date
6 January 2026
Language
EN