Era-Aware Language Modeling: Training a Decoder-Only Transformer on a Balanced Gutenberg Corpus
This paper introduces GutenbergLM, a 109.5M-parameter decoder-only transformer trained from scratch on a temporally balanced Project Gutenberg corpus with era-conditioning tokens, demonstrating that explicit temporal stratification enables the model to generate distinct, period-appropriate writing styles across Early, Middle, and Modern literary eras.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a giant, super-smart robot that learns to write by reading millions of books. Usually, when we teach these robots, we feed them the entire internet. The problem? The internet is mostly made of things written in the last 20 years. It's like teaching a history student only about today's news; they might be great at current events, but they won't understand how people spoke in the 1700s or 1800s.
This paper introduces a new project called GutenbergLM. Think of it as a "time-travel writing class" for a small, efficient robot. Instead of the chaotic internet, the researchers fed this robot a carefully curated library of books from Project Gutenberg (a massive collection of free, old books).
Here is how they did it, broken down into simple steps:
1. Building the Perfect Library (The Corpus)
The researchers didn't just grab random books. They wanted to make sure the robot learned three distinct "time periods" equally:
- The Early Era: Books written before 1800.
- The Middle Era: Books written between 1801 and 1900.
- The Modern Era: Books written after 1900.
Usually, libraries have way more books from the 1800s than the 1700s. To fix this, the researchers acted like a strict librarian. They counted the books in each era and picked exactly the same number from each group (about 5,300 books per era). This ensured the robot didn't get biased toward one time period over another. They also cleaned the books, removing duplicate copies and the standard "Project Gutenberg" legal headers so the robot only learned the stories.
2. Teaching the Robot to Speak (Tokenization)
Before a computer can read, it has to break words down into smaller pieces called "tokens." The researchers built a special dictionary (a tokenizer) with 32,000 words.
- The Secret Sauce: They added three special "magic words" (or control tokens) to the dictionary:
<ERA_EARLY>,<ERA_MIDDLE>, and<ERA_MODERN>. - How it works: Think of these like dials on a radio. When the robot sees the
<ERA_EARLY>dial, it knows to switch its "voice" to sound like someone from the 1700s. When it sees<ERA_MODERN>, it switches to a modern voice.
3. The Robot's Brain (The Architecture)
The robot itself is a "decoder-only transformer," which is a fancy way of saying it's a modern AI brain designed to predict the next word in a sentence.
- It's relatively small (about 109 million parameters), which makes it efficient.
- It uses modern tricks to learn faster and remember context better, like Rotary Position Embeddings (which help it understand the order of words) and SwiGLU (a type of brain cell that processes information efficiently).
- It was trained on a single graphics card (an NVIDIA A10G) for about 13 hours.
4. The Results: Does it Work?
After the training run, the researchers tested the robot. Here is what they found:
- It learned to write: The robot successfully learned to predict the next word in a sentence with high accuracy (a "perplexity" score of about 24, which is quite good for a small model).
- The "Radio Dial" works: When they asked the robot to write a story starting with the
<ERA_EARLY>tag, it produced text that sounded old-fashioned, using words like "thence" and "unto," and referencing old dates. When they used the<ERA_MODERN>tag, the text sounded like a contemporary novel, mentioning things like "clubs" and "platforms." - No cheating: The robot didn't just memorize the books; it learned the style of each era. It could generate new sentences that felt authentic to the time period without being told exactly what the story was about.
Why This Matters
The paper argues that most AI models today are "time-blind" because they are trained on messy, modern internet data. This project proves that if you carefully balance your training data by time period, you can teach a small AI to understand and mimic different historical writing styles just by flipping a switch.
In short: The researchers built a time-traveling writing tutor. They fed it a perfectly balanced diet of old and new books, gave it a special set of "era buttons," and showed that the robot can now switch its writing style to sound like it belongs in the 1700s, the 1800s, or today, all from the same brain.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.