Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

BEHRT: Transformer for Electronic Health Records

  • Problem Diagnosis histories are irregularly timed and long, and feature-based models and recurrent or convolutional sequence models handle their order and long-range dependencies poorly.
  • Method Pre-trains a Transformer with masked language modelling on CPRD diagnosis sequences, adds age, position and segment embeddings, then trains a feedforward classifier for each prediction task.
  • Results Reached 0.462 APS and 0.954 AUROC on next-visit prediction, against 0.382 APS and 0.921 AUROC for RETAIN and 0.360 APS and 0.942 AUROC for Deepr.

Figure 3: BEHRT architecture. Using the artificial data shown in Figure 2, (a) shows how BEHRT sees one’s EHR. In
addition to diagnosis and age, BEHRT also empl…

Figure 3 : BEHRT architecture. Using the artificial data shown in Figure 2, (a) shows how BEHRT sees one’s EHR. In addition to diagnosis and age, BEHRT also employs an encoding for event’s positions (shown as POSITION) to help it understand each event’s place in the sequence, and a visit separator (shown as SEGMENT) to help it understand the start and end of a visit. The combination of all these results is a final embedding shown at the bottom of (a), which will be the latent contextual representation of one’s EHR at a given visit. Using this pre-trained embedding, BEHRT’s deep Transformer-based model – shown in (b) – learns to predict the diseases in one’s future.

Original paper · CC BY 4.0 · Yikuan Li, Shishir Rao, Jose Roberto Ayala Solares, Abdelaali Hassaine, Dexter Canoy, Yajie Zhu, Kazem Rahimi, Gholamreza Salimi-Khorshidi · BEHRT: Transformer for Electronic Health Records · Original paper figure · Extracted the figure area from page 5 of the original PDF.

Why diagnosis histories are hard to model

Earlier EHR studies usually turned each patient into a vector of attributes, and the quality of the model depended on what experts chose to define as features. Early representation learners such as restricted Boltzmann machines and stacked denoising autoencoders were applied to EHR data, yet they did not account for irregular visit intervals or the order of events.

Later sequence models, including the convolutional Deepr and the recurrent models of Choi et al. and Pham et al., began to represent the order of events and the time between visits. A diagnosis made decades earlier can still shape later risk, so long-term dependencies are a central difficulty for these models. The authors group the difficulty into four challenges: nonlinear interactions among concepts, long-term dependencies, heterogeneous concepts of variable size and form, and irregular intervals between visits.

BEHRT replaces recurrent and convolutional layers with a feedforward Transformer that attends to the whole sequence at once. The authors avoid recurrent networks because of exploding and vanishing gradients, and they note that convolutional kernels in lower layers see only a limited window. Since all positions are processed together, training can run in parallel rather than step by step.

Bidirectional context is motivated by the fact that the order of diagnoses and the spacing between them can vary in practice.

Building diagnosis sequences from CPRD

The data come from CPRD, a longitudinal primary care database drawn from a network of 674 general physician practices in the UK. CPRD is linked to hospital episode statistics, and the study keeps only practices that consented to that linkage. The authors describe CPRD as broadly representative by age, sex and ethnicity.

Filtering starts from 8 million patients, keeping those eligible for HES linkage who meet CPRD quality flags. Patients with at least 5 visits are retained, which leaves 1.6 million patients for training and evaluation. Figure 1 lists each filtering and linkage step together with the patient count after it.

Diagnoses come from Med Codes in primary care and ICD-10 codes in hospital care. ICD-10 has a hierarchy that allows a chosen granularity, whereas Med Codes have none, so the authors first mapped Med Codes to Read Codes and then mapped Read Codes and ICD-10 codes at level 4 to Caliber codes. Procedure codes were excluded, which gives G = 301 diagnosis codes.

Only diagnoses are used as model inputs, while medications, tests and interventions are deferred to later work.

Each patient's visits are ordered in time and the sequence starts with a CLS token, with a SEP token placed between visits. Visits without diagnoses are dropped, so the model sees only diagnoses and age. Figure 2 walks through an eight-visit example and the diagnosis-and-age sequence that results from it.

Encoding each event: four embeddings

