# How Deep is the Signal? Time-Context up to 30 Years for Colorectal Cancer Prediction in a Primary-Care EHR Model

Clinical models gain little from lookback beyond 18 years of primary-care history

Achille Raviez, Lan Wang, Brendan Delaney · arXiv · 2026-11-5

- **Problem** EHR foundation models are sized by token count, but token counts do not answer how far back in time a model must look. Prior studies capped lookback at three years, so the earliest predictive signal over decades went unmeasured.
- **Method** The authors keep one transformer fixed and vary only how far back its history reaches. The model is trained once on full history and applied to fifteen nested lookback windows from 2 to 30 years, using the same patients.
- **Results** AUROC for colorectal cancer prediction rose from 0.551 at 2 years to 0.590 at 18 years, then plateaued. An XGBoost baseline reached the same level, with a peak AUROC of 0.589.

## Why token context misses calendar depth

EHR foundation models are usually sized by tokens, the number of events they can read in one pass. Wornow et al. (2025) varied the context window from 512 to 16,384 tokens and found that larger token counts improve prediction. A sparsely recorded patient's whole life, by contrast, can fit in a few hundred tokens. Operational questions such as record retention, data curation and screening strategies are all counted in years, so a token count doesn't answer them directly.

The authors treat time-context as a measurable design axis for clinical prediction models, separate from token-context and worth reporting. An early plateau would instead give a citable bound for data curation. The data source adds a further gap, because primary-care records with more than 30 years of history are understudied, as the authors' contributions note.

## Fixing the model and changing only the history depth

The study holds the trained model and the patient set fixed and changes only how much history the model sees. Every window uses the same 10,590 patients and index dates, so each AUROC is compared within the same people. The model is trained once on full-history inputs and applied unchanged to all fifteen windows, so the windows differ only in their input.

