Lexical Explorer — Can Words Tell Us When the World is Changing?

Team argmins | QuantiHack 2026

We read 200 years of books so you don't have to. One new metric. 70,000 words. Machine learning that predicts which words are about to surge. A story about how language mirrors the world — and might help us see what's coming next.

Inspiration Here's something Wall Street hasn't figured out yet: language moves before markets do.

Before "subprime" became a household word in 2008, it was already surging in academic and legal texts. Before "internet" reshaped the economy in the late 1990s, its linguistic trajectory was already in breakout mode a decade earlier. Before every crash, every boom, every paradigm shift — the words changed first.

We started with a simple observation: when something big happens in the world — a war, a pandemic, a technological revolution — the words people use change. Not just the obvious ones, but hundreds of words shift together in ways nobody consciously notices.

That made us wonder: what if we could reverse-engineer history from word frequencies alone? And more importantly — what if we could detect the next shift before it happens?

We set out to build a system that could read the entire history of the English language and answer two questions: when was the world changing the most? and can we see what's coming next?

What We Built

A full analytical pipeline that takes raw word frequency data from millions of books (1800–2008), models every word as a stochastic dynamical system, extracts hidden cultural forces, and distills everything into a single headline metric: the Language Instability Index (LII).

Then we went further — we trained an ML model that uses these dynamics to predict which words are about to surge, turning a backward-looking analysis into a forward-looking tool.

The Big Result: We Can Predict Cultural Shifts The LII independently aligns with 11 out of 12 major historical events we tested (91.7%). Nobody told the model about WWI. Nobody told it about the Cold War. Nobody told it about the Computing Revolution. It found them on its own.

Event LII Elevation Aligned? Cold War 3.62× above baseline Yes Computing Revolution 2.66× Yes Vietnam War 2.48× Yes WWI 1.44× Yes US Civil War 1.38× Yes Cholera Epidemics (1830s) 1.37× Yes Spanish Flu 1.28× Yes Great Depression 1.21× Yes WWII 1.09× Yes Napoleonic Wars 0.88× No The only miss — the Napoleonic Wars — likely because our corpus starts in 1800 and the model needs a baseline window before it can detect disruption.

Why this matters beyond history: Every one of these events moved markets. The Great Depression, WWII, the Cold War, the Computing Revolution — each one created winners and losers across entire sectors. A system that can detect these shifts as they begin, not after they've played out, is exactly what quantitative finance has been looking for: an alternative data signal derived from the deepest possible source — the evolution of human language itself.

How We Built It

Step 1: Read Every Word We downloaded raw Google Books Ngram shard files — billions of word counts across millions of books. After ingesting 3 corpus shards and filtering for clean, lowercase English words with sufficient presence across time, we're left with ~75,000 unique words, each with a yearly frequency from 1800 to 2008.

Step 2: Give Every Word a Heartbeat

Each word gets its own local linear trend state-space model fitted via Kalman smoothing. Think of it like an ECG for language — for every word, every year, we extract:

$$y_t = \mu_t + \varepsilon_t \qquad \text{(observation: log-frequency = latent level + noise)}$$

$$\mu_{t+1} = \mu_t + \beta_t + \eta_t \qquad \text{(level: random walk with drift)}$$

$$\beta_{t+1} = \beta_t + \zeta_t \qquad \text{(drift: stochastic trend)}$$

This gives three time-series per word:

Latent level $\mu_t$ — how popular is the word, filtering out noise? Drift $\beta_t$ — is it rising or falling? Instability $\sigma_t$ — how erratic is its behavior? When "computer" starts appearing in books in the 1940s, its instability spikes. When "telegraph" peaks and begins to die, its drift turns negative. Every word tells a story.

We also detect changepoints using PELT — exact years where a word's statistical behavior fundamentally breaks from its past. A changepoint isn't just a spike; it's the moment the underlying pattern itself changes.

Step 3: Find the Hidden Forces

Not every word changes independently. When a war breaks out, hundreds of words shift together. We use PCA on the instability matrix to extract 10 hidden cultural factors — invisible forces driving correlated word changes.

