QQuant, Built

Act IV · Return Premia (P)

Part 28 of 43

Text, LLMs and Alternative Data

Undergraduatestarts at this level63 min of film 20 chaptersprerequisites: Part 6, Part 26

One sentence in a central bank's statement moves the bond market. Can a machine read it, and can it read it without knowing the future?

Text is turned into numbers in the order the field did it: word counts and finance dictionaries, supervised word lists that learn which words precede a rise, topics, embeddings, transformers, and large language models that read the news directly. Each is tried on Federal Reserve statements and on returns. The central problem is the one nobody noticed until recently: a language model trained on text from after the event already knows what happened. The part builds time-sliced models to measure that look-ahead, and applies the series' evaluation protocol to a text signal.

What you need. Part 6. AI, Built, Parts 13-14, for transformers.

What you will be able to do

Undergraduate

  • Represent a document as word counts and score its tone with a dictionary.
  • Explain look-ahead bias in a language model.

Master's

  • Build a supervised sentiment score (screening, topic weights, scoring) and test it out of sample; compute embeddings and topics.
  • Design a time-sliced evaluation for a text or LLM signal.

PhD

  • Prove why screening recovers sentiment-charged words (sure screening) and how many documents it takes.

Industry

  • Assess an alternative-data set: coverage, history, point-in-time integrity, decay, cost.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 15 min · Master's 56 min · PhD 63 min · Industry 26 min.

  1. 0One sentenceUndergraduate2 min
  2. 1Words as numbersUndergraduate3 min
  3. 2Dictionaries: Tetlock and Loughran-McDonaldUndergraduate3 min
  4. 3Tone and the two-year yieldMaster's3 min
  5. 4Length, readability and forward guidanceMaster's3 min
  6. 5Supervised words: SESTMMaster's4 min
  7. 6Topics, and the news as macro dataMaster's3 min
  8. 7Inside the FOMC: transparency and deliberationMaster's3 min
  9. 8Embeddings: meaning from neighboursMaster's3 min
  10. 9Transformers and FinBERTMaster's3 min
  11. 10LLMs read the newsMaster's3 min
  12. 11Look-ahead biasUndergraduate3 min
  13. 12The time-sliced experimentMaster's5 min
  14. 13LLM trading agentsPhD2 min
  15. 14Alternative dataIndustry3 min
  16. 15Domain models and the text deskIndustry2 min
  17. 16Text-signal evaluation protocolIndustry3 min
  18. 17Rule 28: text featuresIndustry2 min
  19. For the researcher: why screening finds the wordsPhD5 min
  20. Recap, desk questions, problemsAll tracks4 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Reading · 中文 · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.

One sentenceUndergraduate2 min

Text, language models and alternative data: how to turn words, and other things that are not prices, into numbers a model can use; what they are worth; and how easily they fool you.

On the , eight days before a scheduled meeting, the Federal Open Market Committee issued an unscheduled statement. Compare selected policy sentences with the statement before it. A cut of three quarters of a point instead of a quarter, and a lower target. The new outlook sentence points to weakening conditions and increasing downside risks to growth. Later paragraphs also discuss a deepening housing contraction; these excerpts do not show the full documents.

This daily series measures a close-to-close association, not a minute-by-minute causal response. The two-year Treasury yield had fallen basis points, the largest move on any statement day from 1997 to 2020. On a typical statement day it moves about . The other big days cluster in the same crisis. Other news and the policy decision share this daily window. Reading text and timing an executable trade are separate questions: can a machine read them as fast, and as well?

The tools are older than you might think. A psychologists' dictionary from the 1960s; Paul Tetlock's media pessimism in 2007; Loughran and McDonald's finance dictionary in 2011. Then the neural turn: word vectors in 2013, the transformer in 2017, BERT in 2018, the year a topic model also opened up the FOMC's transcripts; SESTM in 2019. And since 2023 the large language models: FinBERT, BloombergGPT, ChatGPT reading headlines, agents that trade, and the first models built so that they cannot read the future.

The plan: words as numbers, dictionaries and why they misread; the bond market's reaction; forward guidance; supervised words, topics and embeddings, all on thirty years of the Fed's own documents; transformers, and a small language model of our own; what large language models can do with the news, and how they can cheat; agents and alternative data; and the theorem that says how many documents a word list needs.

In the House, the research desk gets a reading room: tools to turn documents into features, each stamped with a required public-release clock, and a rule for what such a feature must survive. The original meeting-date fields alone do not supply that clock.

1Words as numbersUndergraduate3 min

Before any model can read, words have to become numbers. How does a statement become a row of a matrix?

Take one sentence from a statement. Split it into words, lower-case them, and drop the numbers and punctuation. Then count. The order is thrown away: this is the bag of words, and for thirty years most of text analysis in finance started, and ended, here. It loses grammar, negation and context, and keeps something surprisingly useful: which words were chosen, how often.

Do that for every document and stack the counts. The document-term matrix: one row per document, one column per word, each entry a count. Our linked-page extract contains statements the Federal Open Market Committee has released since 1997, of them through 2020, and the extracted minutes since , more: in all about million words and distinct ones. Almost every entry is zero. Text is the extreme case of the problem Parts twenty-five and twenty-seven kept meeting: far more columns than anyone can estimate one at a time.

Sort the words by how often they appear and plot frequency against rank, both on log scales. An approximately linear rank-frequency pattern is called Zipf's law; it is not an exact universal claim about every corpus. Here the slope fitted on ranks ten to one thousand is . The head is a handful of function words, the and of and to, which carry almost no meaning; the tail is tens of thousands of words used once or twice. Everything interesting lives in between, and every method is a different way of deciding which of those middle words matter.

The vocabulary never stops growing. Count the distinct words the minutes have used, year by year: in the first year, by 2020. This is Heaps' law, the companion of Zipf's. This graph shows annual vocabulary accumulation; it does not fit a power-law exponent against cumulative token count or prove growth without end. From 2008 to 2010 alone, the committee wrote words it had never used before. A model frozen in 2007 has never seen them: hold on to that for Chapter twelve.

The simplest reweighting is called t f i d f. Turn counts into shares, so long documents do not dominate. Then weight each word by how rare it is across documents: a word that appears everywhere, like committee, gets almost nothing; a word in a few documents, like pandemic, gets a lot. Scale each row to unit length, and the similarity of two statements is a single dot product. Search engines ran on this for decades.

Pause and predict. A word appears in every FOMC statement and nowhere else. What is its weight within the statements, and is it useless?

2Dictionaries: Tetlock and Loughran-McDonaldUndergraduate3 min

The oldest way to read text at scale: a list of words that count as good news and a list that count as bad. Which words, and who decides?

In 2007 Paul Tetlock took one newspaper column, the Wall Street Journal's daily Abreast of the Market, from 1984 to 1999, and counted its words in the categories of the Harvard General Inquirer, a dictionary built by psychologists in the 1960s. One pessimism factor came out. When it was high, the Dow fell the next day, and then came back within the week. A temporary push and a reversal is what noise traders' sentiment should do, not news about fundamentals; and extreme pessimism in either direction predicted heavy trading. Media words, it turned out, move prices, if only for a while.

Two more dictionary papers mark the territory. Werner Antweiler and Murray Frank read a million and a half messages on internet stock boards: the chatter predicted volatility, and its effect on returns was real but small. And Tetlock, with Maytal Saar-Tsechansky and Sofus Macskassy, moved from the market column to news about single firms: the share of negative words predicted low earnings and low returns, and prices were slow to absorb it. Words carry information about fundamentals, not only about mood.

Four years later, Tim Loughran and Bill McDonald pointed out what goes wrong when a psychologist's dictionary reads a company's annual report. To the Harvard list, tax, cost, capital, board, liability, foreign and vice are negative words. In a ten-K they are simply the business: the board of directors, the vice president, capital expenditure. Across fifty thousand annual reports, almost three quarters of the Harvard list's negative counts came from words like these. So they built their own lists from the filings themselves: felony, litigation, restated, impairment. Their dictionary is now the default in finance, updated ever since, with negative words, positive and for uncertainty.

Run the dictionary over every FOMC statement. The negative share jumps in the recessions of 2001, 2008 and 2020, as you would hope. The positive share drifts and the uncertainty share sits near a steady floor, set by the committee's habit of saying what it anticipates and what risks it sees, whatever the weather.

But look at which words do the counting. The most counted negative word in the statements is , and the most counted positive word is . In a central bank's statement, their frequency may reflect the mandate rather than an isolated sentiment shock. Their context can still carry news; counting them alone discards that context. Maximum employment and stable prices are the mandate. The finance dictionary misreads a central bank the way the psychologists' dictionary misread an annual report. Every dictionary is fitted to a genre, and this one was fitted to filings.

Pause and predict. The Committee will not hesitate to act if the outlook weakens. How many negative words would the dictionary count, and is the sentence hawkish or dovish?

3Tone and the two-year yieldMaster's3 min

A dictionary can score every statement. Does the score tell us how the bond market will react?

The market's verdict on a statement is fast. Measure it as the change in the two-year Treasury yield from the prior trading close to the first trading close on or after its date. That includes the policy decision, other news and time before release. It is neither a tradable forecast nor an isolated causal text effect. Then ask the simplest question: regress that change on the dictionary's net tone. On a typical statement day the two-year moves by about basis points; on a few, by tens.

In the House, tone is a few lines. Upper-case each word, look it up in each list, and divide by the number of words. Run on the statement of the hook, the twenty-second of January 2008: percent of its words are negative, percent positive, percent uncertain.

Here are all statements through 2020. Each dot is one statement: its net tone across, the two-year yield's move up. The fitted line is flat. The t statistic is , and tone explains percent of the moves. The change in tone since the last statement, the negative share alone, the uncertainty share: t statistics of , and . These conventional regression statistics provide little evidence for this linear dictionary relationship; they do not prove words contain no information. The dictionary edition is retrospective, and these standard errors do not adjust for dependence or selection.

That is not because words do not matter. Kenneth Kuttner showed in 2001 that yields respond to the surprise in a rate decision, measured against fed funds futures, and hardly at all to the part everyone expected. Refet Gürkaynak, Brian Sack and Eric Swanson then found that FOMC days need a second factor: news about the future path of policy, which comes chiefly from the statement, and which matters more than the decision itself for longer yields. So the words do move markets, through what they imply about future policy relative to what was expected. A list of good and bad words sees neither the path nor the expectation. We need a method that learns which words matter from the market's reaction itself.

Pause and predict. The market expected a quarter-point cut and got one, with a statement that hinted at more. Which way does the two-year move, and would net tone know?

4Length, readability and forward guidanceMaster's3 min

Before asking what the statements say, look at how they say it: how long they are, how hard they are to read, and the phrases they use to talk about the future.

Here is every statement, as a bar of its length in words. In the late 1990s a statement was a paragraph: the median before 2002 is words. The crisis changed that. As the committee cut to zero and began buying bonds, it had to explain tools that could not be summarised by one number, and to say what it would do next. Since 2016 the median is words. The statement became the policy instrument.

And how hard are they to read? The fog index, from 1952, adds the average sentence length to a heuristic count of long words. Our helper uses vowel groups for syllables, so its value is not a certified schooling requirement. Before 2002 the median statement scored about ; since 2016, about : similar heuristic scores, rather than a direct measurement of comprehension. Loughran and McDonald later argued that fog misjudges financial documents, whose long words are easy for their intended readers, and proposed something as blunt as file size. Readability is not information.

There is a simpler measure than any dictionary: how much did the statement change? Compare each statement's weighted word counts with the one before, and score one minus their cosine similarity. The median statement changes by : most of each statement is similar to the last in this representation, not a literal fraction of copied words. Vocabulary and inverse-document frequencies use the full research corpus, so this is retrospective. And the more it changes, the more the two-year moves. The rank correlation is ; statements in the most-changed quarter move the yield by basis points on average, those in the least-changed quarter by . It says nothing about direction, and big rewrites often come with a policy action, so it is association. But traders read statements the way the hook did: as a difference from the last one.

Firms show the same thing. Lauren Cohen, Christopher Malloy and Quoc Nguyen found that when a company changes the language of its annual or quarterly report from one year to the next, its future returns are lower: the changes predict bad news, and investors are slow to read them. They called it lazy prices.

