논문 해설
BEHRT: Transformer for Electronic Health Records
BEHRT: 전자 건강 기록을 위한 트랜스포머
- 연구 문제 BEHRT는 CPRD의 진단 시퀀스를 Transformer 구조로 학습해 향후 질병 발생을 예측하는 모델입니다.
- 연구 방법 환자의 방문 기록을 CLS와 SEP가 포함된 시퀀스로 만들고, 질병 위치 나이 세그먼트의 네 임베딩을 결합하여 MLM pre-training 후 다중 질병 예측에 미세조정합니다.
- 주요 결과 표 1에서 BEHRT는 다음 방문 과제에서 APS 0.462, AUROC 0.954를 보여 Deepr과 RETAIN보다 높은 점수를 보고합니다.
질병 발생 예측의 과제와 BEHRT의 목표
많은 질병은 환자에게 뚜렷한 증상이 나타난 뒤에야 진단됩니다. BEHRT는 이 문제를 줄이기 위해 환자의 과거 진료 기록으로 향후 질병 발생을 예측하는 모델로 제안됩니다. 이 논문은 EHR 데이터를 특징 공학으로 가공하던 기존 방식과 달리, 진단 시퀀스를 Transformer 구조에 직접 입력하는 접근을 택합니다. 기존 딥 EHR 모델로는 RETAIN과 Deepr이 비교 대상으로 쓰이며, BEHRT는 이 두 모델보다 높은 APS와 AUROC를 보고합니다. 이 연구의 범위는 CPRD의 진단 기록을 중심으로 한 다중 질병 예측입니다. 질병을 개별 모델로 따로 학습하는 대신 하나의 모델이 여러 질병을 동시에 예측하도록 설계되었습니다.
진단 시퀀스와 네 가지 임베딩의 결합
BEHRT는 환자별 방문 기록을 시간 순서대로 정렬한 뒤, 시작을 알리는 CLS 토큰과 방문 사이를 나누는 SEP 토큰을 넣어 하나의 시퀀스로 만듭니다. 이때 각 방문은 진단 목록이며, 진단은 단어처럼, 한 방문의 내용은 문장처럼, 환자의 전체 진료 이력은 문서처럼 대응됩니다. 입력 표현은 질병 임베딩, 위치 임베딩, 나이 임베딩, 세그먼트 임베딩의 합으로 구성됩니다. 위치 임베딩은 사전 정의된 인코딩을 사용하며, 피드포워드 구조에서 빠진 순서 정보를 보완합니다. 나이 임베딩은 각 진단이 발생한 나이를 알려 주고, 세그먼트 임베딩은 방문의 시작과 끝을 구분합니다. 이 구조는 원래 BERT의 NLP 입력에 없던 나이와 세그먼트를 추가한 것이 핵심 차이입니다.

Figure 2 : Preparation of CPRD data for BEHRT. An example patient’s EHR sequence can be seen in (a), which consists of 8 visits. In each visit, the record can consist of concepts such as diagnoses, medications and measurements; all these values are artificial and for illustration purposes. For this study, we are only interested in age and diagnoses. Therefore, as shown in at the bottom of the figure, we have taken only the diagnosis and age subset of the record to form the necessary sequences. This resulting sequence is what we represent every patient’s EHR as to our modelling process. Note that, the visits shown in purple boxes are not going to be represented to the model, due to them lacking diagnoses.
원문 · 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 · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.
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.
원문 · 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 · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.MLM pre-training과 피드포워드 구조의 선택
BEHRT는 BERT와 같은 방식으로 마스크 언어 모델 pre-training을 수행합니다. 질병 단어의 15%를 무작위로 골라 그중 80%는 마스크 토큰으로 바꾸고, 10%는 다른 무작위 질병으로 바꾸며, 나머지 10%는 그대로 둡니다. 모델은 어떤 단어가 가려졌는지 알 수 없으므로 모든 질병 단어에 대한 문맥 표현을 학습하게 됩니다. 이 설정은 다음 질병을 직접 맞히는 학습 이전에 질병 사이의 양방향 문맥을 익히게 하는 역할을 합니다. 구조 탐색에서는 6개 층, 12개 어텐션 헤드, 중간 층 크기 512, 은닉 크기 288이 선택되었고, 이때 MLM 정밀도는 0.6597입니다. 이 값은 pre-training 과제의 정밀도이며 이후 예측 과제의 성능과 같은 지표가 아닙니다.