![Figure 5: Nested design with 15 lookback windows applied to the same 10,590 evaluation patients](https://refivu.com/papers/bc34e3a5-2f54-4f6d-b8ba-0d4900d7c629/figures/figure-2d141f7cab8839c8485633a4a6721921.png?thumb=512)

**Figure 5** : Nested design with 15 lookback windows applied to the same 10,590 evaluation patients.

[Original paper](https://arxiv.org/abs/2611.07265v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

The data come from the WSIC North West London primary-care database, restricted to events from 1 January 1990 in a frozen extract dated 24 August 2026. Its cases form a hash split of the deep cases, and the cohort stays out of training and all preprocessing statistics. Controls are matched to cases on sex and birth year within ±2 years, and each control inherits its case's index date.

A uniform 12-month buffer removes the final year before the index date, which keeps out the diagnostic work-up. That buffer is longer than the pre-diagnostic code surge for CRC, which runs up to 8 to 10 months. AUROC is the primary metric, and AUPRC serves as the secondary check. Patients are resampled with replacement 1,000 times, and each resample is scored at all fifteen windows.

Between-window differences are computed inside each resample, so the comparisons are paired and their 95% CIs come from the 2.5th to 97.5th percentiles. The plateau depth is the shallowest window within 0.001 of the maximum whose paired difference from the 30-year window has a CI containing 0.

An XGBoost classifier on per-code event counts uses the same training data and nested evaluation as the transformer.

## Encoding events and measuring position in weeks

Each event enters the model as three parallel channels, feature, value and time, and the three 512-dimensional vectors are added together. The feature channel uses a code lookup table, so each SNOMED CT or dm+d code gets its own learned embedding. The value channel passes the z-score and a presence flag through a small trained MLP, and prescriptions also carry an acute or repeat qualifier.

The time channel is a sinusoidal encoding of age at each event, built from sixteen bands with periods of about 1.5 to 630 years.

![Figure 6: Event representation and model. Each event of an illustrative (not real) history is embedded as](https://refivu.com/papers/bc34e3a5-2f54-4f6d-b8ba-0d4900d7c629/figures/figure-0af27e1e7d846c8f19f66987048c9003.png?thumb=512)

**Figure 6** : Event representation and model. Each event of an illustrative (not real) history is embedded as

[Original paper](https://arxiv.org/abs/2611.07265v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

Because the age channel also carries temporal signal, the model keeps elapsed-time information without any calendar date. This tuple keeps each sequence short enough for full attention inside the 8,192-token context window.

The model applies Rotary Position Embedding over elapsed weeks rather than token index, so attention between two events depends on their time gap. No absolute calendar date is encoded, because era-shift recognition would contaminate the depth curve.

A \[CLS\] token closes each sequence, carries its own code and the age at the index date, and receives a learned vector during fine-tuning only. The authors say the architectural choices still need ablations.

## Pretraining and the CRC fine-tuning step

The trunk learns from a next-event objective that never mentions CRC. Under causal masking, the model sees the history up to event t and predicts event t+1.

The vocabulary holds 18,733 tokens, made of 17,184 SNOMED CT concepts and 1,546 dm+d VTM codes. Because the pretraining task is self-supervised and disease-agnostic, the trunk carries no CRC-specific supervision. Because of that \[CLS\] position, every window contains at least one token.

Fine-tuning began with one frozen-trunk warm-up epoch, so the head adapted before the trunk moved. The fine-tuning cohort had 13,490 cases and 37,321 controls, all with full-history inputs. Checkpoints and hyperparameters were selected by mean AUROC across six validation windows, which run from 2 to 22 years. The validation cohort held 284 cases and 2,778 controls, made from 10% of cases with 22 to 29 years of history.

The evaluation windows therefore differ only in their input, not in their weights. Each evaluation window removes events older than its start, counted back from the index date. The evaluation cohort of 1,008 cases and 9,582 controls stayed frozen and out of training. This setup lets the reported AUROC curve from 2 to 30 years reflect the depth of history alone, with 0.551 at 2 years and a peak of 0.590 at 18 years.

## Where transformer discrimination levels off

The transformer's AUROC starts at 0.551 for a 2-year lookback and climbs to 0.583 at 10 years. Every window deeper than 18 years stays within ±0.01 of the 30-year value of 0.580. The evaluation used 15 nested windows on the same 10,590 patients, so only the history depth changes between windows.

![Figure 1: Evaluation AUROC (95% CI) by lookback](https://refivu.com/papers/bc34e3a5-2f54-4f6d-b8ba-0d4900d7c629/figures/figure-a2b02a2d600ac63f0dcd4da9269e8dd2.png?thumb=512)

**Figure 1** : Evaluation AUROC (95% CI) by lookback

[Original paper](https://arxiv.org/abs/2611.07265v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Achille Raviez, Lan Wang, Brendan Delaney · How Deep is the Signal? Time-Context up to 30 Years for Colorectal Cancer Prediction in a Primary-Care EHR Model · Original paper figure · Extracted the figure area from page 4 of the original PDF.

The plateau rule takes the shallowest window whose AUROC sits within 0.001 of the maximum. It also requires a paired difference against the 30-year window with a 95% CI containing 0, and a point estimate within ±0.01. Under this rule the depth is 18 years, and the difference from 30 years is −0.010 (−0.022 to 0.002). The authors read this as consistent with no further gain.

Of the total AUROC gain of 0.040, about 80% comes within the first 10 years, which is 0.032 of 0.040. The shallowest window still sits clearly below the plateau, with the difference from 2 years to 18 years at +0.040 (0.018 to 0.061). Deep history does not add discrimination, while the early years carry most of the signal.

AUPRC follows the same shape, rising from 0.113 at 2 years to 0.132 at 18 years. The evaluation prevalence is 0.095, so the AUPRC values need that baseline to read. Median tokens per patient grow from about 90 at 2 years to about 1,200 at 30 years. Tokens added per 2-year step fall from about 180 to about 10, yet between 18 and 24 years each step still adds several tens of tokens.

The authors describe the plateau as gradual rather than a sharp cut-off, so the curve is a lower bound under data shift.

## XGBoost traces a similar depth curve

At 2 years, XGBoost reached an AUROC of 0.528 (0.510 to 0.548), while the transformer reached 0.551 (0.532 to 0.569). Its AUROC rose to a peak of 0.589 (0.569 to 0.607) at 14 years and stayed flat afterwards. At 30 years, XGBoost scored 0.584 (0.566 to 0.602), so its curve has the same shape as the transformer's. The transformer peaks later, at 18 years, so the two curves share a shape but differ in where they top out.

The transformer's lead at 2 years was +0.022 (0.000 to 0.043), a paired difference that only just clears zero. The authors attribute the transformer's shallow advantage to sparse records, where code counts carry less signal. Once enough events accumulate, code counts alone carry the signal, so the transformer's advantage disappears.

Median tokens per evaluation patient grew from about 90 at 2 years to about 1,200 at 30 years, yet the transformer gained nothing beyond 18 years. The authors read the shared curve as evidence that the signal is largely a property of the data rather than of one architecture. The authors expect the depth shape to hold under a larger model, because an independent model class already reproduces it.

## Limitations of the depth result

Absolute discrimination stayed modest for both models, which the authors link to a conservative 12-month buffer. For that reason, the AUROC figures aren't comparable with clinical CRC models built on cohort designs, such as QCancer. They also expect the depth shape, replicated by an independent model class, is unlikely to change.

The study covers a single region, although it spans diverse London practices and populations. This makes the evaluation cohort strongly selected toward older, residentially stable and likely less deprived patients. Events recorded per year grew from about 5M in the 1990s to about 130M in the 2020s. Distinct SNOMED CT codes per year rose about 2.5-fold, so older history is sparser and more coarsely coded.

Some codes carry approximate dates, and that imprecision adds noise to the depth measure. Registration depth was computed at year resolution, which can blur the 30-year window. The reported results come from a single training run. Architectural choices therefore still need ablation studies before the depth curve can be attributed to them.

## Paper info

- **Authors**: Achille Raviez, Lan Wang, Brendan Delaney
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-5
- **Added**: 2026-11-6
- **Updated**: 2026-11-5
- **Version**: v1
- **arXiv**: 2611.07265
- **Category**: cs.LG · cs.AI · q-bio.QM
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.07265v1) · [PDF ↗](https://arxiv.org/pdf/2611.07265v1)

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

EHR foundation models read medical events within a fixed context window, and long context has so far been measured only in tokens. How far back in time a model must look to capture the earliest predictive signal is unknown. We introduce time-context, the calendar lookback window before the prediction point, and provide, to our knowledge, the first systematic evaluation of decade-scale time-context for an EHR foundation model. We pretrained a decoder-only transformer (34.6M parameters) on 1.4B coded events from 3.6M primary-care patients in North West London and fine-tuned it to predict incident colorectal cancer under a 12-month pre-diagnostic buffer. A frozen cohort of 1,008 cases and 9,582 matched controls, all registered for at least 30 years, was evaluated at 15 nested lookback windows from 2 to 30 years, so that every truncation is compared within the same patients. Discrimination rose from an AUROC of 0.551 at 2 years to 0.590 at 18 years, then plateaued, with about 80% of the gain reached within 10 years; an XGBoost baseline converged to the same level (peak AUROC 0.589). A simulation further suggests that rotary position embeddings (RoPE) over elapsed time alias beyond about 20 years at the default base frequency, motivating a retuned $θ$. Time-context is a measurable design axis for clinical prediction models, distinct from token-context, and should be reported.

## Quote from the paper

Achille Raviez, Lan Wang, Brendan Delaney (2026). How Deep is the Signal? Time-Context up to 30 Years for Colorectal Cancer Prediction in a Primary-Care EHR Model. arXiv:2611.07265v1. https://arxiv.org/abs/2611.07265v1

**BibTeX**

```
@misc{raviez2026deep,
  title = {{How Deep is the Signal? Time-Context up to 30 Years for Colorectal Cancer Prediction in a Primary-Care EHR Model}},
  author = {Achille Raviez and Lan Wang and Brendan Delaney},
  year = {2026},
  eprint = {2611.07265},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.07265v1}
}
```

## Other paper commentary

- [Optimistic Hedge in General-Sum Games: Fundamental Limits and Regret Bounds via Temporal Approximation](https://refivu.com/en/papers/742ccf4a-1dbe-4ba9-a64d-e887c151a107-optimistic-hedge-in-general-sum-games-fundamental-limits.md)
- [Consistent Submodular Maximization with Full Foresight](https://refivu.com/en/papers/581075e3-e4d0-4abc-a9f5-d93e53320471-consistent-submodular-maximization-with-full-foresight.md)
- [The no-free-lunch theorems of supervised learning](https://refivu.com/en/papers/e3085891-a4f1-4605-8cbb-a1c36168e267-the-no-free-lunch-theorems-of-supervised-learning.md)
- [A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning](https://refivu.com/en/papers/08306129-4598-48b6-baf3-9d1af09e03a6-a-reduction-of-imitation-learning-and-structured-prediction.md)
- [NICE: Non-linear Independent Components Estimation](https://refivu.com/en/papers/f56da4f3-4308-4b66-a0bf-e0d6e495195a-nice-non-linear-independent-components-estimation.md)
- [Gaussian Error Linear Units (GELUs)](https://refivu.com/en/papers/264fd129-ba49-4e4c-ac1f-59466a4e43ea-gaussian-error-linear-units-gelus.md)
- [SeVerus: Context-Aware, Gamified Benchmarking for Rust Verification](https://refivu.com/en/papers/379d71d8-ad74-4ecd-9cb7-3f3b7b5a941f-severus-context-aware-gamified-benchmarking-for-rust.md)
- [Multi-step SWE: Can Coding Agents Keep Building on Their Own Code Over Long Horizons?](https://refivu.com/en/papers/511fe30c-d341-4cb6-8e73-d0dbbbec3008-multi-step-swe-can-coding-agents-keep-building.md)
- [TOP: Transmission-Oriented Remote Sensing Pansharpening](https://refivu.com/en/papers/7335c52a-09c4-412d-9575-402ad57a586b-top-transmission-oriented-remote-sensing-pansharpening.md)
- [Autonomous AI Agents Systematically Diverge From Human Preferences in Proof Formalization](https://refivu.com/en/papers/0667f312-1b91-4e84-840b-2ee875dac6ae-autonomous-ai-agents-systematically-diverge-from-human.md)
- [Automated Feedback to Peer Tutors Increases Their Talk Moves and Learner Reasoning but Not the Balance of Talk](https://refivu.com/en/papers/1e58766c-0ddb-431f-8443-e6eafb8bcd1d-automated-feedback-to-peer-tutors-increases-their-talk.md)
- [Beyond Instruction Override: Benchmarking Indirect Prompt Injection with Task-Tampering Attacks](https://refivu.com/en/papers/cefe818d-f868-4fcb-934d-a801e01c1bf8-beyond-instruction-override-benchmarking-indirect-prompt.md)

## Terms in this paper

- [RoPE](https://refivu.com/en/terms/e4cc5cfc6ebf-rope)
- [AUPRC](https://refivu.com/en/terms/ce2cb0018a4d-auprc)
- [\[CLS\] token](https://refivu.com/en/terms/236f8edd5419-cls-token)
- [Decoder-only transformer](https://refivu.com/en/terms/fcc228194237-decoder-only-transformer)
- [Rotary Position Embedding](https://refivu.com/en/terms/b2cbefb0d7bb-rotary-position-embedding)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/bc34e3a5-2f54-4f6d-b8ba-0d4900d7c629-how-deep-is-the-signal-time-context-up)