The words that carry the most weight are the ones about the future. Each row is a phrase; each tick, a statement that used it. Likely to be measured, from the 2004 tightening, promised quarter-point steps; considerable period, extended period and exceptionally low levels promised the opposite. Patient, some time, gradual: each phrase lives for a few years, and its removal is itself the news. Transitory, the committee's word for the inflation of 2021, was dropped in December of that year, and by March 2022 ongoing increases had taken its place. This phrase inventory deliberately includes later public texts through 2025; it does not read a sealed strategy result. A dictionary cannot know any of this: these phrases mean what the committee's history has made them mean.

Pause and predict. The committee drops the word patient from its statement and changes nothing else. Which way should the two-year yield move?

5Supervised words: SESTMMaster's4 min

Instead of deciding in advance which words are good or bad, let the market's reactions decide. Can a model learn which words matter, and how much?

In 2019 Zheng Tracy Ke, Bryan Kelly and Dacheng Xiu took twenty-two and a half million Dow Jones news articles, each about one stock, and labelled each with that stock's return. Their method learned its own positive and negative words from the returns. Trading on it the next day, equal-weighted, earned an annualised Sharpe ratio of four point two nine before costs; value-weighted, one point three three. In the authors' reported stock sample, it beat the Loughran and McDonald dictionary and RavenPack's scores. Those are attributed paper results, not our FOMC replication or a promise of attainable returns.

The model is simple enough to write down. Each article has a tone p between zero and one. Its sentiment-charged words are drawn from a mixture: a positive topic with weight p, a negative topic with weight one minus p. Every other word is left out of the model. The return depends on the text only through p, and a more positive tone means a higher chance of a positive return. Step one, the screen: for each word, among the articles that contain it, what share had positive returns? Keep the words whose share is far from the overall one, and that appear often enough to trust. Step two, estimate the two topics by regressing the kept words' frequencies on the articles' return ranks. Step three, score a new article by penalized maximum likelihood on a finite grid; the penalty pulls every score toward neutral. The rank regression is clipped at zero and its two columns normalised; it is an implementation choice, not an exact latent-topic posterior.

Here is the screen on the FOMC statements, trained on the statements to 2012, with the two-year yield's move as the label. Each dot is a word: how many statements contain it, across, and the share of those statements on which the yield rose, up. The thresholds were chosen by validating on 2007 to 2012: keep words at least away from the overall share, in at least statements. words survive on the hawkish side and on the dovish. Some make sense: inflationary, robust, removed, as in removing accommodation, on the side of rising yields; slower, constrained, wealth on the other. Others, like even and after, look like accidents of a small sample. The vocabulary was built through 2012 before the early fit, so validation-year document frequencies enter preprocessing. Zero and missing yield changes are excluded. This is not a fully point-in-time validation pipeline.

Step two turns the kept words into two topics. Regress each statement's frequencies of the kept words on its rank among the yield moves: the fitted weights at the top rank are the hawkish topic, at the bottom the dovish one. Here is each word's weight in the hawkish topic minus its weight in the dovish. These are the weights the score will use; a new statement's tone is whichever mixture of the two topics best explains its words.

The screen itself is a dozen lines of the House's text module. Which documents contain each word; how many; the share with a positive label; and two thresholds. Run on the statements to 2012, it keeps words out of .

Did it learn anything? On the statements it was trained on, the score lines up with the yield's move: a rank correlation of . On the statements from 2013 to 2020 that it never saw, the correlation is , with a p-value of . The sign is right percent of the time. Ke, Kelly and Xiu had twenty-two million articles; we have statements. Screening hundreds of words on a hundred labels can fit chance, and regime change or misspecification can also weaken transfer. This comparison alone does not identify the cause. How many documents the screen needs is a theorem, and it is this part's research chapter.

Pause and predict. With statements and candidate words, how many words would pass this screen if the labels were coin flips?

6Topics, and the news as macro dataMaster's3 min

Instead of good and bad, ask what a document is about. Can a machine find the themes of thirty years of minutes without being told what they are?

A topic model factors the document-term matrix. Take the weighted matrix of the minutes and write it as a product of two non-negative matrices, with topics in between. Each document becomes a mix of topics, each topic a weighting of words, and because nothing can be negative, each piece reads like a theme. Latent Dirichlet allocation, from 2003, is the probabilistic version that most of the finance papers use; non-negative factorisation gives matrices of similar shape, but uses a different objective and is not LDA inference. Scaling a column of W and inversely scaling a row of H leaves their product unchanged; row-normalised W is a chosen display convention, not an identified agenda probability.

The whole fit is two lines repeated. Lee and Seung's multiplicative updates: multiply the topics by a ratio that is above one where the fit is too small and below one where it is too big, then do the same for each document's weights. Nothing can turn negative, and the error falls every step. On the minutes, five hundred steps take the relative error from to : eight topics leave most of thirty years' detail unexplained, and keep the broad shape.

Here are the eight topics, each named by us after reading its top words; the model only found them. Money ranges and restraint; slowdown and disinflation; firming and removing accommodation; liquidity facilities; asset purchases and guidance; normalisation; reserves and repo; and one topic of pure procedure, the authorisations the committee renews at every January meeting. Notice what kind of themes they are. Not inflation versus employment, but eras.

Plot each year's mix. The minutes flow from one era to the next: monetary ranges in the late nineties; the slowdown of 2001; the measured firming of 2004 to 2006; liquidity facilities in 2008, returning in 2020; asset purchases and forward guidance through 2014; normalisation; and then the plumbing of reserves and repo. The procedure topic is the steady band that never goes away. These are retrospective factors with names assigned by us. Fitting the whole research corpus can reveal eras, but does not identify causes or a unique committee agenda.

Leland Bybee, Bryan Kelly, Asaf Manela and Dacheng Xiu did this to the business press. Eight hundred thousand Wall Street Journal articles, 1984 to 2017, turned into the share of attention each topic received each month. That attention tracks the economy closely, forecasts the stock market, and adds forecasting power to a standard model of macroeconomic dynamics. The news is a macro data series, available daily, long before the official statistics.

Pause and predict. These topics are eras, not themes. If you wanted a topic for inflation that runs through every decade, what would you change: the number of topics, the weighting, or the documents?

7Inside the FOMC: transparency and deliberationMaster's3 min

Text is not only an input to trading; it is evidence about how decisions are made. And when the people speaking know they will be read, do they speak differently?

The committee speaks through several documents. The statement, since 1994. The minutes, a summary of the discussion without names, published three weeks after each meeting since January 2005. The transcripts: every word, with names, released five years later. And since 2007 the participants' own projections, since 2011 a press conference. Each is a different text, written for a different reader, at a different delay.

That makes a natural experiment. The meetings had been taped since the 1970s to help write the minutes, and members believed the tapes were erased afterwards. In October 1993 Alan Greenspan revealed that the transcripts existed, and the Fed agreed to publish them with a five-year lag. Overnight, every member knew their words would be read. Stephen Hansen, Michael McMahon and Andrea Prat ran a topic model over every speaker's words before and after. They found two effects. Discipline: less experienced members came better prepared, with more data. Conformity: they also stayed closer to the chair's line. On balance, the debate became more informative.

Theory predicted both effects. An expert who knows they will be judged works harder: discipline. The same expert also fears looking wrong, and drifts toward the view an observer expects: conformity. Ellen Meade and David Stasavage had already shown that dissents at the FOMC became rarer after 1993. But votes are a crude record. Text lets you measure what each member said, and how, which is what turned an old question in the economics of committees into a measurement.

Two more papers read the committee itself. Adam Shapiro and Daniel Wilson used the tone of transcripts, minutes and speeches to estimate what the committee was actually aiming for: its objectives inferred from its own words. And Yuriy Gorodnichenko, Tho Pham and Oleksandr Talavera measured the emotion in the chair's voice at press conferences: tone of voice moves markets beyond the text.

Our own corpus shows the minutes changing too. Each bar is one set of minutes, counting only the paragraphs of discussion. From 2005 the minutes arrived three weeks after the meeting rather than after the next one, and became a market-moving document in their own right. The median grew from about words before 2005 to about since 2009. When a chart compares eras with different policy topics and regimes, and does not isolate an effect of the publication rule.

Pause and predict. A model trained on minutes from before 2005 is used on minutes written after. Why might its scores drift, even if nothing about the economy changed?

8Embeddings: meaning from neighboursMaster's3 min

A bag of words treats easing and tightening as unrelated symbols. Can a machine learn what words mean, with no dictionary at all?

The idea is from the linguist J. R. Firth in 1957: you shall know a word by the company it keeps. Raise and lower appear in the same places: the committee decided to blank the target range. Words that share neighbours share meaning, or at least a role. An embedding gives each word a vector that summarises its neighbours, so that words used alike point the same way.

Here is how, with nothing but counting and linear algebra. Count how often each word appears within five words of each other word, nearer pairs counting more. Convert counts to a positive PMI variant using context frequencies raised to the power zero point seven five and renormalised; this differs from the unsmoothed independence baseline. Set negative values to zero. Factor that matrix with a singular value decomposition and keep fifty directions: each word is now a point in fifty dimensions. Omer Levy and Yoav Goldberg relate skip-gram with negative sampling to a shifted PMI objective under their assumptions. A finite SVD of positive smoothed PMI is a related construction, not numerical equivalence to every word2vec model.

Train it on the minutes, and ask for each word's nearest neighbours. Inflation sits next to expectations, core and survey-based; purchases next to asset, large-scale and the mortgage-backed securities the Fed bought; housing next to residential, homebuilding and construction. Tightening's nearest neighbour is easing: opposites that play the same role. And liquidity lives with facilities, swap lines and emergency provision, the vocabulary of 2008. None of this was supplied as sentiment labels. Shared contexts can put antonyms together, so proximity does not mean equal polarity or guarantee useful return features.

Project the two hundred and fifty most common words onto the two directions that spread them most. The map is crude, two of fifty dimensions, but neighbourhoods appear: words about prices and inflation in one region, about the labour market in another, financial plumbing in a third.

Directions carry relations, too. Take the vector for tightening, subtract raise, add lower, and ask which word is nearest. The answer is . Tightening is to raise what easing is to lower: arithmetic on meaning, the trick that made Tomas Mikolov's word2vec famous in 2013, reproduced here from nothing but the Fed's own minutes.

Pause and predict. Tightening's nearest neighbour is easing. Would a sentiment score built on these vectors tell a hawkish statement from a dovish one?

9Transformers and FinBERTMaster's3 min

An embedding gives each word one vector, whatever sentence it is in. Will not hesitate to tighten and will not tighten mean opposite things with nearly the same words. What does a model gain by reading the whole sentence at once?

The answer of the last decade is attention, which the AI series builds from scratch. To represent the word tighten, the model looks back at every other word in the sentence and decides how much each one matters: here, not and hesitate matter a lot. The new vector for tighten is a weighted average of the others, so the same word gets a different meaning in every sentence. Stack dozens of these layers and train on enough text, and you have the core of a transformer. Residual pathways, feed-forward layers, positional information and the attention mask also matter; these illustrative arrows are not estimated weights or causal explanations.

Finance's own transformer came from accounting. Allen Huang, Hui Wang and Yi Yang pretrained BERT on four point nine billion tokens of filings, earnings calls and analyst reports, then fine-tuned it on ten thousand analyst sentences labelled by hand. It beat the dictionary and the older machine-learning methods, most of all on sentences the others called neutral, and it needed little labelled data to do it. Measured with it, earnings calls carry at least eighteen percent more information than the older methods could see.

We cannot train FinBERT here, but we can train its little cousin, the way the AI series does. Pieces of words learned by byte-pair encoding, from the training text only, so a tokenizer trained on earlier documents cannot learn later merge frequencies. Byte-level pieces can still encode a new word, and pandemic is not a word invented in 2020. The minutes are indexed by meeting date, which can precede their release. A modern decoder with layers and million parameters. Trained to predict the next token, on million tokens of FOMC minutes, on an ordinary CPU. Three copies of it, trained on three different slices of history, are the next chapter's experiment.

