Pretraining Language Models on Historical Text

Xiaoxi Luo, Zachary Shinnick, Niclas Griesshaber, Yixuan Wang, Junchi Yu, Freda Shi, Philip Torr, Yao LuarXiv 2026

TL;DR

TypewriterLM is a 7.24B parameter language model trained exclusively on English text from 1700 to 1913 to eliminate "lookahead bias"—the tendency of modern models to use hindsight when simulating historical periods. By combining a massive 54B-token historical corpus with a novel "lexically grounded" instruction-tuning method, the researchers created a model that genuinely respects its 1913 knowledge cutoff, offering a powerful new tool for digital humanities and social science research.

What Problem Does This Paper Address?

When we use modern LLMs like GPT-4 or Llama 3 to study history, we encounter a fundamental flaw: they already know how the story ends. This is known as lookahead bias. If you ask a modern model in a 1913 persona about the possibility of a "Great War," its response is inevitably colored by its knowledge of World War I.

Beyond factual anachronisms, modern models are biased toward contemporary stylistic and lexical distributions. Training a model that truly "lives" in the past is difficult because:

  1. Data Scarcity: Historical text is limited compared to the modern web.
  2. Temporal Leakage: Digitized historical books often contain modern metadata (e.g., "Digitized by Google," library stamps, or modern prefaces) that can "leak" future information into the model.
  3. Post-training Contamination: Standard instruction tuning uses modern LLMs to generate Q&A pairs, which reintroduces modern perspectives and language.

Methods

The authors developed TypewriterLM (based on the Llama 3 architecture) using several novel strategies to maintain temporal integrity:

  • Strict Pre-training: They trained the model on TypewriterCorpus, applying rigorous rule-based filtering to strip out modern metadata, URLs, and HTML artifacts.
  • Custom Tokenization: To avoid modern vocabulary contamination, they trained a custom BPE tokenizer exclusively on the historical corpus.
  • Lexically Grounded Instruction Tuning: This is the paper's most significant innovation. Instead of letting a modern LLM write responses, they forced the model's answers to be constructed only from words found in specific pre-1913 source documents. This ensures the model's "voice" and knowledge remain strictly historical.
  • Surprisingness Evaluation: They used a "Bits-per-Byte" (BPB) metric to measure how "surprised" a model is by an event. A historically consistent model should find events after its cutoff date significantly more "surprising" (higher loss) than events before it.

Datasets

  • TypewriterCorpus: A new 54-billion-token corpus (1700–1913) sourced from Harvard’s Institutional Books, the British Library, Hansard (parliamentary records), and the Old Bailey court proceedings. As seen in Figure 2, the data is heavily concentrated in the 19th century. Figure 2: Number of tokens by decade (1700–1913) in our pretraining corpus.

  • History-LIMA & History-SelfInstruct: Two new instruction-tuning datasets built using the lexical grounding constraint.

  • History-Event: A benchmark of 2,344 historical events (1700–2025) used to test for data leakage and temporal consistency.
Figure 2: Number of tokens by decade (1700–1913) in our pretraining corpus.

Key Insights and Ideas

  • The "Einstein Test": The model demonstrates successful temporal grounding by failing to recognize Albert Einstein as a world-famous physicist (since his general theory of relativity gained global fame after 1913) and defining a "computer" as a human operator performing arithmetic. Figure 1: Probing TYPEWRITERLM on “future” events.

  • Linguistic Mismatch: The authors found that History LMs often perform poorly on modern benchmarks like HellaSwag not because they lack reasoning, but because of "linguistic mismatch." When they rewrote HellaSwag questions into 1800s prose style, the model's performance jumped significantly.

  • Quantifying Hindsight: By plotting BPB scores, the researchers could visually identify the model's knowledge boundary. TypewriterLM shows a sharp increase in "surprise" immediately following its 1913 cutoff, whereas modern baselines like Llama 3.1 remain flat because they have seen all the data. Figure 3: Bits-per-Byte Surprisingness Scores
Figure 1: Probing TYPEWRITERLM on “future” events.
Figure 3: Bits-per-Byte Surprisingness Scores

Key Results

  • General Capability: TypewriterLM (7.24B) outperforms smaller historical models (like GPT-1900 and TimeCapsuleLLM) on standard benchmarks like ARC-Easy (41.3%) and HellaSwag (39.0%).
  • Leakage Prevention: On the History-Event benchmark, TypewriterLM showed 0.0% strict leakage for post-cutoff events, meaning it could not correctly recall specific details or years for events occurring after 1913. In contrast, the 13B Talkie-1930 model showed some leakage.
  • Instruction Following: Despite the strict lexical constraints, the model achieved a 45.1% win rate against GPT-1900 in pairwise comparisons, proving that grounded tuning can retain strong instruction-following behavior.

Limitations and Future Work

  • Worldview and Bias: The model reflects the 1913 worldview, which includes perspectives and language considered offensive today. The authors emphasize that this is a feature for historical study but a risk for general use.
  • Residual Leakage: While strict leakage was zero, "relaxed" leakage (0.3-0.6%) suggests that some post-cutoff information still slips through, likely via modern prefaces or footnotes in digitized archives that escaped filtering.
  • Scaling Challenges: The authors note that as these models scale to 70B+ parameters, preventing lookahead bias will become even more difficult, requiring even more sophisticated data cleaning pipelines.

Summary updated

BibTeX
@misc{luo2026pretraining,
  author = {Xiaoxi Luo and Zachary Shinnick and Niclas Griesshaber and Yixuan Wang and Junchi Yu and Freda Shi and Philip Torr and Yao Lu},
  title = {{Pretraining Language Models on Historical Text}},
  year = {2026},
  eprint = {2606.02991},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.02991},
}
Figure