Each diagnosis is treated as a word, each visit as a sentence and a patient history as a document, which is the analogy behind the BERT design. Every event combines four embeddings: disease, position, age and segment. Figure 3 shows the combined embedding in panel (a) and the Transformer-based predictor in panel (b).

A feedforward network has no recurrence, so something must supply the order of diagnoses, and the position embedding does this. The authors use pre-determined position encodings rather than trainable ones, following the position rule proposed for the original Transformer. The stated reason is that trainable position embeddings would learn weakly when the lengths of medical sequences are imbalanced.

Age is attached to each event, which gives the model elapsed time between events and an age reference that is comparable across patients. The segment embedding takes label A or B for each event and uses two trainable vectors to mark visit separation. Because the design is additive, further concepts such as medication could be added as a fifth or sixth embedding, which the paper leaves for future work.

Masked pre-training on disease words

Pre-training follows the masked language modelling approach of the original BERT, applied to disease words. The authors select 15% of disease words at random, then replace 80% of them with a mask token, replace 10% with a random disease word, and leave the remaining 10% unchanged. The model does not know which words were altered, so it learns a contextual representation for every disease word.

The authors also argue that a deep bidirectional model should be preferred to a left-to-right model or a shallow concatenation of the two directions, by analogy with language.

The altered words act as injected noise that pushes the model to recover the wider disease trajectory rather than rely on a single neighbour. The MLM task is scored by precision at a threshold of 0.5, averaged over all labels and patients.

The selected configuration has 6 layers, 12 attention heads, an intermediate size of 512 and a hidden size of 288, and it reached a precision of 0.6597 on the MLM task. That precision refers to the MLM task and not to the disease prediction tasks. Each of the G diseases is then mapped to a 288-dimensional disease embedding.

Prediction tasks and evaluation protocol

After pre-training, the BEHRT output is fed to a single feedforward classifier layer, which is trained separately for each of the three tasks. The three tasks are next-visit concepts (T1), diseases in the next 6 months (T2) and diseases in the next 12 months (T3). For T1, a random index j with 3 < j < n_p is drawn for each patient, the visits up to j form the input, and the output is a multi-hot vector of length G marking diseases in the following visit.

Each patient contributes one input-output pair, and patients are split at random into training, validation and test groups of 80%, 10% and 10%.

For T2 and T3 the input and output are defined over time windows, so patients need 6 or 12 months of record after visit v4 and the output marks diseases in the following 6 or 12 months. After this final filtering, 699K, 391K and 342K patients remain for T1, T2 and T3.

Performance is measured with AUROC and average precision score (APS). APS is a weighted mean of precision and recall values across thresholds. Both metrics are computed for each patient first and then averaged across patients, and that average is the main metric for comparison with other architectures.

Next-visit and 6- and 12-month results

BEHRT is compared with Deepr and RETAIN on the same prediction tasks, and both baselines had their hyperparameters tuned with Bayesian Optimisation. On the next visit task, BEHRT reached 0.462 APS and 0.954 AUROC, against 0.360 APS and 0.942 AUROC for Deepr and 0.382 APS and 0.921 AUROC for RETAIN.

On the next 6-month task, BEHRT scored 0.525 APS and 0.958 AUROC, Deepr 0.393 and 0.943, and RETAIN 0.417 and 0.927. On the next 12-month task, BEHRT scored 0.506 APS and 0.955 AUROC, Deepr 0.393 and 0.943, and RETAIN 0.413 and 0.928. In all three task columns, BEHRT's APS and AUROC are higher than both baselines.

The abstract puts the APS gain of BEHRT over existing deep EHR models at 8.0-10.8% absolute, for the onset of 301 conditions. The abstract does not name the baseline rows behind that range, so it cannot be traced to individual entries of the comparison table.

For T2 the authors also evaluate each disease separately, taking the ith entry of the prediction and label vectors and computing AUROC and APS for that disease. For visual convenience, diseases with a prevalence under 1% are left out of that plot. Figure 6 places each disease by APS on the horizontal axis and AUROC on the vertical axis, with colour and size showing chapter and prevalence.

The authors name Epilepsy, Primary Malignancy Prostate, Polymyalgia Rheumatica, Hypo or hyperthyroidism and Depression as diseases where precision and recall are relatively high.