Here is the first copy learning. The loss starts near the log of the vocabulary, about nats per token, a uniform guess, and falls as it learns spelling, then grammar, then the committee's habits, to about . On the left, its loss on the minutes of 2008 to 2012 is evaluated every forty steps. Those tokens provide no gradient for A, and the original trainer returns its final checkpoint rather than selecting the minimum test loss. Repeated monitoring still makes this an inspected evaluation set. And at the end, what it writes when asked to continue a sentence about deteriorating financial conditions. It has never read a word from after 2007.

Pause and predict. A model that guesses uniformly over two thousand and forty-eight tokens has a loss of the log of two thousand and forty-eight. What is that in nats, and in bits?

10LLMs read the newsMaster's3 min

Every method so far learned its words from finance alone. Large language models arrive having read most of the public internet. What changes when that is the reader?

Here is how the most cited paper did it. Pretend you are a financial expert with stock recommendation experience. Is this headline good or bad for the company's stock price in the short term? Answer yes, no or unknown, then one sentence of reasoning. Yes becomes plus one, no becomes minus one, and the scores are averaged by company and day. No training, no word lists, no labels: the model's general reading does the work.

Version matters. This is Lopez-Lira and Tang's sixth version, dated October 2025, with 159,137 firm-headline-date observations on 4,123 firms. Their roughly ninety-percent portfolio-day success refers to the initial reaction, which they explicitly call non-tradable. It is not headline classification accuracy. Subsequent drift has reported hit rates of fifty-eight and fifty-five percent, and gross Sharpe ratios of two point nine seven and two point six three. Twenty basis points of round-trip costs erase profitability. The authors declare a September 2021 cutoff for the fixed GPT-4 version; a declared cutoff alone does not independently audit its entire corpus. These are reported results, not replicated here.

A second way skips the prompt. Yifei Chen, Bryan Kelly and Dacheng Xiu feed each article through a language model and keep its internal representation, a long vector. Then they learn from returns which directions of that vector predict, with the ridge regression of Part twenty-seven. Across sixteen equity markets and thirteen languages, the authors report gains over word-based models and delayed price responses. Trading interpretation still depends on publication clocks, sample design and costs; that study is not reproduced here.

Financial-statement analysis is a useful proposed task, but one prominent citation needs correction. Kim, Muhn and Nikolaev's working paper was withdrawn in February 2025. Their notice says a co-author found inconsistencies in the data and analyses while attempting replication. We therefore withhold its earlier accuracy and profitability claims. A plausible prompt and an appealing headline result are insufficient evidence. The task still needs reproducible data, a frozen model version, a clear comparison and an independent evaluation.

Three more strands. Dogu Araci's FinBERT of 2019, the first, trained on financial news. Anne Lundgaard Hansen and Sophia Kazinnik asked whether ChatGPT can decipher Fedspeak; the larger models label the committee's sentences as hawkish or dovish close to human experts. And Sean Cao, Wei Jiang, Junbo Wang and Baozhong Yang built an artificial analyst from public data that beat most human analysts, while analysts working with it beat both.

Three questions every one of these results must answer. What was the model trained on? A model that has read the internet through 2023 may already know what followed a 2019 headline. What does it cost, and will the same query give the same answer next year, after the vendor updates the model? And who else is asking it? A signal anyone can buy from the same public model is priced quickly.

Pause and predict. BERT could not predict returns from headlines; ChatGPT could. Name two explanations other than larger models understanding news better.

11Look-ahead biasUndergraduate3 min

Part one's first rule was point in time: a number used at time t may only depend on data from before t. How do you keep that rule with a model that has read the future?

Picture the usual experiment. The backtest asks a model about news from 2016 to 2020. But the model was trained on text up to 2023, which includes what happened after every one of those headlines: the earnings, the lawsuits, the share price. Its forecast can be memory. And unlike a leaked price in a backtest, you cannot find the leak by reading the code: it is somewhere in a trillion words of training data.

Paul Glasserman and Caden Lin separated two things a backtest of an LLM picks up. Skill, from reading the headline; plus look-ahead, from remembering what followed; minus distraction, errors from general firm context, as a conceptual decomposition rather than separately identified causal effects. Their tool: anonymise the headline, so Apple beats estimates becomes company X beats estimates. The gap between the named and anonymised backtests measures look-ahead minus distraction only under additional assumptions. Anonymisation can remove useful business context and leave indirect identifiers, so this gap does not identify those channels by itself.

Their result was a surprise. In sample, the anonymised headlines did better: the model's general knowledge of famous companies hurt more than its memory helped, especially for the largest firms in their sample. A genuinely later evaluation with a fixed earlier model prevents direct reading of those later outcomes. It does not certify every data, entity or version boundary. Anonymisation is a useful diagnostic, not a universal trading rule or proof that leakage vanished.

Suproteem Sarkar and Keyon Vafa turned this into a statistical test. Choose events that nothing before a date could have predicted: who won an election, given only a candidate's biography, under a specified pre-date information null. Beating a correctly calibrated chance baseline can provide evidence of leakage, but omitted predictive information or test misspecification can also reject the null. The authors report evidence that, in elections and in earnings calls. But the test is one-sided. It can catch a leak; it can never prove there is none.

The clean answer is to build the models so that they cannot cheat. Songrun He, Linying Lv, Asaf Manela and Jimmy Wu trained a series of language models, each on text available only up to its own date: one model for one date, another for a later date, and so on. For any backtest date, use the model of that date. Their models compete with larger open models on standard benchmarks, and their real-time trading results come close to the leaky state of the art, which suggests the look-ahead in the particular asset-pricing application was modest. This is an application-specific finding, not a universal bound on bias or a guarantee of performance. Our miniature compares dated corpora and tokenizers under its own limitations.

Pause and predict. A backtest anonymises Apple to company X but keeps the phrase the iPhone maker. What has it fixed, and what not?

12The time-sliced experimentMaster's5 min

We can measure look-ahead ourselves, with three copies of the small language model from Chapter nine, trained on three different slices of history.

The design. The test is the minutes of 2008 to 2012: the crisis, zero rates and asset purchases, a vocabulary the committee had never used before. Model A reads only the minutes with meeting dates up to 2007. Their release dates can be later, so this does not certify a model available on the first day of 2008. Model B reads everything to 2020, the test years included: the leak in its purest form. Model C reads up to 2007 and from 2013 on. It has never seen the test documents, but it has read the future that followed them: the way a large model trained on the internet relates to an old backtest. Each gets its own tokenizer, built from its own text, and the same token budget. Token counts do not equalise characters, distinct exposures or sample reuse. Corpus and tokenizer both change across models.

Watch each model's loss on the test minutes as it trains, in bits per character, so that the different tokenizers share a character denominator. This only partly normalises tokenisation: evaluation omits each document's first token and uses finite context windows. All three learn the committee's prose, and for a while they move together. For the separate full-document evaluation, model A scores bits per character. Model C, which adds years after the test, scores : about percent lower loss in this comparison. Both later text and tokenizer training differ, so this is not an isolated causal estimate of future knowledge. And model B, which read the test itself, scores , a further percent. The curves use six sampled batches per checkpoint, while these side values use full document-window evaluation; they are related but distinct measurements.

The statements make a cleaner test, because no model was trained on any statement. Here is each model's surprise at every year's statements. Before 2008 the three lines lie close together: all of them have read the committee's style. From 2008 model A's line jumps, from about bits per character in 2004 to 2007 to in 2009 to 2012: the statements began to talk about things it had never read. The models that had read the future notice much less. That gap is consistent with chronology-sensitive distribution shift; it is not a controlled estimate of a pure leakage channel. The statements also differ in genre from the minutes used for training.

Ask them directly. Each row gives a model the start of a sentence in the language the committee began to use in 2008, and asks how likely the true continuation is. The federal funds rate at zero to: model A, which has never seen a target range at zero, gives one quarter percent a probability of percent. Model C, which never saw 2008 either but read what came after, gives it percent. The same holds for the effective lower bound and for forward guidance, phrases model A has never met. Mortgage-backed securities were already in the committee's vocabulary before 2008, and all three models expect them. Words from the future, sitting in the weights, but these are selected probes. The helper can replace prefix tokenisation when a continuation crosses a BPE boundary, so the reported product is not always the exact conditional probability of the intended natural-language suffix.

Or let them write. Given the same prompt about deteriorating financial conditions, each model produces one continuation at temperature zero point seven with a fixed seed. The screen shows shortened excerpts, not the whole generated sample. Outputs can be ungrammatical or invent dates and policies. Compare the visible language across corpora, but one selected continuation cannot establish a causal memory effect, intelligence ranking or reliable policy understanding. A systematic generation study would require a defined prompt set, scoring rule and uncertainty.

So the look-ahead comes in two layers. The gap between A and C combines changes in later corpus and tokenisation, from a model that excludes the test window. That is one analogy for how a model trained on the internet relates to an old backtest, and anonymising company names does not remove it. The gap between C and B also changes the training corpus, including test-window text; it does not separately measure pure memory. Leakage tests target some related contamination channels. A model with verified pre-test training inputs is a strong chronology control, which is what chronologically consistent models provide. And on held-out minutes from before 2008, model A is the best of the three, bits per character against and : these gaps combine corpus, tokenisation, repetition and chronology. They do not separate skill from memory causally. All three models were monitored on the evaluation minutes during training; no gradient from those tokens enters A or C, and the original final checkpoint is used.

Pause and predict. Model C beats model A on the crisis minutes without having seen them. Would anonymising the minutes, removing every date and name, close the gap?

13LLM trading agentsPhD2 min

So far the language model has been a reader that produces a score. The newest systems go further: teams of models that argue, decide and trade. What do we know about them?

An agent is a loop around a language model. It observes: prices, news, its own past trades. It reasons, in words. It acts, by calling a tool: trade, or fetch more data. And it remembers, by writing the outcome back into what it will be shown next time. This is the ReAct pattern, reasoning interleaved with action. Nothing in the model is retrained. Only what it is shown changes, which is why a prompt, a memory and a set of tools are all part of the strategy.

Here is the design of one of the most discussed, TradingAgents, by Yijia Xiao, Edward Sun, Di Luo and Wei Wang. Four analyst agents read fundamentals, social-media sentiment, news and price charts. A bullish and a bearish researcher debate what the analysts found. A trader agent decides, and a risk-management team checks the exposure. Every box is a language model with its own instructions and tools: an investment firm's org chart, played by prompts. The authors report better cumulative returns, Sharpe ratios and drawdowns than standard rules on the stocks they tested.

Before believing any such result, ask Part twenty-six's questions. When did the underlying model stop reading? Every agent in the chart can leak the future. How many stocks and months? A few stocks for a few months is a handful of possibly dependent bets. A numerical Sharpe standard error also needs sampling frequency, tail and dependence assumptions; stock count alone cannot supply it. How many prompts, roles and tools were tried before this one? Each is a trial for the counter. And what does it cost to run a dozen model calls per stock per day? The architecture is interesting; the evidence, so far, is thin.

Pause and predict. An agent's backtest shows a Sharpe ratio of five, on three stocks over three months. What observation frequency, dependence assumptions and selection history would you need before calculating its standard error?

14Alternative dataIndustry3 min

Text is one kind of alternative data: information that is not a price, a volume or a filed number. What is a new data set worth, and what is it worth once everyone has bought it?

The menu is long. Satellite images of car parks, oil tanks and fields; panels of anonymised card spending that show a retailer's sales weeks before it reports; web traffic and app downloads and scraped prices; job postings; ships and planes. And text, the subject of this part. What they share: each measures something about a company's business before the company says it.

The cleanest evidence comes from space. Katona, Painter, Patatoukas and Zeng studied the satellite counts of cars in American retailers' car parks that were sold to investors over 2011 to 2017. Those who bought them could trade profitably ahead of quarterly reports, especially the bad ones. But the market as a whole did not become better informed in the way you might hope: short sellers with the data traded more, individual buyers without it lost out, and liquidity around the covered retailers' reports fell. Unequal access to data can widen the gap between investors without improving prices.

And one consequence for firms themselves. Christina Zhu found that when alternative data cover a company, its share price becomes more informative and its managers profit less from trading on inside information: big data as a governance mechanism.

