Structuration Automatique de la Posologie en Français : Quel rôle pour les LLM s ? (2025)

Abstract: La structuration automatique de posologie est essentielle pour fiabiliser la médication et permettre une assistance à la prescription médicale. Les textes de prescriptions en français présentent très souvent des ambiguïtés, des variabilités syntaxiques, et des expressions colloquiales, ce qui limite l’efficacité des approches classiques de machine learning. Nous étudions ici l’emploi de Grands Modèles de Langages (LLM) pour structurer les textes de posologie en comparant des méthodes fondées sur le prompt-engineering et le fine-tuning de LLM avec un système “pré-LLM” fondé sur un algorithme de reconnaissance et liaison d’entités nommées (NERL). Nos résultats montrent que seuls les LLM fine-tunés atteignent la précision du modèle de référence. L’analyse des erreurs révèle une complémentarité des deux approches : notre NERL permet une structuration plus précise, mais les LLMs captent plus efficacement les nuances sémantiques. Ainsi, nous proposons le modèle hybride suivant : faire appel à un LLM en cas de faible confiance en la sortie du NERL (<0.8) selon notre propre score de confiance. Cette stratégie nous permet d’atteindre une précision de 91% tout en minimisant le temps de latence. Nos résultats suggèrent que cette approche hybride améliore la précision de la structuration de posologie tout en limitant le coût computationnel, ce qui en fait une solution scalable pour une application clinique en conditions réelles.

