The corpus is built so that every query has known relevant documents and every sentence states a known fact.
There are 960 entities in 12 topics. Each entity has two surface forms, a name and an alias, and six attributes, each with two surface forms. Every (entity, attribute) pair has one true value drawn from 40 values, with a skewed prior that the toy generator will later “remember”. A document has six fact sentences, one per attribute, plus up to six boilerplate sentences that mention no entity. Each fact sentence holds an entity word (or the pronoun “it”, with probability one half after the first sentence), an attribute word, a value word and three filler words, two from the topic and one common word.
Each entity has three documents that state the same facts in different wording: the entity is called by its name or by its alias for the whole document, attribute words are swapped for synonyms at random, and pronouns appear at random. A query contains the entity word in a random form, an attribute word in a random form and two topic words. Its relevant documents are the three documents of that entity. Of the 960 entities, 720 are queried, and the other 240 are distractors with documents of their own.
This construction forces the phenomena that matter. A query that says “alias” meets a document that says “name” about half the time, so exact word matching misses it. Distractor documents share the topic words and the attribute words, so only the entity word separates the right document from its 79 topical neighbours. A pronoun sentence carries no entity word, which makes chunking dangerous (the companion book example). Nothing here is realistic text. The point is that every effect in the companion book has a cause that you can read in the generator.
The vocabulary has 2793 words and the corpus has 2880 documents of mean length 53.9 tokens. Only 0.504 of the relevant documents contain the query’s entity word, and 0.875 of the queries have at least one such document. The second number is a ceiling for any method that matches words exactly: it can retrieve some relevant document for 87.5 percent of the queries, and all three for far fewer. The training set for the dense model covers 432 of the 720 queried entities (4320 training queries); the other 288 are “unseen” entities, a stand-in for items added to the corpus after the model was trained.
Continue with the book
Explore the full treatment, worked examples, and exercises in Applied AI Under Uncertainty.
Companion article for Applied AI Under Uncertainty, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