The arithmetic of a shared data set is Kyle's model of an informed trader, which Part thirty-five derives, with more than one insider. N funds buy the same data, so each knows the same value; noise traders add their orders; a market maker prices the total. In equilibrium each fund trades less aggressively as N grows, because the others are trading on the same thing. Each fund's exact expected profit is sigma u times sigma v divided by N plus one times square root N. The N to the minus three halves rate is only its large-N approximation. The price reveals N over N plus one of the value variance. One buyer leaves half of that variance unexplained; ten leave one eleventh. These are risk-neutral, symmetric insiders sharing the same perfect Gaussian signal in a one-period model, not a universal law for real data vendors or portfolio returns.

Draw it. Each fund's profit against the number of funds with the data: from one buyer to two it falls from one half to one over three square root two, a drop of about fifty-three percent. The dots are a simulation of the market, two hundred thousand draws each, landing on the formula: for one, two and five buyers. Now let a vendor sell the data to more funds each year, along an S-shaped adoption curve. The profit of being a buyer collapses within a few years of the data's launch, in this illustrative adoption path. The path is chosen, not estimated from vendor customers; actual profits depend on signal noise, heterogeneous users, trading frictions, prices and access costs.

Pause and predict. A data set's buyers go from four to nine. By what factor does each buyer's profit fall, and what happens to the buyers' total?

15Domain models and the text deskIndustry2 min

If finance has its own vocabulary, as Loughran and McDonald showed, should it have its own language model? And how does a trading firm actually use any of this?

In March 2023 Bloomberg published BloombergGPT. Fifty billion parameters, trained on three hundred and sixty-three billion tokens of financial text from Bloomberg's own archives, news, filings and press releases among them, mixed with three hundred and forty-five billion tokens of general text as its corpus. The paper reports 569 billion training-token exposures from that corpus. On its dated financial benchmarks, the authors report gains over general models of a similar size, without losing much on general tasks: the case for a domain model, made by the firm with the most financial text in that study, not a universal ranking of later systems.

Put the sizes side by side, on a log scale. FinBERT, the finance-adapted BERT of Allen Huang, Hui Wang and Yi Yang, was trained on about five billion tokens of filings, calls and analyst reports. BloombergGPT assembled a roughly seven-hundred-billion-token corpus and trained on 569 billion exposures. The FOMC minutes we trained on ourselves in Chapter twelve are under two million: a few ten-thousandths of FinBERT's corpus, a millionth of the frontier's.

Within months the frontier moved. Testing ChatGPT and GPT-4 on the same kinds of financial tasks, Xianzhi Li and coauthors found GPT-4 ahead of BloombergGPT on almost all of them. General models were strongest at reasoning with the numbers in financial text, and still behind small fine-tuned specialists like FinBERT on sentiment. Scale and general reading beat a domain corpus in these reported comparisons; task, version, prompting and fine-tuning also differ. Narrow supervised tasks can still favour a specialist, but the ranking must be tested for the actual application.

How do firms use text? Many buy it already scored: vendors such as RavenPack sell every story tagged with the companies it mentions, its relevance, its novelty and a sentiment score, time-stamped to the millisecond. Others build their own features from filings, calls and news, feeding the models of Part twenty-seven; text is usually one column among hundreds, rarely a strategy on its own. Language models now read everything for the analysts and tag it for the models. And the hardest engineering is unglamorous: knowing exactly when each word became public, and which version of which model read it.

Pause and predict. A fifty-billion-parameter domain model loses to a larger general model within months. When would you still train your own?

16Text-signal evaluation protocolIndustry3 min

Explaining the statement day's move and forecasting a later return are different tasks. We now specify what a text signal would have to survive before anyone could interpret it as trading evidence. The original strategy experiment is excluded from this review: no cached payoff, registration, opening or score is read.

Start with three clocks. A document's meeting date is not necessarily its first release date; later archives can revise text. A model has its own clock: training corpus, tokenizer, version and tuning history. An order has another: collection, inference, transmission and execution delay. Keeping only a date integer does not establish any of these three boundaries.

Write the target before fitting. The daily reaction runs from the prior close to the release day's close. By that closing trade, most of this label is already observed. A future target begins at an executable entry after the signal is available. A contemporaneous correlation supplies no automatic direction, size or significance for that later target. Evaluation must also account for coupons, carry, curve changes and the instruments actually traded.

A fixed arithmetic example, with no market sample. Modified duration is one point nine, and yields rise ten basis points. The first-order long-bond price change is minus nineteen basis points of price. An ideal short earns nineteen before costs. If a round trip costs one basis point of yield, the duration approximation converts that to one point nine basis points of price, leaving seventeen point one. This is local duration arithmetic, not a total-return backtest, a measured cost or a strategy result.

The ledger already records configurations through Part twenty-eight, thirteen more than through Part twenty-seven. That is existing metadata, not a registration by this review. A recorded count is a lower bound on research choices, and correlated thresholds are not independent trials. None of these counts tells us the excluded strategy's payoff or its statistical significance.

A defensible protocol freezes the specification before later evaluation. Preprocessing and tuning belong inside the training boundary, with release and label-maturity clocks checked. Report all tried specifications and use uncertainty that reflects dependent events, non-normal returns and selection. An IID normal Sharpe precision approximation is not a power calculation, and a probabilistic Sharpe statistic is not automatically a Bayesian probability that an edge is real. The excluded experiment supplies no evidence here.

Pause and predict. A score explains the move from the prior close to the release day's close. What target, data clock and execution assumptions must change before you test a trade entered after that close?

17Rule 28: text featuresIndustry2 min

The House's twenty-eighth rule: what a feature made of words must survive. The first sheet. Thirty years of the committee's words, obeying Zipf's law. The dictionary showed little evidence of a linear association with this daily yield change. SESTM found words that fitted the past and did not travel. Embeddings learned that easing is to lower what tightening is to raise. The earlier-corpus language model was more surprised by the crisis, and the ones that had read the future much less. The strategy experiment remains excluded: no cached payoff, opening or score is read here. The count of 10,470 through Part twenty-eight is existing ledger metadata, with thirteen already-recorded configurations relative to Part twenty-seven; no new registration is made.

Part one's first rule, applied to words, is two small functions in the House. A model dated t may only know the vocabulary of documents dated before t; and for every word we keep the date it first appeared, in the supplied corpus. Pandemic existed before 2020, and first occurrence in a sample is not first existence or proof of public availability. These helpers filter date integers only: meeting date, release timestamp and archive vintage can differ. The original validation vocabulary and model C also use later text; do not call every pipeline point in time.

The tools this part adds. Counting; dictionaries; supervised words; meaning; form; and time. And the twenty-eighth rule. A text feature enters the House only if every document carries the moment it became public; every model and tokenizer that reads it was trained only on text from before that moment, with its version recorded; it beats the dictionary and a simple bag of words out of sample; and its signal survives the delay between the release of the words and the trade.

The rule against three cases. A language-model signal with a Sharpe ratio of four on news from 2015 to 2020: check the model's training cut-off, anonymise and re-run, then use a model dated before 2015. A dictionary score that explains the day's move: it explains, it does not predict; measure from the moment after release. A new data set everyone is buying: ask how many funds have it, and since when.

For the researcher: why screening finds the wordsPhD5 min

For the researcher: Chapter five's screen kept words whose appearances sided with rising yields more often than chance. Why should that find the true sentiment words at all? And how many documents does it need? We can answer under explicit generative and asymptotic assumptions, then inspect a finite diagnostic without treating it as a guarantee.

Assume independent or suitably ergodic articles, positive word-presence probability, finite expectations, and conditional independence of label sign and word presence given tone. Fix charged-word length, or integrate an independent length law. In SESTM's model, a charged word appears in an article with a probability q that rises with the article's tone if the word is positive, and falls if it is negative. As the number of articles grows, the screening statistic converges to the probability of a positive return given that the word appears: by Bayes' rule, the expectation of g times q, over the expectation of q. A neutral word's appearance does not depend on tone, so its limit is just the overall share of positive returns. For a positive word, the limit exceeds that share by a covariance between two functions of the tone, g and q, both nondecreasing. Strict separation also needs nondegenerate tone and a product of differences positive with positive probability; otherwise the inequality can be an equality.

That covariance is nonnegative, by a two-line argument. Take an independent copy of the tone, p prime. The covariance equals half the expected product of the differences, g of p minus g of p prime, times q of p minus q of p prime. Both functions increase, so the two differences always have the same sign, and every product is non-negative: Chebyshev's association inequality. So, in the limit, positive words sit above the overall share, negative words below only with a strict population gap. Neutral occurrence must be independent of tone; tone-dependent document lengths can break that conclusion. Finite-vocabulary recovery also needs a common gap and sufficient word frequencies; monotonicity alone is not a sample-size theorem.

With finitely many documents, the question is how many. Ke, Kelly and Xiu prove that the screen recovers exactly the right words, with probability tending to one, once the number of articles times the squared sensitivity of returns to tone, times the words' squared sentiment contrast, exceeds the square of the log of the vocabulary size, divided by how often the rarest words appear. Three things decide it: how strongly returns respond to tone, theta; how different the two topics are; and how long the articles are. Short articles and weak returns need many more documents. The displayed result requires the paper's document, frequency, balance and neutrality assumptions, with centring at one half rather than our helper's sample share. Its theta is the weighted association defined in equation C point ten, not the simulation's slope parameter; it is not a calibrated finite-sample guarantee for these dependent statements.

Check the lemma on a simulated world with a thousand words, forty of them charged, and twenty thousand articles. Each tick is one word's screening statistic. The triangles are the limits the lemma predicts: for positive words, the overall share for neutral ones, for negative. The simulated words gather around them: means of , and .

Now count how many documents it takes. With a heuristic threshold that lets few neutral words pass in these fixed simulations, plot the share of the true sentiment words found against the number of training articles. At the strongest simulated slope, with longer charged-word sequences, a thousand articles find percent of the words. At half that sensitivity it takes five thousand. With short articles, more again. And at a sensitivity of one fifth, a weaker association in this chosen world, five thousand articles find almost nothing. The FOMC statements are here, at .

So, on the statements, test the screen against chance. Shuffle the two-year moves among the statements five hundred times and screen again using the previously selected thresholds. Under this unrestricted-shuffle diagnostic, the screen keeps words on average. On the real labels it kept : a permutation p-value of . And the word-by-word screen of the simulation, which lets few neutral words through in our fixed simulation, keeps . These are empirical exceedance fractions over five hundred draws, not an exact universal p-value or proof that the selected words are all noise. Exchangeability is questionable across policy regimes, and the selected thresholds are not reselected inside each shuffle. The simulated sample sizes are illustrations, not a calibrated century-long requirement for the Fed.

Three open questions. The theorem assumes independent documents; statement days share regimes and news articles share stories; this result does not supply a dependence-adjusted rate for our application. Screening phrases or contextual embeddings multiplies the vocabulary, and the price grows with its log squared. And a prior from a large corpus, a dictionary or a language model, could shrink what a small labelled set must learn; how to combine them with guarantees is open.

Pause and predict. Suppose returns ignore tone entirely: g of p is one half for every p. What is the limit of the screening statistic for a positive word, and what does the screen find?

Recap, desk questions, problemsAll tracks4 min

Part twenty-eight in fourteen lines. Words become counts in a matrix, and their frequencies follow Zipf's law. Dictionaries are fitted to a genre: the psychologists' list misread annual reports, and the finance list misreads a central bank, whose mandate words count as bad news. The dictionary's tone said nothing about the bond market's reaction, because statements move yields through what they imply about the path of policy. The statement grew from a paragraph into the policy instrument, and its phrases about the future carry the news. Words learned from outcomes fitted the past and did not travel. Topic models found eras, and embeddings learned that easing is the opposite of tightening.

Transformers read words in context, and a small one learned the committee's prose on an ordinary computer. Versioned language-model papers report gains on selected tasks, while the financial-statement working paper we discussed was withdrawn after replication concerns. But a model that read the future can remember it; tests can catch some leaks, and dated models avoid them. Our own experiment measured the gap. Trading agents are an organisation chart of prompts, with limited evidence. Kyle gives an exact profit formula under strong common-signal assumptions, not a universal vendor-decay law. The sealed strategy experiment remains unread; the existing ledger records 10,470 configurations through this part, and this review registers none.