## introduction structuring posology instructions is essential for enhancing medication safety and enabling clinical applications, including decision support systems @xcite . in french prescriptions, posologies are frequently expressed in diverse, ambiguous, and sometimes colloquial language, which complicates their automatic structuration. traditional information extraction pipelines, typically based on named entity recognition (ner) and rule-based post-processing, offer reliable performance but struggle with linguistic variability and unexpected formulations @xcite . in contrast, large language models (llms) have recently shown strong potential for medical text understanding @xcite , though their application to specialized tasks like posology structuration remains largely unexplored. in this work, we investigate the use of llms to structure french posology instructions into standardized formats. we benchmark several open-source and proprietary llms using prompt engineering techniques such as chain-of-thought, few-shot, and contrastive prompting. to further improve performance, we apply lightweight fine-tuning on synthetic posology data. our results show that while prompt engineering narrows the gap, fine-tuning is necessary for llms to match the performance of our robust internal baseline (based on named entity recognition and linking, or nerl). through detailed error analysis, we highlight complementary strengths between rule-based systems and llms. finally, we propose a hybrid strategy that leverages model confidence scores to combine their outputs, offering a practical and efficient solution for real-world deployment. we summarize our contributions as follows : ## related work research on structuring clinical texts often begins with simpler tasks such as ner, which serves as a foundational step for more complex transformations, including the structuring of dosage instructions. named entity recognition in the medical domain ner is a core task in biomedical natural language processing (nlp), aiming to identify entities such as medications, dosages, symptoms, or diseases within clinical texts. over time, several approaches have been developed, each attempting to overcome the limitations of the previous ones. early methods were mainly based on handcrafted rules and domain-specific dictionaries. these systems typically relied on keyword selection and pattern-matching techniques to extract relevant terms from text @xcite . while they offered high precision in specific contexts, their recall was often limited, and they lacked adaptability. moreover, maintaining and updating these resources required significant effort and deep domain expertise (chen et al., 2020), making them difficult to scale across different datasets or languages. to address these issues, statistical machine learning models like hidden markov models (hmms) @xcite and conditional random fields (crfs) emerged @xcite @xcite . crfs, in particular, became widely used for sequence labeling tasks, as they modeled label dependencies and improved prediction consistency. in the french context, @xcite proposed a hybrid system combining crfs and handcrafted rules to extract numerical values from unstructured ehrs. their work highlighted challenges specific to the french language, such as ambiguous units and linguistic variability, emphasizing the need for language-specific approaches in biomedical nlp. however, they still depended heavily on feature engineering and struggled to capture long-distance relationships between tokens. a major shift came with the introduction of deep learning. long short-term memory (lstm) networks allowed models to retain information across longer sequences @xcite . their bidirectional versions, bilstms, further improved context modeling by processing text in both forward and backward directions @xcite . the combination of bilstm with crfs led to the well-known bilstm-crf architecture, which merged contextual encoding with structured prediction @xcite . this hybrid approach became a reference in the field, especially when combined with domain-adapted embeddings such as those trained on pubmed (e.g., word2vec or glove). however, the use of static embeddings still limited the model's ability to adapt to varying contexts. more recently, the use of self-attention mechanisms @xcite and transformer-based architectures has significantly improved performance in ner. unlike rnns, self-attention can model global dependencies in a single pass, making it especially well-suited for capturing the structure of clinical narratives. in this context, transformer-based models like bert @xcite and its biomedical variants have set new standards for medical ner. biobert @xcite , pretrained on large biomedical corpora, clinicalbert @xcite , fine-tuned on clinical notes (mimic-iii), and scispacy @xcite , built on pubmed articles, have all achieved state-of-the-art results. these models benefit from contextual embeddings tailored to biomedical language, drastically reducing the need for manual feature design and improving robustness in handling ambiguous or complex terms. using large language models (llms) for medical ner with the rise of general-purpose large language models (llms) like gpt-3.5 and gpt-4, researchers have started exploring their use for biomedical ner. @xcite evaluated gpt-3.5 and gpt-4 on two clinical ner tasks : identifying medical problems, tests, and treatments from clinical notes, and extracting adverse events from safety reports. under this setup, gpt-4 performance is close to those of domain-specific models like bioclinicalbert. to improve performance, some researchers have proposed adapting llms more explicitly to ner. for instance, wang et al. (2023) introduced gpt-ner, a framework that reframes ner as a text generation task. this allows the model to directly output labeled sequences, rather than relying on token classification. their results suggest that this generation-based formulation can be especially effective in low-resource scenarios, where annotated data is scarce. more recently, biana et al. (2024) presented vaner, a system built on top of llama2. it combines domain-specific instructions and external biomedical knowledge to improve entity recognition. vaner outperformed previous llm-based methods and even surpassed some traditional bioner baselines on multiple datasets. in parallel, naguib et al. (2024) conducted a large-scale evaluation of generative and masked llms for few-shot clinical ner across english, french, and spanish. their results show that while promptbased models perform well on general ner, they are outperformed in the clinical domain by lighter, fine-tuned models like bilstm-crf. overall, while general-purpose llms may not yet consistently outperform specialized models like bioclinicalbert, studies show that prompt engineering and hybrid strategies (e.g., adding domain knowledge) can significantly boost their effectiveness for clinical ner. structuring posology instructions : beyond ner while ner focuses on identifying relevant entities in text, dosage structuring advances further by transforming complex dosage instructions into structured formats (e.g., json), facilitating integration into clinical information systems. a key milestone in the structuration of medication-related data was the i2b2 medication challenge @xcite , which defined subtasks such as drug name, dosage, frequency, and route extraction. it remains a standard benchmark for evaluating medication information extraction systems, particularly in english clinical texts. so far, only a few studies have looked into applying llms to tackle related tasks. for instance, @xcite introduced rx strategist, a multi-agent llm pipeline augmented with knowledge graphs and search strategies to verify prescriptions by analyzing indications, dosages, and potential drug interactions. this approach achieved performance comparable to that of experienced pharmacists. similarly, @xcite investigated zero and few-shot ner and text expansion in medication prescriptions using chatgpt 3.5 and highlighting the potential of llms in handling varied and ambiguous language in prescriptions. silva & gomes (2025) developed an adaptive llm-based intelligent medication assistant aimed at supporting decision making in antidepressant prescriptions, demonstrating the utility of fine-tuned language models in clinical decision support workflows and emphasizing the importance of structured dosage information for clinical decision making. @xcite conducted a comparative evaluation of five approaches for extracting daily dosages, including parsing techniques, llms (gpt-4o), and the rule-based system rxsig, reporting slightly better performance with gpt-4o than with rxsig, along with notable differences in sensitivity and computational demands. these studies highlight the growing role of llms in transforming how posology instructions are interpreted and structured, offering richer and more flexible representations than traditional ner approaches. our work extends this research approach to french prescriptions, marking, to our knowledge, one of the first efforts to apply llms to the structured extraction of posology instructions. ## conclusion this work introduces medpososf , a novel dataset for evaluating the llms ability to convert raw textual french posology instructions into a structured format. this task is more challenging than standard ner, as it requires to generate a full json output rather than simply tagging spans of text. to address the limitations of both our nerl baseline and the llms on this task, we proposed a hybrid strategy that leverages a surrogate confidence score to combine their outputs, offering a practical and efficient solution for real-world deployment. our results also suggest that proprietary llms hosted on cloud platforms allow prompt engineering and fine-tuning with less computational resources and less engineering and they perform better than open-source models at comparable levels of latency. however, with more resources than for this work, future work could explore the possibility of using smaller llms with domain-specific data, like biomistral @xcite , and with guided generation @xcite to improve the performance of open-source models. -frequency_max : int (optional), an integer for the maximum amount fo intake for the given period (frequency is then the minimum) -number_repeats_allows : int (optional), the number of times the treatment can be renewed offset : str (optional), substring extracted from the query that indicates what is the offset of the intake ("30 minutes" in "30 minutes before meals") period : int, the number of period_unit to observe before repeating the intake (6 in "3 tablets every 6 hours") -period_unit : str, the time unit used for measuring the period between intakes ("hours" in "3 tablets every 6 hours") sequence : int (optional), when several posology instructions are given, sequence indicates their order -time_of_day : list (optional), indicates precise intake hours in the format hh :mm :ss. c dataset statistics statistics number of queries 129 number of posology instructions 131 minimum number of tokens 2 median number of tokens 9 maximum number of tokens 29 minimum number of occurrences of a json field 1 median number of occurrences of a json field 69 maximum number of occurrences of a json field 131 -hs posology_string: 0.5 à 1 cp au coucher si besoin