Table 2 : MLM Hyperparameter Tuning
원문 · 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 · 원문 그림 인용 · 원본 PDF 13쪽에서 그림 영역을 추출했습니다.CPRD 자료 구축과 질병 정의
BEHRT의 자료는 영국 일차 진료 데이터인 CPRD에서 만들어졌으며, 병원 기록인 HES와 연결된 GP 진료소만 사용합니다. 전처리는 약 800만 명의 환자에서 시작해, HES 연결 조건과 CPRD 품질 기준을 만족하고 최소 5회 이상 방문 기록을 가진 환자만 남기는 과정을 거칩니다. 그 결과 최종 학습과 평가에 사용된 환자는 160만 명입니다. 질병은 일차 진료의 Med Code를 Read Code로 바꾸고, 병원의 ICD-10 코드와 함께 Caliber 코드로 매핑하여 정의합니다. 이 과정에서 Caliber 사전은 301개의 진단 코드를 구성하며, 이것이 모델의 출력 질병 집합이 됩니다.

Figure 1 : Linkage and filtering of CPRD data. This flow lists all the key steps of our data cleaning and linkage procedure. At each step, the number of patients that are included is shown.
원문 · 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 · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.예측 과제와 평가 지표
BEHRT는 세 가지 예측 과제를 다룹니다. 다음 방문의 개념을 예측하는 T1, 향후 6개월 안의 질병 발생을 예측하는 T2, 향후 12개월 안의 질병 발생을 예측하는 T3입니다. 환자는 학습, 검증, 시험 집합으로 80%, 10%, 10%씩 무작위로 나뉘며, 과제별로 최종 필터링 후 699K, 391K, 342K명이 사용됩니다. 주 지표는 환자별로 계산한 뒤 전체 환자에 대해 평균하는 평균 정밀도 점수인 APS입니다. 보조 지표로 AUROC도 같은 방식으로 계산합니다. 하이퍼파라미터는 BEHRT의 pre-training에 대해 베이지안 최적화로 탐색되었고, RETAIN과 Deepr에 대해서도 같은 방식의 탐색이 수행되었다고 설명됩니다.
기존 모델과의 예측 성능 비교
표 1에서 다음 방문 과제의 BEHRT는 APS 0.462와 AUROC 0.954를 보고합니다. 같은 과제에서 Deepr은 APS 0.360과 AUROC 0.942, RETAIN은 APS 0.382와 AUROC 0.921입니다. 향후 6개월 과제에서 BEHRT는 APS 0.525와 AUROC 0.958이며, Deepr은 0.393과 0.943, RETAIN은 0.417과 0.927입니다. 향후 12개월 과제에서 BEHRT는 APS 0.506과 AUROC 0.955이고, Deepr은 0.393과 0.943, RETAIN은 0.413과 0.928입니다. 본문은 여러 질병 예측에서 BEHRT가 기존 최고 수준 딥 EHR 모델보다 약 8%의 절대적 향상을 보였다고 기술하며, 이는 저자가 보고한 결과입니다.
이 비교는 CPRD에서 같은 과제와 분할로 측정된 세 모델에 대한 것이며, 다른 데이터셋이나 다른 질병 집합에 그대로 옮겨 말할 수 있는 결과는 아닙니다.

