How Should Transformers Encode Numeric Values in Electronic Health Records?

AI in healthcare
Published: arXiv: 2607.01391v1
Authors

Maria Elkjær Montgomery Christian Igel Mikkel Odgaard Martin Sillesen Mads Nielsen

Abstract

How do we encode numeric values in transformer-based sequence processing, particularly in electronic health record (EHR) data? We systematically compare discrete, continuous, and hybrid value encoding strategies using synthetic arithmetic tasks embedded within real-world EHR data, as well as real-world clinical prediction tasks. Our study reveals trade-offs between numeric precision, optimisation stability, and architectural flexibility. We find that approaches that explicitly model value-concept interactions perform best on precision-sensitive arithmetic tasks when architectural constraints permit. Hybrid token-based approaches that retain numeric values but apply binning prior to projection provide a more robust and broadly applicable alternative, with the optimal number of bins following a simple empirically derived power-law in dataset size. Across tasks, models consistently exhibit reliable "good enough" numeric computation rather than exact arithmetic, while clinical gains from incorporating laboratory values are task-dependent. This suggests that robustness and deployability often outweigh maximal numeric precision in practice, motivating hybrid token-based approaches as a practical default.

Paper Summary

Problem
The main problem addressed in this research paper is how to effectively encode numeric values in transformer-based models, particularly in electronic health records (EHR) data. Current approaches often rely on structured categorical data, but continuous numeric data, such as laboratory test results, are underutilized and pose a challenge for transformer-based models.
Key Innovation
The researchers introduce a reusable test suite for systematically evaluating numeric value encodings in transformer-based EHR models. They compare discrete, continuous, and hybrid numeric value encodings, characterizing their trade-offs in numeric precision, optimization stability, and architectural flexibility. The key innovation lies in the development of a unified test suite that combines synthetic arithmetic tasks embedded in real EHR sequences with real-world clinical prediction tasks.
Practical Impact
This research has significant practical implications for the development of transformer-based EHR models. The findings suggest that approaches that explicitly model value-concept interactions provide a strong inductive bias for fine-grained numeric reasoning, while hybrid sequence-integrated approaches with binning offer a more robust and broadly applicable alternative. The results also highlight the importance of considering the trade-off between numeric precision and optimization stability in transformer-based models.
Analogy / Intuitive Explanation
Imagine trying to understand a patient's medical history by looking at a large dataset of lab results. If we simply treat each result as a categorical value (e.g., "normal" or "abnormal"), we may miss important patterns and relationships. However, if we can encode the numeric values in a way that captures their meaning and context (e.g., "elevated liver enzymes" or "low blood pressure"), we can gain a more nuanced understanding of the patient's health. This is the problem addressed by the researchers in this paper, who aim to develop more effective ways of encoding numeric values in transformer-based models.
Paper Information
Categories:
cs.LG cs.AI
Published Date:

arXiv ID:

2607.01391v1

Quick Actions