Six desk questions. A language-model signal with a Sharpe ratio of four on 2015 to 2020 news: check the model's training cut-off first, then anonymise, then use a model dated before 2015. A tone score that explains the day's move from the prior close is explaining, not forecasting. And a mandate word counted as negative calls for a genre-specific list, or better, weights learned from outcomes and checked out of sample.

words from documents: shuffle the labels and screen again before believing any of them. A data set whose buyers double each year loses almost two thirds only in the large-number approximation of this particular Kyle model; use its exact finite-number ratio before interpreting real customer data. And a general model that beats your specialist on recent data must be dated before the test before you switch. Full solutions are in the notes.

Twelve problems, in three groups. The first six cover tf-idf and length, Zipf's head, net tone, chance screening, the penalty as a prior and PMI. Problems seven through ten compare manual and heuristic fog, convert bits per character, qualify the anonymisation decomposition and calculate finite-buyer Kyle profits. Two qualifying problems prove the covariance identity and screening limits under explicit assumptions, then derive the symmetric Gaussian Kyle equilibrium. All twelve have full English and Chinese solutions in the notes.

Where this comes back. Part twenty-nine turns language models into alpha miners, and counts every formula they try. Parts thirty and thirty-one put text features into portfolios and risk models. Part thirty-five derives Kyle's informed trader, whose crowding we used here. And the finale returns to signal selection against the full research count; no excluded score is supplied here.

The textbooks this part follows, and the papers it draws on, from the General Inquirer in 1966 to the first chronologically consistent language models. Original research numbers come from the House code; public-paper claims are attributed, versioned and not replicated here. Mathematical examples and simulations are labelled, and excluded strategy scores are withheld.

The House now has a reading room: tools to turn the committee's words into features, a rule that requires a release-clock audit alongside supplied date integers, and the habit of asking what a model has already read. Next, Part twenty-nine: alpha mining and automated research. Machines that search millions of formulas for signals, language models that write their own research, and a trial counter that has to keep up.

Where it goes next. Agents that write and test their own signals are Part 29; language models as traders return in Part 42.

Key results

The part's results in one place, for revision.