What do these factors represent? Our interpretation:

Factor 1 (55.4%) — The Great Structural Shift. Top words: parliament, nitrogen, cattle, coal, republic, socialism. The dominant story of 200 years: the slow death of agrarian/industrial vocabulary as the old world gives way to the modern one.

Factor 2 (24.3%) — Moral & National Reckoning. Top words: conservation, disease, slavery, abolition, patriotism, constitution. Social reform and wartime nationalism intertwined — the words that surge when countries ask "what do we stand for?"

Together, Factors 1 and 2 explain 80% of all linguistic change. The biggest story in the English language isn't any single war or invention — it's the massive transition from an agrarian world to a modern one, punctuated by collective moral reckonings.

Step 4: Build the Index

We fit AR(1) models to each factor trajectory, compute the rolling 20-year covariance matrix of innovations $\Sigma_t$, and define two new metrics:

$$\text{LII}_t = \text{tr}(\Sigma_t) \qquad \text{(total system instability — our headline number)}$$

$$\text{CR}t = \frac{\lambda{\max}(\Sigma_t)}{\text{tr}(\Sigma_t)} \qquad \text{(concentration ratio — how the instability is distributed)}$$

A high LII means many factors are behaving unpredictably at once — the language system is under stress. The CR tells us how: a CR near 1 means a focused shock (one dominant force, like a new technology); a CR near 0 means broad upheaval (a world war that disrupts everything at once).

Together, LII and CR let us detect not only when the world is changing, but whether the disruption is narrow and technological, or broad and civilizational.

Step 5: Predict What's Coming

We went beyond analysis and built two prediction models:

  1. Word-level breakout predictor — Using only dynamics visible up to year $t$ — drift acceleration, instability trends, changepoint recency, factor loadings — we trained a logistic regression classifier to identify which individual words are about to enter rapid growth regimes over the next 5–10 years. Pick a year like 1995, and the model flags words it thinks are about to surge. Then reveal what actually happened by 2005.

  2. Cultural shift detector — An unsupervised anomaly detection system that identifies periods of cultural upheaval purely from linguistic signals. It combines two z-scored metrics into a single ShiftScore: system-wide LII volatility and changepoint density (how many words simultaneously undergo structural breaks). When both spike together, the system flags a cultural shift. It also classifies the type: structural upheaval (wars, revolutions), smooth transformation (technology, gradual change), or localized restructuring (political shifts). Tested against 12 major historical events, it detects all 12 — 7 with strong confidence — without ever being trained on historical labels.

The Finance Connection

The LII isn't just an academic curiosity. It's a potential alternative data signal for quantitative finance:

Sector rotation signal. When words like "digital," "software," and "internet" enter breakout regimes simultaneously, that's a detectable signal years before the sector fully reprices. Our model detected the Computing Revolution at 2.66× elevation — imagine having that signal in 1985, a decade before the dot-com boom.

Macro regime detection. The LII functions like a VIX for culture. A rising LII signals that the world is entering a period of rapid, unpredictable change — exactly when traditional models break down and tail risk increases. The Great Depression showed a 1.21× LII elevation; the Cold War showed 3.62×. These are the environments where portfolios blow up.

Thematic investing before the theme exists. Our emerging words predictor identifies concepts that are about to surge in cultural relevance. Words are proxies for ideas, and ideas drive markets. "Sustainability," "cybersecurity," "biotechnology" — each became a trillion-dollar investment theme. Our model could have flagged their linguistic breakout before the first ETF was launched.

Geopolitical risk pricing. When conflict-related words (soldier, invasion, blockade, propaganda) cluster into turbulent regimes simultaneously, that's a quantifiable early warning of geopolitical instability — the kind of risk that moves commodities, currencies, and defense stocks.

The core insight for finance: Markets price information. But language is information — the most comprehensive, continuous, and unstructured dataset in human history. The LII turns that dataset into a tradeable signal.

The Website — Lexical Explorer

