Lune

ICML2026Top-tier venue

How Should Transformers Encode Numeric Values in Electronic Health Records?

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.

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · related work

Get the answer

Free to start. No credit card required.

Builds on6

  1. Revisiting Deep Learning Models for Tabular DataYury Gorishniy, Ivan Rubachev, Valentin Khrulkov, Artem BabenkoNeurIPS 2021 · 1,847 citations
  2. Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and InferenceBenjamin Warner, Antoine Chaffin, Benjamin Clavié, Orion Weller et al.ACL 2025 · 552 citations
  3. Transformers Can Do Arithmetic with the Right EmbeddingsSean McLeish, Arpit Bansal, Alex Stein, Neel Jain et al.NeurIPS 2024 · 94 citations
  4. MOTOR: A Time-to-Event Foundation Model For Structured Medical RecordsEthan Steinberg, Jason Alan Fries, Yizhe Xu, Nigam ShahICLR 2024 · 66 citations
  5. A step towards understanding why classification helps regressionSilvia L. Pintea, Yancong Lin, Jouke Dijkstra, Jan C. van GemertICCV 2023 · 17 citations

Related papers

  1. RNED: Rotary Number Encoding and Decoding for Quantitative Medical VLM AnalysisFengbei Liu, Sunwoo Kwak, Nusrat Binta Nizam, Ilan Richter et al.CVPR 2026
  2. CONE: Embeddings for Complex Numerical Data Preserving Unit and Variable SemanticsGyanendra Shrestha, Anna Pyayt, Michael N. GubanovSIGMOD 2026
  3. Counting in Small Transformers: The Delicate Interplay between Attention and Feed-Forward LayersFreya Behrens, Luca Biggio, Lenka ZdeborováICML 2025
  4. From Token to Token Pair: Efficient Prompt Compression for Large Language Models in Clinical PredictionMingcheng Zhu, Zhiyao Luo, Yu Liu, Tingting ZhuICML 2026
  5. TabularBERT: Binning-Based Self-Supervised Learning for Tabular RepresentationBeomjin Park, Seunghwan An, Sungchul Hong, Hosik ChoiICML 2026
Dusk over the sea between two cliffs drawn in fine vertical lines