TF-IDF\[w_{d,j}=\mathrm{tf}_{d,j}\cdot\ln\frac{N}{\mathrm{df}_j}\]
Screening\[f_j=\frac{\#\{\text{documents with word } j \text{ and a positive return}\}}{\#\{\text{documents with word } j\}}\]
Document tone\[\text{tone}_d=\frac{N^+_d-N^-_d}{N_d}\]
Attention\[\operatorname{softmax}\Bigl(\frac{QK^\top}{\sqrt d}\Bigr)V\]

Try it

Lab 28 · Screening for the words that carry sentiment

Generate documents from a 1,500-word vocabulary in which 30 words are planted with a tone that drives the return. Screen every word by how often its documents precede a rise (Ke, Kelly and Xiu's first step) and count how many planted words come back as the corpus grows.

Figure produced by Lab 28: Screening for the words that carry sentiment
Produced by the lab below, seed 0, in 0.8 s. Simulated data.
python -m videos.quant.labs 28 needs numpy, scipy, matplotlib, numba · download lab28.py · source on GitHub
  250 documents  kept   2 words:  1 of 30 planted (1 with the right sign), 1 false
  500 documents  kept   1 words:  1 of 30 planted (1 with the right sign), 0 false
1,000 documents  kept   8 words:  5 of 30 planted (5 with the right sign), 3 false
2,000 documents  kept  14 words: 12 of 30 planted (12 with the right sign), 2 false
4,000 documents  kept  24 words: 23 of 30 planted (23 with the right sign), 1 false
8,000 documents  kept  31 words: 29 of 30 planted (29 with the right sign), 2 false

Screening is 1,500 tests at once: the threshold z = 3 trades a few false words for the planted ones.
The code (76 lines; it asserts its own result)
"""Lab 28: find the words that move prices: screening a planted vocabulary out of noise."""

import numpy as np

from videos.quant import labs
from explainer.quant.house import text

TITLE = "Screening for the words that carry sentiment"
GOAL = ("Generate documents from a 1,500-word vocabulary in which 30 words are planted with a tone that drives the "
        "return. Screen every word by how often its documents precede a rise (Ke, Kelly and Xiu's first step) and "
        "count how many planted words come back as the corpus grows.")
TASKS = [
    "Weaken the tone's effect on returns (noise sd from 1 to 3). How many documents restore the recall?",
    "Screen with a fixed alpha instead of the z-threshold. What goes wrong for rare words?",
    "Score a held-out document with text.sestm_topics and text.sestm_score and correlate the score with its return.",
]


def corpus(n_docs, seed, vocab=1500, planted=30, length=60):
    """Documents as word-count rows; half the planted words are positive, half negative; returns follow the tone."""
    rng = np.random.default_rng(seed)
    freq = 1.0 / np.arange(1, vocab + 1) ** 0.9  # a Zipf-like vocabulary
    words = rng.choice(np.arange(50, 600), planted, replace=False)
    pos, neg = words[: planted // 2], words[planted // 2:]
    tone = rng.uniform(0, 1, n_docs)
    D = np.zeros((n_docs, vocab), int)
    for i, p in enumerate(tone):
        w = freq.copy()
        w[pos] *= 1 + 3 * p
        w[neg] *= 1 + 3 * (1 - p)
        D[i] = rng.multinomial(length, w / w.sum())
    y = (tone - 0.5) * 4 + rng.standard_normal(n_docs)  # the return: tone plus noise
    return D, y, pos, neg


def run(seed=0):
    sizes = [250, 500, 1000, 2000, 4000, 8000]
    lab = labs.Lab()
    recall, precision = [], []
    for n in sizes:
        D, y, pos, neg = corpus(n, seed)
        out = text.sestm_screen(D, y, kappa=5, z=3.0)
        found = set(out["pos"]) | set(out["neg"])
        truth = set(pos) | set(neg)
        hits = len(found & truth)
        signed = len(set(out["pos"]) & set(pos)) + len(set(out["neg"]) & set(neg))
        recall.append(hits / len(truth))
        precision.append(hits / max(len(found), 1))
        lab.row(f"{n:>5,} documents", f"kept {len(found):>3} words: {hits:>2} of 30 planted ({signed} with the right sign), "
                                      f"{len(found) - hits} false")
        assert signed == hits
    lab.note = "Screening is 1,500 tests at once: the threshold z = 3 trades a few false words for the planted ones."
    assert recall[-1] > 0.9 and recall[0] < recall[-1] and precision[-1] > 0.8

    D, y, pos, neg = corpus(4000, seed)
    out = text.sestm_screen(D, y, kappa=5, z=3.0)
    fig, ax = labs.figure(2, size=(11, 4.2))
    k = np.maximum(out["k"], 1)
    colors = np.full(D.shape[1], labs.MUTED, dtype=object)
    colors[pos], colors[neg] = labs.GAIN, labs.LOSS
    order = np.argsort(np.isin(np.arange(D.shape[1]), np.concatenate([pos, neg])))
    ax[0].scatter(k[order], out["f"][order], c=list(colors[order]), s=8)
    kk = np.logspace(0.7, np.log10(k.max()), 100)
    half = 3.0 * np.sqrt(out["pi"] * (1 - out["pi"]) / kk)
    ax[0].plot(kk, out["pi"] + half, color=labs.P, lw=1)
    ax[0].plot(kk, out["pi"] - half, color=labs.P, lw=1)
    ax[0].set_xscale("log")
    ax[0].set(title="Each word: share of its documents before a rise", xlabel="documents containing the word",
              ylabel="share with a positive return", ylim=(0.2, 0.8))
    ax[1].plot(sizes, 100 * np.array(recall), "o-", color=labs.GAIN, label="planted words recovered")
    ax[1].plot(sizes, 100 * np.array(precision), "o-", color=labs.P, label="kept words that are real")
    ax[1].set_xscale("log")
    ax[1].set(title="Recovery against the size of the corpus", xlabel="documents", ylabel="%", ylim=(0, 105))
    ax[1].legend(fontsize=8)
    lab.fig = fig
    return lab

Now change it

  1. Weaken the tone's effect on returns (noise sd from 1 to 3). How many documents restore the recall?
  2. Screen with a fixed alpha instead of the z-threshold. What goes wrong for rare words?
  3. Score a held-out document with text.sestm_topics and text.sestm_score and correlate the score with its return.

Problems, with solutions

Try each problem before opening its solution; the last two of each set are at qualifying-exam level.

Desk questions, with solutions

  1. Sharpe 4 on 2015–2020 news. Audit model/tokenizer versions, training dates and document release clocks before interpreting the backtest. Anonymisation is a diagnostic with possible context loss and residual identity clues. Use a verified earlier model or genuinely later frozen evaluation, preserve selection history and costs; a cutoff declaration alone does not prove independence.
  2. Tone explains 30% of the daily move. A prior-close-to-release-close label is substantially realised by a trade at that close. Define a future executable-entry target and refit/evaluate it separately. A daily correlation does not isolate the words' causal effect or demonstrate residual drift.
  3. “Unemployment” is frequent and negative. Inspect contexts and compare genre-specific features with learned weights, using independent release-aware validation. Do not delete it because of test outcomes. Its mandate role can explain frequency, but does not make every occurrence uninformative.
  4. A small sample screens many words. Compare with a selection-aware null under defensible dependence/exchangeability assumptions. The original 500 shuffles keep selected thresholds fixed and omit reselection; their exceedance fraction is only a limited diagnostic. A plug-in z threshold does not automatically solve multiplicity or small counts.
  5. Buyers double. Exact Kyle each-profit ratio is (N+1)/(sqrt(2)(2N+1)), tending to 2^-3/2. At N=1 it is 2/(3sqrt(2)), not the large-N limit. Price, noise, user differences and access/execution costs are absent from that formula; measure real economics separately.
  6. A general model beats a specialist. Freeze versions and compare on relevant, independent, release-aware tasks with common targets, costs and latency. Published performance in a 2023 benchmark does not ensure a specialist or general model wins in a later application.

Problems, with worked solutions

Problems 1–6, with solutions

  1. Count scaling and tf-idf. Show that cosine similarity of tf-idf rows does not change when every count in a document is doubled.

    Solution

    For a nonzero row d, tf(c d)=c d/(c sum d)=tf(d) for c>0. Holding corpus IDF fixed, multiplication and unit-length normalisation therefore return the same vector, so its cosine with any other nonzero row is unchanged. If the corpus/DF itself changes, that qualification matters; zero-row cosine is not mathematically defined by this argument.

  2. Zipf head. Zipf with frequency \(\propto 1/r\) over \(V = 10{,}000\) words: what share of tokens do the top 100 words cover?

    Solution

    With frequency proportional to 1/r, top-100 share among 10,000 types is H_100/H_10000. Using H_100≈5.18738 and H_10000≈9.78761 gives approximately 0.52999, or 53.0%. The logarithm-plus-Euler-constant approximation explains the scale but is not the exact harmonic sum.

  3. Net tone. A 300-word statement has 6 negative and 3 positive words. Its net tone? And if 'unemployment' (2 of the 6) is dropped from the negative list?

    Solution

    (3−6)/300=−1%. Removing two “unemployment” counts from the negative list, while keeping all 300 document tokens in the denominator, gives (3−4)/300=−1/300≈−0.333%. Deleting the tokens themselves instead would change the denominator and define another feature.

  4. Chance screen. 300 words each appear in exactly 10 statements; the labels are fair coin flips. How many pass \(|f_j - \frac12| \ge 0.2\)?

    Solution

    With ten independent fair labels for each word, X~Binomial(10,1/2) and the screen is X≤3 or X≥7. Its probability is 2(1+10+45+120)/1024=352/1024=0.34375. Expected passing count is 300×0.34375=103.125. Linearity of expectation does not require independence across words; the variability of the passing count does depend on shared labels. Estimating pi and selecting thresholds changes this toy null.

  5. Penalty as prior. Show that SESTM's penalty \(\lambda\log p(1 - p)\) is a \(\text{Beta}(\lambda + 1, \lambda + 1)\) prior on \(p\).

    Solution

    A Beta(a,b) density is proportional to p^(a−1)(1−p)^(b−1). Adding lambda log(p(1−p)) to an unnormalised count log likelihood is a Beta(lambda+1,lambda+1) log prior, for lambda>−1. For the implemented nonnegative lambda it shrinks toward 1/2. Dividing both likelihood and penalty by the same positive token count does not change their argmax; a finite grid and an explicit zero-count fallback remain numerical conventions.

  6. PMI and truncation. Show that \(\mathrm{PMI}(w, c) = \log P(c \mid w)/P(c)\) is zero for independent words, and why PPMI drops negatives.

    Solution

    For positive probabilities, PMI(w,c)=log(P(w,c)/(P(w)P(c)))=log(P(c|w)/P(c)). Independence gives zero; below-chance co-occurrence gives a negative value. PPMI discards the negative part as a representation choice, not because every negative relation is noise. The original helper replaces P(c) by its power-0.75-smoothed marginal, so ordinary independence need not give zero in that modified statistic.

Problems, with worked solutions

Problems 7–10, with solutions

  1. Fog by hand and by the helper. Compute the fog index of: `The Committee decided today to keep its target for the federal funds rate unchanged.'

    Solution

    “The Committee decided today to keep its target for the federal funds rate unchanged.” has 14 word tokens and one sentence. With ordinary manual syllables, Committee, decided and federal have at least three syllables; unchanged has two. Thus 0.4(14+100×3/14)=14.1714. The unchanged vowel-group helper also counts unchanged as three syllables, giving four long words and 0.4(14+100×4/14)=17.0286. Report the convention; neither number certifies reader comprehension or schooling requirements.

  2. Bits per character. A model's loss is 3.5 nats per token, with 4.2 characters per token. Bits per character?

    Solution

    If the loss and token/character denominator cover the same sequence, 3.5/(ln(2)×4.2)=1.20225 bits per character. For document-wise windowed evaluation, missing first-token likelihoods and context boundaries must also be stated; a token-average conversion does not restore missing terms.

  3. Named versus anonymised. In sample, named headlines give a Sharpe ratio of 1.2 and anonymised ones 1.5. What does Glasserman–Lin's decomposition say under its assumptions, and why is this not a causal identification?

    Solution

    Under the stipulated additive model and the assumption anonymisation changes only memory and distraction, the difference is 1.2−1.5=−0.3, interpreted as b−d=−0.3. It does not separately determine b or d. If both later scores equal 0.8, that later observed gap is zero. Context loss, indirect identifiers, different selection and sampling uncertainty can invalidate the stipulated causal reading; the observed differences alone do not identify skill or prove leakage absent.

  4. Kyle 4 to 9 buyers. Kyle with \(N\) informed buyers: from 4 to 9 buyers, by what factor does each one's profit fall, and the total?

    Solution

    Each-profit ratio is [(4+1)sqrt(4)]/[(9+1)sqrt(9)]=10/30=1/3. Total profit is proportional to sqrt(N)/(N+1), so its ratio is (3/10)/(2/5)=3/4. Explained value-variance shares are 4/5 and 9/10. These are model expectations, not realised annual Sharpe ratios.

Problems, with worked solutions

Problems 11–12: qualifying proofs

  1. Association and screening. (qual) For increasing \(g, q\) on \([0, 1]\) and \(p\) any distribution, prove \(\operatorname{Cov}(g(p), q(p)) \ge 0\). Deduce the limits of \(f_j\) for positive, negative and neutral words in SESTM's model.

    Solution

    Let p and p′ be independent copies, with integrable products. Expanding yields E[(g(p)−g(p′))(q(p)−q(p′))]=2E[gq]−2E[g]E[q]=2Cov(g,q). If both functions are nondecreasing, every product of differences is nonnegative, hence covariance is at least zero. It is strictly positive exactly when the nonnegative product is positive with positive probability. Constant g or a degenerate p distribution gives equality.

    For IID articles (or an LLN sufficient for both averages), let A indicate word occurrence and Y indicate a positive label. If E[A]>0, the ratio sum AY/sum A tends to E[AY]/E[A]. Assume E[AY|p]=g(p)q_j(p). Then the limit is E[g q_j]/E[q_j]=pi+Cov(g,q_j)/E[q_j], with pi=E[g]. For fixed positive charged-word length s, q_j(p)=1−(1−p O+,j−(1−p)O−,j)^s; its derivative has the sign of O+,j−O−,j. Positive contrast gives a weak upper inequality, negative contrast a weak lower inequality, and a strict gap requires the strictness condition above. A neutral word has limit pi only when its occurrence is independent of tone (or its covariance with g vanishes); tone-related lengths can break neutrality. This population lemma alone does not give a uniform finite-sample screen, a minimum gap or a word-frequency bound.

  2. Symmetric Gaussian Kyle equilibrium. (qual) Kyle (1985) with \(N\) symmetric insiders sharing \(v\): derive \(\beta\), \(\lambda\), each insider's profit, and show \(\operatorname{Var}(v \mid p) = \sigma_v^2/(N + 1)\).

    Solution

    Take centred v~N(0,sigma_v²), independent u~N(0,sigma_u²), positive variances, N risk-neutral insiders observing v, and a competitive market maker observing aggregate flow y. Seek x_i=beta v, p=lambda y, y=N beta v+u'. Given others' rule, insider i maximises x_i[v−lambda x_i−lambda(N−1)beta v]. The strictly concave first-order condition gives 2lambda x_i=[1−lambda(N−1)beta]v, hence beta=1/[lambda(N+1)]` in a positive linear equilibrium.

    Gaussian pricing gives lambda=Cov(v,y)/Var(y)=N beta sigma_v²/(N² beta² sigma_v²+sigma_u²). Combining the equations yields beta²=sigma_u²/(N sigma_v²). Taking the positive root, beta=sigma_u/(sigma_v sqrt(N)) and lambda=sigma_v sqrt(N)/[(N+1)sigma_u]. Since lambda N beta=N/(N+1), expected each profit is beta sigma_v²[1−lambda N beta]=sigma_u sigma_v/[(N+1)sqrt(N)]. Gaussian conditional variance is sigma_v²−Cov(v,y)²/Var(y)=sigma_v²/(N+1). Positive lambda makes observing p equivalent to observing y, so the same expression is Var(v|p). Total expected insider profit is sqrt(N)sigma_u sigma_v/(N+1). No statement about vendor revenue, noisy heterogeneous signals or multiperiod trading follows without extending the model.


Reading and notes

The part's papers

from READING.md

  • Antweiler, W., Frank, M. (2004). "Is all that talk just noise? The information content of internet stock message boards." Journal of Finance.
  • Tetlock, P. (2007). "Giving content to investor sentiment: the role of media in the stock market." Journal of Finance.
  • Tetlock, P., Saar-Tsechansky, M., Macskassy, S. (2008). "More than words: quantifying language to measure firms' fundamentals." Journal of Finance.
  • Loughran, T., McDonald, B. (2011). "When is a liability not a liability? Textual analysis, dictionaries, and 10-Ks." Journal of Finance; (2016) "Textual analysis in accounting and finance: a survey." JAR.
  • Hansen, S., McMahon, M., Prat, A. (2018). "Transparency and deliberation within the FOMC: a computational linguistics approach." QJE.
  • Araci, D. (2019). "FinBERT: financial sentiment analysis with pre-trained language models." arXiv.
  • Gentzkow, M., Kelly, B., Taddy, M. (2019). "Text as data." Journal of Economic Literature.
  • Ke, Z. T., Kelly, B., Xiu, D. (2019). "Predicting returns with text data." NBER WP.
  • Zhu, C. (2019). "Big data as a governance mechanism." RFS.
  • Cohen, L., Malloy, C., Nguyen, Q. (2020). "Lazy prices." Journal of Finance.
  • Shapiro, A. H., Wilson, D. (2022). "Taking the Fed at its word: a new approach to estimating central bank objectives using text analysis." REStud.
  • Chen, Y., Kelly, B., Xiu, D. (2022). "Expected returns and large language models." Working paper.
  • Huang, A., Wang, H., Yang, Y. (2023). "FinBERT: a large language model for extracting information from financial text." Contemporary Accounting Research.
  • Gorodnichenko, Y., Pham, T., Talavera, O. (2023). "The voice of monetary policy." AER.
  • Wu, S., et al. (2023). "BloombergGPT: a large language model for finance." arXiv.
  • Lopez-Lira, A., Tang, Y. (2023). "Can ChatGPT forecast stock price movements? Return predictability and large language models." Working paper.
  • Hansen, A. L., Kazinnik, S. (2023). "Can ChatGPT decipher Fedspeak?" Working paper.
  • Glasserman, P., Lin, C. (2023). "Assessing look-ahead bias in stock return predictions generated by GPT sentiment analysis." J. Financial Data Science.
  • Bybee, L., Kelly, B., Manela, A., Xiu, D. (2024). "Business news and business cycles." Journal of Finance.
  • Kim, A., Muhn, M., Nikolaev, V. (2024). "Financial statement analysis with large language models." Working paper.
  • Cao, S., Jiang, W., Wang, J., Yang, B. (2024). "From man vs. machine to man + machine: the art and AI of stock analyses." JFE.
  • Sarkar, S. K., Vafa, K. (2024). "Lookahead bias in pretrained language models." Working paper.
  • Xiao, Y., Sun, E., Luo, D., Wang, W. (2024). "TradingAgents: multi-agents LLM financial trading framework." arXiv.
  • He, S., Lv, L., Manela, A., Wu, J. (2025). "Chronologically consistent large language models." arXiv 2502.21206.
  • Katona, Z., Painter, M., Patatoukas, P., Zeng, J. (2025). "On the capital market consequences of big data: evidence from outer space." JFQA 60(2).
  • Also on screen in Part 28: Kyle (1985); Admati and Pfleiderer (1988); Kuttner (2001), JME; Gürkaynak, Sack and Swanson (2005), IJCB; Meade and Stasavage (2008), Economic Journal; Mikolov et al. (2013); Levy and Goldberg (2014); Loughran and McDonald (2014), "Measuring readability in financial disclosures," JF; Yao et al. (2023), ReAct; Li et al. (2023), "Are ChatGPT and GPT-4 general-purpose solvers for financial text analytics?", EMNLP industry track.
Data, scope and reproducibilityData and reproducibility

The unchanged reader builds the public index from historical meeting pages and the calendar, then downloads and verifies extracted statements/minutes through 2025 before ordinary research masks. phrases intentionally retains the later dates. Daily DGS2/DGS10 are checked as normalised frozen 1996–2025 extracts; their raw source can have later vintages. These ordinary public reads do not open or score the strategy envelope. Dead links and unavailable year pages may be skipped by the original reader, and its text-extraction filters omit blocks; the result is a linked-page extract, not proof of a complete historical institutional record.

Run audited ordinary originals individually; do not run the default all-items command, which includes the excluded experiment. A presentation load guard rejects every case-insensitive envelope prefix before counted/cache access. Public-input checks must retain the frozen manifest and reject unrecorded keys; no refresh or replacement historical strategy is permitted. Source snapshots and read events live in renders/qa/quant28/; completed stages link their immutable audits under docs/qa/.

Relevant pure checks: python -m pytest -q tests/test_quant_house.py -k 'text or sestm or embeddings'. Bilingual frames, silent motion, native frames, exact warning intervals, sampled speech and an actual narrated opening will be reviewed on a frozen final fingerprint. Silent previews and signal checks do not certify continuous production listening or pronunciation.

Primary versions checked for this revision: Lopez-Lira–Tang v6, withdrawal notice, Glasserman–Lin v1, He–Lv–Manela–Wu v3, and Ke–Kelly–Xiu, NBER 26186, November 2019 revision. Public snapshots retain their versions and SHA-256 evidence. The chapter references also include Gentzkow–Kelly–Taddy (2019), Kelly–Xiu (2023), Jurafsky–Martin, Tetlock (2007), Loughran–McDonald (2011, 2014), Kuttner (2001), Gürkaynak–Sack–Swanson (2005), Hansen–McMahon–Prat (2018), Levy–Goldberg (2014), Huang–Wang–Yang (2023), Bybee et al. (2024), Kyle (1985), Admati–Pfleiderer (1988), Katona et al. (2025), Wu et al. (2023) and Li et al. (2023).

Chapter notesChapters and interpretation
  1. Hook: one sentence. The original reader chooses the largest absolute daily two-year-yield change associated with a statement date. Its prior-close-to-day-close interval contains the policy decision and other news; it neither isolates a minute-level causal text effect nor establishes an executable forecast. The word-difference view is a selected excerpt, not the full statement.
  2. Words as numbers. Tokenisation drops numbers and punctuation, preserves certain internal hyphens/apostrophes and counts words in a document-term matrix. Zipf's slope is fitted on ranks 10–1,000; neither an approximate straight range nor annual vocabulary growth proves a universal power law. The original smoothed IDF is log((1+n)/(1+df))+1: a word in every document has IDF one, not zero. Unit row normalisation leaves nonzero tf-idf rows invariant to multiplying their counts by a positive constant, with the corpus IDF held fixed.
  3. Dictionaries. Tetlock and Loughran–McDonald are attributed literature results. The original 1993–2025 master dictionary is retrospective when applied to earlier documents. Mandate terms can be frequent without measuring an isolated sentiment shock; their context can still contain news. Removing words after inspecting test outcomes introduces another selection choice.
  4. Tone and the two-year yield. Conventional linear-regression statistics describe this selected daily sample. Weak evidence for the net-tone slope does not prove text contains no information. Intraday policy-surprise identification in Kuttner and Gürkaynak–Sack–Swanson differs from this daily regression; dependence and selection are not corrected by the original standard errors.
  5. Form and guidance. The fog helper uses vowel-group syllable approximations, not verified reading grades. 1-cosine uses full-research vocabulary and IDF and is not a literal fraction of changed words. Its correlation with absolute yield change is descriptive. The phrase inventory deliberately reads later public documents through 2025; those public raw texts are distinct from the excluded strategy experiment. All phrase ticks move with their axes and labels.
  6. Supervised words: SESTM. A mixture of charged-word topics links latent tone to label sign under a stated generative model. The original FOMC grid fits early years and validates in 2007–2012, but constructs its vocabulary through 2012 first: validation-era word frequencies enter preprocessing. Zero and missing yield-change labels are removed. Rank regression, nonnegative clipping, column normalisation and finite-grid penalised scoring are implementation choices. Weak later correlation can reflect chance, regime change or misspecification; the comparison does not identify which cause dominates. Ke–Kelly–Xiu's stock results are reported gross results from the cited paper, not replicated FOMC returns.
  7. Topics. NMF minimises a matrix reconstruction objective; LDA has a separate probabilistic model. For positive diagonal C, WH=(WC)(C^-1 H). Consequently, row-normalised W depends on factor scaling and is a display convention, not an identified agenda probability. Whole-period factors and names assigned by the presenter form a retrospective description, not a causal history.
  8. Inside the FOMC. Statements, minutes, transcripts, projections and press conferences have different release delays and audiences. Hansen–McMahon–Prat's transcript study concerns the 1993 transparency change. A before/after plot of minutes length near the 2005 release change does not isolate its causal effect.
  9. Embeddings. Original co-occurrences use inverse distance within five words. The context marginal is smoothed with power 0.75 before positive PMI and SVD. This differs from unsmoothed PMI and from exact finite training of every word2vec model. The SGNS/shifted-PMI connection has its own assumptions. Antonyms can share contexts; neighbours do not establish equal financial polarity. A selected analogy or two-dimensional PCA projection is a descriptive illustration.
  10. Transformers and FinBERT. The attention arrows are fixed illustrations. Masking, residual paths, feed-forward layers and positions also matter. The three original pocket decoders use independently trained byte-level BPE tokenizers, 4 layers, dimension 160, 4 heads, context 256 and the original four-million-token training budget. Byte pieces can encode unseen words; a date-restricted tokenizer restricts learned frequencies, not the ability to spell a later word. “Pandemic” existed before 2020.
  11. LLMs read the news. Version-specific public-paper claims are attributed and not replicated here. Kim, Muhn and Nikolaev's Financial Statement Analysis with Large Language Models was withdrawn in version 3 on 20 February 2025: a co-author found data and analysis inconsistencies while attempting replication. Earlier accuracy/profitability figures are withheld, not presented as established findings. Lopez-Lira–Tang v6, October 2025, covers 159,137 firm-headline-date observations and 4,123 firms, October 2021–May 2024. Roughly 90% portfolio-day success refers to the initial response, explicitly described as non-tradable, not headline accuracy. Reported subsequent drift hit rates are 58%/55%, gross Sharpe ratios 2.97/2.63; 20 bp round-trip costs erase profitability in their analysis. A declared September 2021 cutoff for fixed gpt-4-0314 is not an independent audit of the full training corpus.
  12. Look-ahead. Skill + memory − distraction is a conceptual decomposition. Named-versus-anonymised comparisons remove useful context and may retain indirect identity clues; their difference does not separately identify causal channels without additional assumptions. Leakage-test rejection requires a valid pre-date-information null and calibrated size. Failure to reject does not certify no leakage. He–Lv–Manela–Wu's v3 chronology constraints and modest bias in their asset-pricing application do not imply a universal bias bound or performance guarantee.
  13. Time slices. A uses minutes with meeting dates through 2007; B includes 2008–2012 test-window text; C excludes that window but includes later years. A meeting-date cutoff is not a release-time certificate: late-2007 minutes may be released in 2008. Equal token budgets do not equalise characters, distinct documents or repetition, and the tokenizers also differ. The original trainer evaluates the 2008–2012 minutes every 40 steps and returns its final checkpoint, rather than selecting minimum test loss. A/C receive no gradient from those evaluation tokens; the set is still repeatedly inspected. Character-normalised loss partly adjusts tokenisation but omits each document's first token and uses finite contexts. Statement evaluation also changes genre. Original continuation probes can change prefix segmentation at a BPE boundary; their products need not equal the exact natural-language suffix probability. A−C and C−B are comparisons across pipelines, not separately identified pure future-knowledge and memory effects.
  14. Agents. A role/prompt/tool diagram is an architecture, not profitability evidence. Model versions, prompt search, tool data clocks, execution, latency and costs belong in the evaluated specification. A short period on several correlated stocks does not provide independent repetitions; a Sharpe standard error needs frequency, distribution and dependence assumptions.
  15. Alternative data. The fixed Gaussian one-period Kyle model assumes risk-neutral symmetric insiders with the same perfect value signal and independent noise flow. Each expected profit is exactly sigma_u sigma_v / ((N+1)sqrt(N)); N^-3/2 is its large-N rate. Explained value variance is N/(N+1). The chosen logistic adoption curve is illustrative, not estimated customer growth or a universal vendor-revenue decay law. Satellite-data and governance papers are attributed studies, not computations reproduced here.
  16. Domain models. Dated FinBERT, BloombergGPT and general-model benchmark comparisons need their task and version context. Corpus size is distinct from training-token exposures, and different tokenizers produce incomparable raw token units. BloombergGPT assembled roughly 708–709 billion corpus tokens and reports 569 billion training-token exposures in v1; these are distinct counts. Domain versus general superiority cannot be inferred from scale alone. No external LLM or trading-agent API is invoked in this presentation pass.
  17. Text-signal evaluation protocol. Separate document, model and execution clocks. Freeze target, preprocessing, tuning, costs and comparisons before later evaluation, and purge outcomes that have not matured at a fitting boundary. Fixed example only: duration 1.9 and a +10 bp yield move imply approximately −19 bp long-bond price change. An ideal short earns +19 bp gross; an assumed one-bp yield round-trip cost converts to 1.9 bp of price, leaving 17.1 bp. This ignores convexity, coupons, carry, financing and curve risk; it is neither a historical strategy nor a measured execution cost. A probabilistic Sharpe statistic is not automatically a posterior probability, and an IID precision approximation is not power.
  18. House. point_in_time_vocab filters supplied date integers; first_use reports first occurrence in that corpus. Neither supplies release timestamps, archive vintages or first existence of a word. Validation vocabulary, later dictionary editions and model C are explicit chronology limitations. A ledger count is a research-choice lower bound, not an independent-trial estimate.
  19. Research. The population association lemma requires an LLN, positive word-occurrence probability, integrability and conditional factorisation of occurrence and label sign given tone. Neutral occurrence must be independent of tone; tone-dependent document length can violate that condition. Nondecreasing functions give a weak covariance inequality; strict separation requires positive probability of strictly concordant differences. Ke–Kelly–Xiu Theorem C.2 additionally assumes model (1)–(4), conditions (C.6)–(C.9) and (C.11), including frequency, balance and neutrality restrictions. Its centre is 1/2 and its theta is the weighted association in (C.10), not numerically the simulation's slope parameter. The original sample-pi and plug-in z screens are distinct finite implementations. sqrt(2 log m) alone is not finite-sample familywise-error control for dependent, estimated statistics. The 500 unrestricted shuffles reuse selected thresholds without retuning and require exchangeability; their exceedance fraction is a diagnostic, not proof that all selected words are noise. The histogram reports how many of the 500 runs remain in stored bins 0–59. Eight simulation seeds per point are not a calibrated FOMC sample-size requirement.
  20. Recap, six desk questions and twelve problems. Continuous problem numbering uses groups 1–6, 7–10 and 11–12; the last two are qualifying-level proofs. Full English and Chinese solutions follow.

Companion films in this repository

中文讲义

本讲的中文说明、交易台问题与习题解答(与英文版对应)。

导言量化金融,从零搭建 — 第28部分:文本、大语言模型与另类数据

本部分共二十章,连接文本表示、央行沟通、有监督筛选、本地语言模型和另类数据经济学。科学表述修订进行中;双语构造、最终视觉审查及证据尚未完成,不代表完整成片连续听审已通过。

原始 compute.py 和公司算法保持不变。仅调用经过审计的普通原始计算,不强制重算、不刷新数据。策略实验 envelope 在带计数的缓存加载器之前即被拒绝;不读取其缓存、收益或分数,不登记、不打开、不评分。相应章节讲评估流程和明确标注的固定久期算例。公司总结与回顾也不展示被排除分数。截至第28部分已有 10,470 项登记,比第27部分多十三项;全局为 23,562。这些是既有元数据,本轮不新增市场试验。

Chapter notes章节与解释边界

开场及词项矩阵使用公开链接页面的提取语料,不保证完整历史档案。齐普夫斜率拟合排名10至1000;年度词汇累计图不证明无限增长或精确幂律。平滑IDF对每篇文档都出现的词等于一而非零。词典1993至2025版用于早期文本具有回顾性质;央行职责词的上下文仍可包含新闻。

语气回归的标签从前一交易日收盘到声明日或之后第一个交易日收盘,包含政策决定及其他新闻;既不是可执行预测,也不单独识别文字的因果效应。常规标准误没有处理依赖或筛选。迷雾指数使用元音组音节近似;余弦变化使用完整研究期词汇和IDF,不是逐字改写比例。短语图刻意覆盖截至2025年的后期公开文本,区别于未读取的策略实验。

SESTM先用截至2012年的文档构建词汇,再拟合早期年份并在2007至2012年验证,因此验证期词频进入预处理。零和缺失标签被排除。秩回归、非负截断、列归一化和有限网格得分是实现选择;较弱的后期相关不单独识别偶然拟合、制度变化或模型错设。NMF与LDA的目标不同;WH=(WC)(C^-1H) 表明行归一化W只是展示约定,不是唯一识别的议题概率。

共现向量使用五词窗口、距离倒数及0.75次幂平滑上下文边际。有限正PMI的SVD与所有word2vec训练不数值等价;反义词可共享语境,二维投影与选取的类比只是描述。注意力箭头为固定示意。字节级BPE能拼写未见过的词;“pandemic”并非2020年才出现。

语言模型文献需明确版本与交易成本。Kim、Muhn和Nikolaev的财务报表工作论文在2025年2月20日的第三版撤回,作者称共同作者复现时发现数据与分析不一致;旧准确率和盈利数字予以撤下。Lopez-Lira与Tang第六版覆盖159,137个公司—标题—日期观测、4,123家公司,2021年10月至2024年5月。约90%的组合日命中率指作者明确称不可交易的初始反应,不是标题分类准确率;后续漂移命中率58%/55%,毛夏普2.97/2.63,20基点往返成本抹去其分析中的盈利。声明训练截止日期不能独立审计完整训练语料。

匿名化可能删除有效背景、留下间接标识,命名与匿名差异不能无条件识别记忆和分心。泄漏检验需有效的时点前信息原假设及尺寸控制;未拒绝不证明无泄漏。时间一致模型在特定应用中的较小偏差不等于普遍保证。

A使用会议日期截至2007年的纪要;会议日期可能早于发布日期,故不证明2008年初可获得。B包含2008至2012年的评估文本;C排除此窗口但包含之后文本。各自训练分词器,相同词元预算不等于相同字符、文档或重复暴露。原始训练每40步监测评估纪要并返回最终检查点;A/C不对评估词元求梯度,但评估集已被反复查看。每字符损失省略各文档首词元并使用有限上下文;声明评估又改变文体。BPE前缀边界变化使某些续写乘积并非指定自然语言后缀的精确条件概率。A−C和C−B是不同管道的比较,不分别识别纯粹未来知识及记忆。

智能体组织图不构成盈利证据;提示搜索、版本、工具数据、时钟、执行与成本均属被评估策略。多个相关股票不是独立重复。Kyle算例假设单期、风险中性、对称内部人共享完美高斯信号,噪声流独立。每人预期利润精确为 sigma_u sigma_v/((N+1)sqrt(N)),N^-3/2只为大N渐近率;采用曲线为人为示意,不是供应商收入或真实客户增长规律。

评估流程区分文档、模型和执行三个时钟。先冻结目标、预处理、调参、成本与对照,再做后期评估;拟合边界需剔除尚未成熟标签。固定算例:修正久期1.9、收益率升10基点,做多价格约跌19基点;理想做空毛收益19基点,假定往返成本一基点收益率折为1.9基点价格,剩17.1基点。不含凸性、票息、持有收益、融资与曲线风险;不是历史策略或实测成本。概率夏普统计量不自动是贝叶斯后验概率,IID精度近似也不是功效。

公司函数只筛选给定日期整数、记录给定语料首次出现,不能生成发布日期或版本证明。关联引理要求大数律、正出现概率、可积性以及给定语气后的条件分解。弱单调只给非负协方差,严格分离另需严格同向差异以正概率发生;与语气相关的长度可破坏中性条件。论文C.2还需模型(1)至(4)、C.6至C.9及C.11的词频、平衡与中性条件,中心为1/2;论文theta是C.10加权关联,不是模拟斜率的相同数值。500次无限制置换固定已选阈值且不重做选择,需可交换性;结果只是诊断。插件z阈值不自动控制有限样本族错误率。直方图注明存储0至59号箱包含多少次置换。

Desk questions, with solutions六个交易台问题及解答
  1. 2015至2020新闻回测夏普4。 先审计模型与分词器版本、训练日期、文件发布时钟及所有选择。匿名化仅为可能损失背景且保留身份线索的诊断;采用验证过的早期模型或真正后期冻结评估,并计成本,不能仅相信截止日期声明。
  2. 语气解释30%当日变化。 前收盘至发布日收盘的标签在该收盘交易时大部已实现。另定义可执行入场之后的未来目标,重新拟合和评估;日相关不能证明剩余漂移或文字的独立因果效应。
  3. 失业词频繁被计为负。 阅读语境,以独立且按发布时钟验证的文体特征和学习权重比较;不能看测试结果再删词。职责角色解释词频,但不使每次出现都无信息。
  4. 小样本选出许多词。 需要依赖结构合理且含选择过程的零假设。原始500次置换固定选中阈值、未重调,只提供有限诊断;插件z阈值不自动解决多重性和小计数。
  5. 买家翻倍。 精确比例 (N+1)/(sqrt(2)(2N+1)),大N趋于 2^-3/2。N=1时为 2/(3sqrt(2))。真实价格、噪声、用户差异和成本不在公式中,应另外测量。
  6. 通用模型超过专用模型。 固定版本,在独立、发布时钟明确且相关的任务上比较相同目标、成本与延迟;2023年的基准不能保证后期谁胜出。
Problems, with worked solutions习题1至6:完整解答
  1. 词频缩放。 证明:文档中每个计数都翻倍时,tf-idf行的余弦相似度不变。

    解答

    对非零行d及c>0,tf(cd)=cd/(c sum d)=tf(d)。固定语料IDF后,加权及单位长度归一化得到同一向量,因此与其他非零行的余弦相同。若语料或文档频次改变,结论需重新检查;零向量余弦不由此定义。

  2. 齐普夫头部。 在\(V = 10{,}000\)个词上频率\(\propto 1/r\)的齐普夫分布:前100个词覆盖了多少比例的词元?

    解答

    前100词在10,000词中占 H_100/H_10000。H_100≈5.18738,H_10000≈9.78761,比例约0.52999,即53.0%。对数加欧拉常数仅为近似,不是精确调和和。

  3. 净语气。 一份300词的声明有6个负面词和3个正面词。它的净语气是多少?如果把'unemployment'(6个中的2个)从负面词表中去掉呢?

    解答

    (3−6)/300=−1%。仅从负面词典删去两个“unemployment”计数,分母保留300词,得到 (3−4)/300≈−0.333%。若删掉文档词元本身,分母也会改变,是另一个特征。

  4. 偶然筛选。 300个词各自恰好出现在10份声明中;标签是公平的抛硬币。有多少个词满足\(|f_j - \frac12| \ge 0.2\)?

    解答

    每词十个独立公平标签,X~Bin(10,1/2),通过条件为X≤3或X≥7。概率 2(1+10+45+120)/1024=0.34375;300词的期望通过数103.125。期望线性性不需词间独立,但计数方差受共享标签影响。估计pi和选择阈值会改变该玩具零假设。

  5. 惩罚与先验。 证明SESTM的惩罚项\(\lambda\log p(1 - p)\)是\(p\)上的\(\text{Beta}(\lambda + 1, \lambda + 1)\)先验。

    解答

    Beta(a,b)密度正比 p^(a−1)(1−p)^(b−1);未归一计数对数似然加 lambda log(p(1−p)) 等于Beta(lambda+1,lambda+1)的对数先验,需lambda>−1。实现中非负lambda向1/2收缩。似然和惩罚同时除以相同正词数不改变极值;有限网格和零计数回退仍为数值约定。

  6. PMI。 证明对独立的词\(\mathrm{PMI}(w, c) = \log P(c \mid w)/P(c)\)为零,并说明PPMI为何丢弃负值。

    解答

    正概率下 PMI=log(P(w,c)/(P(w)P(c)))=log(P(c|w)/P(c))。独立为零,低于独立共现为负。PPMI删负是表示选择,不是每个负关系都为噪声。原函数将上下文边际替换为0.75次幂平滑分布,因此普通独立未必令这个修改后的量为零。

Problems, with worked solutions习题7至10:完整解答
  1. 迷雾指数约定。 计算这句话的迷雾指数:`The Committee decided today to keep its target for the federal funds rate unchanged.'

    解答

    题句有14词、一句。人工通常将Committee、decided、federal计为至少三音节,unchanged为两音节,故 0.4(14+100×3/14)=14.1714。原始元音组函数把unchanged也计为三音节,得到四个长词,0.4(14+100×4/14)=17.0286。应报告约定;两者都不是理解力或学历认证。

  2. 每字符比特。 一个模型的损失是每词元3.5奈特,每个词元4.2个字符。每字符多少比特?

    解答

    损失与字符分母覆盖同一序列时,3.5/(ln(2)×4.2)=1.20225。逐文档有限窗口评估还需注明省略首词元及上下文边界;单位换算不能补回缺失似然项。

  3. 命名与匿名。 样本内,具名标题的夏普比率为 1.2,匿名标题为 1.5。在其假设下,Glasserman–Lin 分解说明什么?为什么这不是因果识别?

    解答

    在指定加法模型且匿名化只改变记忆与分心的假设下,差为 1.2−1.5=−0.3=b−d,不能分别确定b与d。若后期两者都0.8,则后期观测差为零。背景损失、间接标识、筛选和抽样误差均可能使因果解释失效;这些差异本身不识别技能,也不证明无泄漏。

  4. Kyle买家4到9。 有\(N\)个知情买家的Kyle模型:从4个到9个买家,每个人的利润下降多少倍,总利润呢?

    解答

    每人比例 [(4+1)sqrt(4)]/[(9+1)sqrt(9)]=1/3;总利润正比 sqrt(N)/(N+1),比例 (3/10)/(2/5)=3/4。解释价值方差比例由4/5升至9/10。它们是模型期望,不是实测年化夏普。

Problems, with worked solutions习题11至12:资格考试证明
  1. 关联与筛选。 (资格考试)对\([0, 1]\)上递增的\(g, q\)和任意分布的\(p\),证明\(\operatorname{Cov}(g(p), q(p)) \ge 0\)。由此推出SESTM模型中正面、负面和中性词的\(f_j\)的极限。

    解答

    p与p′独立同分布且乘积可积。展开得 E[(g(p)−g(p′))(q(p)−q(p′))]=2E[gq]−2E[g]E[q]=2Cov(g,q)。两函数非递减时每个差乘积非负,故协方差≥0;当该非负乘积以正概率严格为正时才严格大于零。g常数或p退化均给等号。

    设A为词出现指标、Y为正标签指标。在IID或足以保证两个平均值收敛的大数律条件下,E[A]>0给 sum AY/sum A→E[AY]/E[A]。再假设 E[AY|p]=g(p)q_j(p),极限为 E[gq_j]/E[q_j]=pi+Cov(g,q_j)/E[q_j],pi=E[g]。固定正长度s时,q_j(p)=1−(1−pO+,j−(1−p)O−,j)^s,导数符号与 O+,j−O−,j 相同;正对比给弱上界、负对比给弱下界,严格差距需上述严格性条件。中性词只有出现与语气独立或与g协方差为零才以pi为极限;语气相关长度可破坏此结论。人口引理本身不提供统一有限样本恢复、最小间隙或词频下界。

  2. 对称高斯Kyle均衡。 (资格考试)\(N\)个对称知情者共享\(v\)的Kyle(1985)模型:推导\(\beta\)、\(\lambda\)、每个知情者的利润,并证明\(\operatorname{Var}(v \mid p) = \sigma_v^2/(N + 1)\)。

    解答

    v中心化高斯、方差sigma_v²,u为独立中心化高斯、方差sigma_u²,方差均正。N个风险中性内部人观察v,竞争做市商只见总流y。设 x_i=beta v、p=lambda y、y=N beta v+u。给定他人规则,i最大化 x_i[v−lambda x_i−lambda(N−1)beta v]。正lambda下目标严格凹,一阶条件 2lambda x_i=[1−lambda(N−1)beta]v,对称性给 beta=1/[lambda(N+1)]。

    高斯条件期望定价给 lambda=Cov(v,y)/Var(y)=N beta sigma_v²/(N² beta² sigma_v²+sigma_u²)。联立得 beta²=sigma_u²/(N sigma_v²),取正根 beta=sigma_u/(sigma_v sqrt(N)),lambda=sigma_v sqrt(N)/[(N+1)sigma_u]。因 lambda N beta=N/(N+1),每人预期利润 beta sigma_v²[1−lambda N beta]=sigma_u sigma_v/[(N+1)sqrt(N)]。高斯条件方差为 sigma_v²−Cov(v,y)²/Var(y)=sigma_v²/(N+1)。lambda正使观察p与观察y等价,故这也是Var(v|p)。总利润 sqrt(N)sigma_u sigma_v/(N+1)。供应商收入、异质噪声信号或多期交易结论需另建模型,不能直接推出。

Review log of the earlier QA passes on this part: docs/qa/quant/part28.md.

Build the film

python -m videos.quant.quant28.compute      # the part's numbers, into .cache/quant28
python tools/make.py quant28                # the narrated film, English and Chinese
EXPLAINER_TTS=silent python tools/qa_scene.py quant28 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/quant/quant28. Setup: see the course page. Source of these notes: the part's README and the scenes' narration.