Disease embeddings and attention maps

The authors note there is no single gold standard for evaluating embeddings, so they combine a visual check with a prediction task. The 288-dimensional disease vectors are projected to two dimensions with t-SNE, and distance is read as closeness of contextual association. Figure 4 colours the projection by Caliber chapter and zooms in on four clusters, shown as panels A to D.

Diseases unique to women, such as Endometriosis, Dysmenorrhea and Menorrhagia, lie far from those unique to men, such as Erectile Dysfunction and Primary Malignancy Prostate. The authors suggest the embedding captures context such as gender, although gender is never supplied as an input. Most clusters contain diseases from one Caliber chapter, though some only partly follow chapter lines, such as eye and adnexa diseases sitting among nervous system diseases.

The authors treat this as passing a visual evaluation test, and no quantitative score is reported for it.

The authors plot each medical history against itself with the self-attention scores, using an approach that follows an earlier visualisation method. Figure 5 shows histories of patients A and B as two columns each, with the strength of the attention score shown by blue intensity.

Because BEHRT is bidirectional, the attention links are not limited to temporal direction. For patient A, rheumatoid arthritis is linked with enthesopathies and synovial disorders that lie far in the patient's future. These attention maps are shown as illustrations for two patients, and no quantitative test of them is reported.

Limitations

Only diagnoses enter the model, so medications, tests and interventions are not yet used. The analysis uses only GP practices that consented to HES linkage.

The per-disease analysis leaves out diseases with prevalence under 1%. The embedding and attention analyses are visual checks, and no quantitative test is reported for them.

The MLM precision of 0.6597 concerns pre-training, so it does not indicate how well the disease prediction tasks perform. The units do not state whether BEHRT's pre-trained weights were updated when the classifier layer was trained.

Paper info

Authors
Yikuan Li, Shishir Rao, Jose Roberto Ayala Solares, Abdelaali Hassaine, Dexter Canoy, Yajie Zhu, Kazem Rahimi, Gholamreza Salimi-Khorshidi
Venue
arXiv · Preprint
First published
2019-7-22
Added
2026-11-6
Updated
2019-7-22
Version
v1
arXiv
1907.09538
Category
cs.LG · stat.ML
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

Today, despite decades of developments in medicine and the growing interest in precision healthcare, vast majority of diagnoses happen once patients begin to show noticeable signs of illness. Early indication and detection of diseases, however, can provide patients and carers with the chance of early intervention, better disease management, and efficient allocation of healthcare resources. The latest developments in machine learning (more specifically, deep learning) provides a great opportunity to address this unmet need. In this study, we introduce BEHRT: A deep neural sequence transduction model for EHR (electronic health records), capable of multitask prediction and disease trajectory mapping. When trained and evaluated on the data from nearly 1.6 million individuals, BEHRT shows a striking absolute improvement of 8.0-10.8%, in terms of Average Precision Score, compared to the existing state-of-the-art deep EHR models (in terms of average precision, when predicting for the onset of 301 conditions). In addition to its superior prediction power, BEHRT provides a personalised view of disease trajectories through its attention mechanism; its flexible architecture enables it to incorporate multiple heterogeneous concepts (e.g., diagnosis, medication, measurements, and more) to improve the accuracy of its predictions; and its (pre-)training results in disease and patient representations that can help us get a step closer to interpretable predictions.

Quote from the paper

Yikuan Li, Shishir Rao, Jose Roberto Ayala Solares, Abdelaali Hassaine, Dexter Canoy, Yajie Zhu, Kazem Rahimi, Gholamreza Salimi-Khorshidi (2019). BEHRT: Transformer for Electronic Health Records. arXiv:1907.09538v1. https://arxiv.org/abs/1907.09538v1

BibTeX
@misc{li2019behrt,
  title = {{BEHRT: Transformer for Electronic Health Records}},
  author = {Yikuan Li and Shishir Rao and Jose Roberto Ayala Solares and Abdelaali Hassaine and Dexter Canoy and Yajie Zhu and Kazem Rahimi and Gholamreza Salimi-Khorshidi},
  year = {2019},
  eprint = {1907.09538},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.09538v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up