The final product is an interactive website with 5 tabs:

Word Explorer — Type any word and see its 200-year journey: frequency curve, Kalman-smoothed trajectory color-coded by regime (adoption/decline/turbulent/stable), instability bands, and changepoint lines. Some discoveries:

"computer" — changepoints in 1939, 1949, 1959, 1969. The model traces the exact decades of the computing revolution. "capitalism" — changepoint at 1929. The model independently detects the Great Depression. "cinema" — breaks at 1919. The birth of Hollywood. Instability Dashboard — The LII timeline from 1805 to 2008, overlaid with historical event bands. The Cold War era dominates at 3.62×. Technology-driven change (Computing Revolution at 2.66×) rivals the impact of actual wars.

Factor Explorer — Browse the 10 hidden cultural factors, see which words load on each, watch how each factor evolved over two centuries.

Word Map — 500 words plotted by factor loadings, colored by regime. A literal map of the English language organized by cultural forces.

Emerging Words Predictor — Our ML model's top predictions: which words were about to surge at any given historical year, and whether they actually did.

Challenges We Face

Data scale vs. time. The full Google Books 1-gram corpus is 26 shard files, each 300–500MB compressed. We could only download and process 3 shards (letters c, s, t) during the hackathon — but that still gave us ~75,000 words and 91.7% event alignment. Proof that the signal is strong even with partial data.

Chart.js global plugin poisoning. Our model overlay charts used Chart.register() to add changepoint line and event band plugins — which silently broke every other chart on the page. Took hours to diagnose; the fix was converting to inline plugins passed per-chart.

LII values too small to read. The raw trace values ($\sim 0.04$) were scientifically correct but unreadable on a dashboard. We scaled by $10{,}000\times$ in the export step — interpretable without changing the math.

Fitting 75,000 Kalman models. Each word needs its own UnobservedComponents fit via statsmodels. With 75k words, this takes real compute time. We parallelized and optimized, but this remains the bottleneck.

What We Learned

Language really is a sensor. We were skeptical that word frequencies alone could detect historical events — but 91.7% alignment from a purely data-driven model is hard to argue with.

Feature engineering > model complexity. Our prediction model is a logistic regression — no neural networks. The power comes from the features: drift acceleration, instability trends, changepoint recency. Well-engineered features from a principled statistical model beat brute-force approaches.

Two numbers tell the whole story. LII says how much is changing; CR says how it's changing. Broad civilizational upheaval vs. narrow technological shock — a distinction we didn't expect to fall out of the math so cleanly.

Words move before markets. The most surprising finding: linguistic breakout precedes economic and political impact by years, sometimes decades. That lag is exactly what makes this a viable signal for forward-looking applications.

The Pipeline#3

Raw Google Books data (billions of word counts) ↓ Ingest + clean → 75,000 words × 200 years ↓ Kalman smoother → level, drift, instability per word ↓ PELT changepoint detection → structural breaks ↓ Regime labeling → adoption / decline / turbulent / stable ↓ PCA factor model → 10 hidden cultural dimensions ↓ LII computation → tr(Σ_t) of factor innovations ↓ Event alignment → validated against 12 historical events ↓ ML prediction → logistic regression on Kalman features ↓ Export → JSON → Interactive website Limitations We processed ~75,000 words from 3 of 26 corpus shards (letters c, s, and t) due to download time and disk space constraints during the hackathon. The full Google Books 1-gram corpus would give 500,000+ words and an even stronger statistical signal. Despite this, the results are already striking — 91.7% event alignment from just 3 letters of the alphabet.

Tech Stack

Data: Google Books Ngrams v2 (2012 corpus, 1800–2008) Modeling: Python · statsmodels (Kalman) · ruptures (PELT) · scikit-learn (PCA + LogReg) · Polars Frontend: HTML/CSS/JS · Chart.js 4.4.1 Backend: Node.js + Express · Deployed on Render.com

One new metric. 70,000 words. 200 years. Language moves before markets. We built the system that listens.

Built With

Share this project:

Updates