Table 1 : Next Visit Prediction Task
원문 · 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 · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.
Table 3 : Deepr Best Model - Subsequent Visit Prediction Task
원문 · 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 · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.
Table 4 : RETAIN Best Model - Subsequent Visit Prediction Task
원문 · 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 · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.
Table 5 : Diseases Prediction Performance
원문 · 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 · 원문 그림 인용 · 원본 PDF 15쪽에서 그림 영역을 추출했습니다.
Table 5 : Diseases Prediction Performance
원문 · 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 · 원문 그림 인용 · 원본 PDF 16쪽에서 그림 영역을 추출했습니다.
Table 5 : Diseases Prediction Performance
원문 · 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 · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.
Figure 7 : Disease-wise precision comparison for BEHRT, Deepr and RETAIN, all models trained on same dataset and trained on the same task (next 6 months), each point represents the precision/AUROC of one disease on corresponding model.
원문 · 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 · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.임베딩과 어텐션에 대한 정성적 분석
저자들은 질병 임베딩을 t-SNE로 두 차원에 투영하여 같은 임상군의 질병이 가깝게 모이는지 확인합니다. 이 분석은 시각적 검토이며, 질병 임베딩이 실제 임상 지식을 얼마나 정확히 담는지에 대한 정량적 증명은 아닙니다. 어텐션 분석에서는 환자 이력을 자기 자신과 비교하여, 한 진단이 다른 진단과 어떤 주의 점수로 연결되는지 보여 줍니다. 예시 환자에서는 류마티스 관절염과 힘줄병증 및 활막 질환 사이의 먼 미래 연결이 나타났다고 기술됩니다. 저자들은 사전학습된 표현이 여러 다운스트림 과제에 적은 추가 학습으로 쓰일 수 있다고 해석하지만, 이 논문의 실험은 주로 다중 질병 예측 과제에 한정됩니다.

Figure 4 : Disease Embedding Analysis. In this image we see a graph of disease embeddings projected in two dimensions where distance represents closeness of contextual association. Most associations are accepted by medical experts and maintain the gender-based divisions in illnesses, among other things. We zoom in and profile four clusters in this plot – shown in subfigures A-D.
원문 · 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 · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.
Figure 5 : Disease Self-Attention Analysis. This figure shows the EHR history (shown chronologically, going down- wards) of two patients A and B, each presented as two identical columns for the convenience of association analyses. The left side of the column represents the disease of interest and the right column indicates the corresponding associations to the highlighted disease on the left. The intensity of the blue on the right column represents the strength of the attention score – the stronger the intensity, the stronger the association and hence the stronger the attention score. The attention scores are specifically retrieved from the attention component of the last layer of BEHRT network.
원문 · 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 · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.적용 범위와 한계
이 연구의 결과는 CPRD와 HES 연결 자료에서 얻은 것이며, 질병 정의는 Caliber 매핑에 의존합니다. 저자들은 Caliber가 특정 코드를 301개 질병 코드로 통합하고 많은 다른 코드를 매핑하지 못한다고 밝히며, 더 안정적인 매핑이 필요하다고 기술합니다. 본 연구는 진단만 사용했으며 약물, 검사, 중재 같은 다른 개념은 미래 연구로 남겨졌습니다. 어텐션과 임베딩의 분석은 정성적 예시에 기반하므로 임상적 해석을 확정하지 않습니다. 성능 향상의 크기는 저자가 보고한 조건에서 나온 값이므로, 다른 의료 체계나 다른 질병 목록으로 바로 일반화하기는 어렵습니다.
논문 정보
- 저자
- Yikuan Li, Shishir Rao, Jose Roberto Ayala Solares, Abdelaali Hassaine, Dexter Canoy, Yajie Zhu, Kazem Rahimi, Gholamreza Salimi-Khorshidi
- 학회·저널
- arXiv · 프리프린트
- 최초 공개일
- 2019년 7월 22일
- 등록일
- 2026년 11월 6일
- 수정일
- 2019년 7월 22일
- 버전
- v1
- arXiv
- 1907.09538
- 분류
- cs.LG · stat.ML
- 원문 이용 조건
- CC BY 4.0
- 제공 범위
- 논문 정보, 해설, 허용된 원문 그림
AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.
초록
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.
원문 인용
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}
}