Where Data Learns
Where Data Lives, Part Two
Six more easy pieces on lakes, warehouses, the lakehouse, and how machines learn from everything we keep
The first book ended when a single application found the right home for its data. This one begins the morning a company wakes up with a hundred of those homes and a question that belongs to none of them. We build the analytical estate from first principles: integration, the warehouse, the lake, the lakehouse and Databricks, data mining, and then the longest thread of all: how a model is data compressed into intelligence, and how every modern AI system stitches the estate, the weights, and the context window into one mind.
Part One assumed. No concept here is named before the failure that demands it is felt.
For builders, executives, decision-makers, and technical leaders
June 2026 · Reading time: about two hours
Contents
- What the First Book Left You Holding
- The Question That Crosses Systems
- Keep Everything, Decide Later
- The Lakehouse
- From Records to Patterns
- The Model Is a Compression of Data
- Giving the Model an Open Book
- The context window is the model’s working memory
- Retrieval: opening the book to the right page
- Tools: when the model picks up the phone
- Four ways to give a model knowledge
- Question Zero, again: do you even need a model?
- The flywheel
- How enterprises and frontier labs actually work with data
- The pocket card
- Both books in ten sentences
- Glossary
- Further Reading
BEFORE WE BEGIN AGAIN
What the First Book Left You Holding
A two-minute recap of the tools we carry forward, and the new question this book is built to answer.
The first book, Where Data Lives, had one job: to make you able to look at a single application and choose the right home for its data, from first principles, defensible to an engineer and a CFO at once. It got there by refusing to name anything before you had personally suffered the problem it solved. This book continues in exactly that spirit, one altitude higher, and it leans on five things the first book put in your hands. If you have them, the climb is easy. If you skipped the first book, here they are in two minutes, because everything ahead is built on them.
The five tools we carry forward
The memory gap. Fast memory forgets and lasting memory lags; every storage technology is a negotiation across that gap. Touching the slow, durable layer is expensive, so the whole game is to touch it rarely, predictably, and in bulk. This book adds a third kind of memory to that picture, and it is the strangest one yet.
The four walls. A plain file cannot give many users safe, selective, rule-enforcing, all-or-nothing access to shared data. It has no referee for simultaneous writers, no way to answer selective questions, no enforcement of rules, and no protection against half-written records. A database is the thing that solves all four. Watch for those four walls to return in this book at a scale a million times larger, in the exact same disguise.
The write-ahead log. The trick underneath durability: never edit the books directly; first append your intended change to a journal, wait for it to land, then apply it at leisure. If you remember one mechanism from the first book, it is this one, because it is about to reappear three more times, in places that look nothing like a database.
The interface ladder. Every storage technology sits on a ladder of interfaces, each rung hiding more mechanism and demanding clearer intent: physical media, then files, then navigational routes, then declarative SQL, then network services, and finally plain English compiled by a model. A good interface hides mechanism and exposes intent. This book climbs the last two rungs all the way up.
The boring default. Choose boring on purpose. Start with a single relational database (Postgres), and leave it only when a measured pain, never a fashion, forces a named exit. This book extends that same discipline from the operational world into the analytical and the intelligent, where the temptation to over-build is far stronger and far more expensive.
The new question
The first book lived inside one application. But a company is not one application; it is dozens, each with its own database, its own schema, its own private idea of who a customer is. The sales system, the support tool, the billing service, the marketing platform, the river of product events: each was built around a known purpose and answers its own questions beautifully. The trouble starts the day someone asks a question that belongs to all of them and none of them.
THE INTERFACE LENS
Hold the first book’s sentence at a new altitude. There, an interface sat between one program and one disk. Here, the interface must sit between one organization’s questions and its fifty squabbling systems of record. The same idea (hide the mess, expose clean intent) now has to reconcile not bytes and blocks, but conflicting truths about the same customer. That reconciliation is the whole first half of this book.
Where we are headed
Six pieces again, each earning the next, and the arc bends deliberately from storing to learning:
- The Question That Crosses Systems. Why no single database can answer an organization’s real questions, and how the data warehouse was invented to manufacture one truth from many.
- Keep Everything, Decide Later. Cheap storage and messy data invert the warehouse into the data lake; then the lake re-suffers the four walls and becomes a swamp.
- The Lakehouse. The synthesis: a transaction log over cheap files. Delta, Spark, Databricks, and the cloud’s deepest idea, the divorce of storage from compute.
- From Records to Patterns. The ladder from dashboards to data mining to machine learning, and the moment data stops being stored and starts being compressed into a model: the third kind of memory.
- The Model Is a Compression of Data. How a large language model is built from a corpus, why it hallucinates as a matter of physics rather than bug, and what the data pipeline of a frontier lab actually looks like.
- Giving the Model an Open Book. Context as working memory, retrieval and tool use as the bridge to the estate, a decision framework for getting knowledge into a model, and how enterprises and frontier labs really work with data.
Aarav returns. The founder from the first book shipped his workflow-diagnosis product on a single tidy database. He succeeded, which is the most dangerous thing that can happen to an architecture. His company now has many systems and a board that wants answers across all of them, and he wants to build the AI features his customers keep asking for. Every wall he hits in this book is a wall the largest enterprises and the frontier AI labs hit first, at a scale with billions of dollars and the shape of intelligence itself attached.
PIECE ONE
The Question That Crosses Systems
Why no single database can answer the questions a business actually has.
AARAV’S DESK
Two years in, Aarav’s company runs on five systems, each the right tool for its job, each from the first book’s playbook. Postgres holds the product: users, workspaces, diagnoses. A separate support desk, bought not built, holds tickets. A CRM holds sales conversations. A billing service holds invoices and plans. And a firehose of product events lands, five million a day, in a cheap analytical store. Five clean systems. Then the board asks one question: “of the customers who opened a support ticket in their first week, what is the eighteen-month revenue, split by whether sales ever called them?” Aarav opens his laptop and realizes, with a small cold feeling, that there is no database in his company that can answer it. The question touches four systems at once, and not one of them can see the other three.
Why the question has no home
Sit with why this is hard, because the difficulty is structural, not a gap in Aarav’s skill. Each of his databases was designed, exactly as the first book taught, around a known purpose. The support tool models tickets superbly and knows nothing of revenue. The billing service models money superbly and has never heard of a support ticket. The board’s question is a join across systems that were built to be separate, and a JOIN, as the first book showed, needs its two sides to live in one place under one referee. They do not. They live in four places, behind four APIs, owned by four vendors, identified four different ways.
That last point is the quiet monster. In the product database a customer is user id 49201. In billing she is account ACME-CORP. In the CRM she is a lead with an email that is her personal Gmail, not her work address. In the support tool she opened her ticket from a third address. Four systems, four names for one human, and no shared key between them. Before any question that crosses systems can be answered, somebody or something has to decide that these four records are the same person. The first book’s foreign key, that elegant pointer-by-shared-value, assumed everyone already agreed on the value. Across systems, nobody does.
FIRST PRINCIPLE
A question that spans systems cannot be answered inside any of them. It can only be answered in a sixth place, built on purpose, into which the others are copied and, far harder, reconciled. The copying is mechanical. The reconciling, deciding that four records are one truth, is where all the cost and all the judgment live.
Why not just query them live?
The obvious dodge is to leave the data where it lives and query all five systems on the fly, stitching results together in application code. People try this; it has a name, federation, and for the board’s question it fails for reasons the first book already armed you to predict. First, load: the board’s analytical question, scanning eighteen months of history, would hammer the production databases that are busy serving live customers, the cardinal sin the first book named at the very end, running back-office scans on the till. Second, speed: each system answers over a network, and the first book’s latency table is merciless about what happens when one question fans out to four networked systems and waits for the slowest. Third, and fatally, the reconciliation has nowhere to happen: matching four identities, conforming three definitions of “active,” and cleaning a decade of typos is real work that must be done somewhere persistent, not improvised on every query. The data has to move. The only question is where to, and in what shape.
Manufacturing one truth: the warehouse
The answer the industry reached, decades before Aarav was born, is to build a separate database whose only job is to hold copies of everyone else’s data, cleaned and reconciled into a single, consistent model of the business. It is read-heavy by nature (you load it on a schedule and then ask it questions), it is analytical by nature (its questions scan history rather than touch single rows), and so, as the first book derived, it wants columnar storage and it tolerates being a little behind real time. This thing is the data warehouse, and the word “warehouse” is honest: it is where the goods from every department are gathered, inventoried, and made findable, separate from the shop floors where they are produced.
HOW IT ACTUALLY HAPPENED
Two prophets, one war. The data warehouse acquired its name and its theory around 1990, and immediately split into two churches. Bill Inmon, often called the father of the data warehouse, argued top-down: build one grand, fully normalized model of the entire enterprise first, the single source of truth, and let departmental views flow from it. Ralph Kimball argued bottom-up and pragmatic: build smaller, query-friendly pieces shaped for how people actually ask questions, and let the warehouse grow by union. The two camps argued for twenty years. Modern practice quietly took Kimball’s shapes and Inmon’s ambition, and stopped attending either church.
The shape that won. Kimball’s enduring gift is the star schema. Put the events you measure (a sale, a click, a ticket) in a central fact table, one row per event, thin and enormous. Put the things those events refer to (the customer, the product, the date, the campaign) in surrounding dimension tables, wide and comparatively small. The picture looks like a star, and almost every analytical question becomes the same motion: filter and group the dimensions, sum the facts. “Revenue by region by quarter” is that motion. So is nearly everything a dashboard ever shows.
The transform is where truth is made
Moving data into the warehouse has three steps, and their initials, ETL, name the most consequential job in this entire book. Extract: pull the data out of each source system, through its database connection or its API. Load: put it into the warehouse. Between them sits Transform, three innocent syllables hiding the work that actually matters. Transform is where the four Gmail addresses become one customer. Where “active,” meaning logged-in-last-week in one system and has-a-paid-plan in another, becomes a single agreed definition. Where currencies are unified, duplicates collapsed, typos repaired, and the timeline of a customer reassembled from four systems that never spoke. Transform is not plumbing. Transform is the manufacture of organizational truth, and when a number on an executive dashboard is wrong, this is almost always where it was born wrong.
Notice the interface lens turning, because the warehouse is itself an interface, and a profound one. Below it: fifty source systems, each with its own schema, its own quirks, its own private vocabulary, churning and changing. Above it: one clean, conformed, stable model that an analyst can question without knowing or caring that “revenue” was assembled from a billing API, a currency table, and a heroic amount of deduplication. The warehouse hides the mechanism (fifty squabbling systems) and exposes the intent (one coherent business). That is the same move the file system made over the disk, three rungs down the ladder and forty years earlier.
THE INTERFACE LENS
There is a subtle ordering decision buried in ETL, and it has a name worth knowing: schema-on-write. The classic warehouse insists you define the target shape and clean the data before it is allowed in. The warehouse only ever contains data that already fits a decided structure. That discipline is the source of the warehouse’s greatest strength (everything inside is clean and conformed) and, as the next piece shows, the source of a tax heavy enough to trigger a rebellion.
The warehouse, against the database
Before moving on, set the warehouse beside the operational database from the first book, because keeping the two straight is half of speaking this language fluently. They are both relational, they both speak SQL, and they could not be more different in purpose.
| Operational database (Book One) | Analytical warehouse (this book) | |
|---|---|---|
| Its job | run the business, one transaction at a time | understand the business, across all of history |
| Question shape | fetch or change a few rows by key, right now | scan millions of rows, group and aggregate |
| Writes | constant, from live customers | in bulk, on a schedule, from ETL |
| Freshness | this instant; money may be moving | last night or last hour is usually fine |
| Storage layout | rows together (grab a whole record fast) | columns together (read only what you ask, compressed) |
| One source, or many | one application’s own data | copies of every application’s data, reconciled |
| Residents | Postgres, MySQL | Snowflake, BigQuery, Redshift; later, the lakehouse |
Same family, opposite vocation. The first book lived entirely in the left column. This book is mostly about the right one, and about what grows on top of it.
AARAV’S DESK
Aarav builds a small warehouse. He sets up nightly ETL from his five systems, spends two genuinely painful weeks on the identity-matching that makes four records into one customer, and finally runs the board’s question. It returns in four seconds. He is elated for a week, until the marketing team asks to add web analytics, the product team starts emitting a new event shape, and a data scientist asks whether they can keep the raw, unmodeled clickstream “just in case.” Every one of those requests pushes against the warehouse’s one rule: decide the schema, and clean the data, before it may enter. Aarav is about to feel the schema-on-write tax, and so was the whole industry, right around the time storage became almost free.
PIECE TWO
Keep Everything, Decide Later
Cheap storage and messy data invert the warehouse, and then drown it.
The tax that triggered a rebellion
The warehouse’s rule (define the schema and clean the data before loading) is a wonderful discipline and a real tax, and the tax has three line items. First, latency of access: a new data source cannot be queried until someone has modeled it, which can take weeks, so the answer to “can we look at this?” is always “yes, next sprint.” Second, loss: anything that does not fit the current, decided schema is dropped on the way in, which is fine until the day you wish you had kept it. Third, and increasingly, shape: a growing share of valuable data simply is not tabular. Server logs, raw JSON from APIs, images, audio, video, sensor streams, the half-structured exhaust of a modern product. You cannot pour any of it into neat columns without first deciding what to extract, and deciding means guessing today which questions you will ask tomorrow.
Two forces turned this tax from an annoyance into the trigger for a new architecture, and you met both in the first book. Force one: storage became absurdly, world-changingly cheap, because object storage (Amazon S3 and its kin, the first book’s blob shelf) made keeping a terabyte cost the price of a sandwich per month, durable across continents, effectively infinite. Force two: machine learning began to whisper that yesterday’s junk is tomorrow’s training set, that the raw, ugly, unmodeled data you would once have thrown away might be the most valuable thing you own, precisely because you do not yet know what you will ask of it.
The inversion
Put cheap infinite storage together with valuable messy data and a radical idea becomes obvious: stop deciding up front. Do not model the data before storing it. Do not clean it, conform it, or even understand it. Just land all of it, in its raw original form, into cheap object storage, and figure out the structure later, at the moment you actually query it. Keep everything; decide later. Pour every source, structured and unstructured, modeled and raw, into one vast pool, and impose meaning only on the way out.
That pool is the data lake, and the name was chosen against the warehouse on purpose: a warehouse holds goods packaged for sale, shelved and labeled; a lake holds water in its natural state, and you draw from it and purify it when you need it. The metaphor came from James Dixon around 2010, and the contrast he drew was sharp, a clean lake of raw data against the shrink-wrapped bottles of a traditional warehouse. The technical lineage runs straight through the first book: Hadoop, built in the mid-2000s by Doug Cutting and Mike Cafarella directly from Google’s published GFS and MapReduce papers (the same two papers the first book credited with the distributed era), gave the world a way to store and process data across thousands of cheap machines. Hadoop’s file system, HDFS, was the first popular lake floor. The cloud then replaced it with plain object storage, and the lake became, at bottom, a pile of files in S3.
THE INTERFACE LENS
Recognize the inversion in the first book’s own vocabulary. The warehouse is schema-on-write: structure decided before the data lands. The lake is schema-on-read: structure imposed only when you query, the data landing raw and shapeless. The first book met schema-on-read as a NoSQL document-store idea and warned that the schema never actually disappears, it just moves into every program that reads the data. Hold that warning. At lake scale it does not merely move. It can vanish into a fog where no one knows what is in the water at all.
The promise, stated fairly
The lake’s promise is genuine and worth stating at its strongest before we break it. You keep everything, so you never again lose data you later wish you had. You pay almost nothing to store it, because object storage is cheap and the lake imposes no expensive processing on the way in. You accept any shape, so logs, images, audio, and JSON live as comfortably as tables. And you defer the hardest decision, what questions to ask, until you actually have one, instead of guessing years ahead. For the raw fuel of machine learning, the lake is close to ideal: a single cheap home for the enormous, varied, unmodeled data that models feed on. Half of why the lake matters is that it is the natural reservoir for the second half of this book.
The four walls, returned
Now the reckoning, and it is the first book’s most important lesson collecting a debt. Strip away the marketing and a data lake is a large number of files sitting in object storage. But the first book proved, with Aarav suffering every step, exactly what a pile of files cannot do. The four walls were not a story about small projects; they were a property of files as such, and a lake is files. So the walls return, identical in shape, monstrous in scale.
| The wall (Book One) | How it returns in the lake | What it costs at scale |
|---|---|---|
| No referee for simultaneous writers | two jobs write overlapping files at once; one clobbers the other, or worse, both half-land | a daily pipeline run silently corrupts a table nobody notices for a week |
| No selective reads | to answer one question you scan a continent of files, because raw files have no index | a single query reads terabytes and costs real money each time it runs |
| No enforced rules | any job may write any shape; a column changes type and downstream everything quietly breaks | the lake fills with malformed, untrustworthy data nobody dares delete |
| No all-or-nothing writes | a job dies halfway and leaves half its files behind; the next reader sees a torn, partial table | there is no clean moment; readers cannot tell a finished write from an interrupted one |
A lake is the first book’s file, reborn at exabyte scale, and it inherited the file’s four diseases exactly. Every guarantee a database earned, the raw lake gave back.
And the lake adds two failures of its own that the small file never had, both from sheer scale. It cannot update or delete a single record, because there is no record, only files; so when a customer exercises a legal right to be forgotten, there is no row to erase, only a hunt across millions of files for every trace of her, which at lake scale is a genuine crisis rather than an inconvenience. And it loses track of itself: with no catalog and no enforced schema, nobody can say what is actually in the lake, where it came from, or whether it is trustworthy. A lake that reaches this state has a grimly accurate industry name.
FIRST PRINCIPLE
Without governance, a lake becomes a swamp. Cheap, infinite, accepting storage with no referee, no schema, no transactions, and no catalog does not give you freedom; it gives you a vast volume of data you cannot trust, cannot find, and cannot safely change. The lake solved the warehouse’s tax by unlearning everything the database knew. The next piece is the industry refusing to accept that trade.
One thing the lake got right: the file
Before the rescue, give the lake its one durable technical gift, because it survives into everything that follows. Throwing data in raw does not mean throwing it in foolishly. The community converged on an open, columnar file format called Parquet (which arrived around 2013 out of work at Twitter and Cloudera), and Parquet is the first book’s columnar insight cast into a portable file. Inside a Parquet file the data is stored column by column, not row by row, so an analytical query reads only the columns it names, and because each column is a long run of similar values it compresses ferociously. A lake full of Parquet is a lake whose files are already shaped for analysis and already small. Parquet is open and owned by no vendor, which matters enormously for the next piece: it means your data is not trapped, and many different engines can read the very same files.
AARAV’S DESK
Aarav builds a lake beside his warehouse. The raw clickstream, the API exhaust, the diagnosis report files, the data the scientist wanted “just in case,” all of it lands cheaply in S3 as Parquet, and for a month it feels like he has the best of both worlds. Then a pipeline crashes mid-run and leaves a half-written table that breaks the morning dashboards. Then two jobs race and silently lose a day of events. Then legal asks him to delete one customer entirely and he discovers he cannot, not really. He has built, faithfully and at speed, a swamp. What he needs is impossible-sounding: the cheap, open, any-shape storage of the lake, with the transactions, schema, and trustworthiness of the database. He is about to get exactly that, and the trick will be one he already knows.
PIECE THREE
The Lakehouse
The synthesis: a transaction log over cheap files, and the cloud’s deepest idea.
The trick is the one you already know
Aarav’s impossible wish (the lake’s cheap open storage with the database’s reliability) sounds like it needs a new invention. It does not. It needs the first book’s single most important mechanism, applied one level up, and once you see it you will never unsee it. The four walls of the lake all come from the same root: the files are just sitting there, with nothing keeping an authoritative account of what officially exists, what is half-written, and what the agreed shape is. The database solved precisely this problem for blocks on a disk, and it solved it with the write-ahead log: never trust the raw medium, keep a journal of intended changes, and let the journal, not the scattered files, be the source of truth about what really happened.
So do that to the lake. Leave the data exactly where it is, as cheap Parquet files in object storage, and add beside them one more file: a transaction log, an ordered journal that records every change as an atomic entry. To add data you append new Parquet files and then, only then, write a log entry that says “as of version 47, these files are officially part of the table.” A reader never lists the messy directory of files; a reader consults the log, which names exactly which files constitute the current table. Now derive what falls out, because all four walls collapse at once, for the same reason they did in the first book.
- Atomic writes return. A half-finished job writes its Parquet files but dies before writing the log entry; since readers trust only the log, those orphan files are simply invisible, and the table is exactly as it was. All-or-nothing, restored: the torn write that broke Aarav’s dashboard cannot be seen.
- A referee returns. Two jobs that try to commit conflicting log entries are ordered by the log, and one is told to retry. Simultaneous writers no longer clobber each other; the journal arbitrates, exactly as it did inside Postgres.
- Schema enforcement returns. The log records the table’s agreed shape, so a write in the wrong shape is rejected at the door rather than silently poisoning the lake. The third wall, garbage data, is walled off.
- Selective reads return. The log can carry statistics about each file (this file holds January, that one holds Bengaluru), so a query can skip files that cannot contain its answer, the first book’s indexing instinct reborn as file-skipping.
And the two lake-only diseases are cured by the same log. Deleting one customer becomes a real, atomic operation (write new files without her, commit a log entry, done), so the right to be forgotten is enforceable at last. And because every change is a numbered version in the log, you get something the warehouse never had: time travel, the ability to query the table exactly as it stood at version 47, or last Tuesday, simply by reading an earlier point in the journal.
FIRST PRINCIPLE
The write-ahead log, for the third time, is the load-bearing idea. It made a single database durable; it made replication possible across machines; and now it makes a continent of cheap files behave like one trustworthy table. If you remember one mechanism from these two books, remember the journal: append your intent, confirm it, and let the record of intent, never the raw medium, be the truth.
Table formats, and the lakehouse
This journal-over-files design has a name, the open table format, and three serious implementations arrived within two years of one another, each born from a company drowning in its own lake. Delta Lake came out of Databricks and was open-sourced in 2019. Apache Iceberg came out of Netflix, from engineers who had felt every one of these walls at streaming scale. Apache Hudi came out of Uber, built around the need to update and delete records efficiently. They differ in engineering detail and compete commercially, but they are the same idea: an ordered transaction log over Parquet files in object storage, granting ACID transactions, schema enforcement, updates, deletes, and time travel to data that still lives as cheap open files.
The architecture this enables earned its own name around 2020, a deliberate portmanteau: the lakehouse. It is the lake’s cheap, open, any-shape, infinite storage, wearing the warehouse’s reliability, schema, transactions, and management. One system now does both jobs the previous two pieces kept separate: the raw reservoir for machine learning and the clean, trustworthy tables for analytics, over a single copy of the data, in open formats no vendor owns. Aarav’s impossible wish, granted, and granted by a trick from a book about single-machine databases.
HOW IT ACTUALLY HAPPENED
Two companies, converging from opposite shores. Databricks, founded in 2013 by the Berkeley team that created Apache Spark, came from the lake side: it had the world’s data scientists processing giant messy data, and it added Delta to make that data trustworthy, climbing from lake toward warehouse. Snowflake, founded in 2012, came from the warehouse side: it rebuilt the cloud data warehouse around one brilliant decision (which the next section unpacks) and then steadily added the ability to hold raw and semi-structured data, climbing from warehouse toward lake. For a decade these two have been walking toward each other across the same valley, and the lakehouse is the meeting point. When you hear “Databricks versus Snowflake,” you are hearing two routes to the same destination.
Spark: the engine over the lake
Storage is only half the story; something has to process a lake too large for any single machine, and that engine deserves its place because it is the direct heir to a name from the first book. The first book credited Google’s MapReduce (2004) with teaching the world to compute over data spread across thousands of machines, by breaking a job into pieces, running them in parallel near the data, and combining the results. MapReduce was powerful and painfully slow, because it wrote intermediate results to disk at every step, and the first book’s latency table tells you exactly how much that hurts.
Apache Spark, created by Matei Zaharia and the Berkeley AMPLab around 2009, was the answer: keep the intermediate results in memory between steps instead of spilling to disk every time, and let the programmer express a whole pipeline of transformations that the engine plans and distributes. The first book’s memory gap explains the entire speedup in one sentence: Spark moved the work from the four-months-away layer to the minute-and-a-half-away layer wherever it could, and for iterative jobs that meant order-of-magnitude gains. Spark became the default engine for processing lakes and lakehouses, the thing that runs the heavy transformations, the very ETL from Piece One, now at lake scale and in memory. Databricks is, at heart, Spark and Delta offered together as a managed platform.
The cloud’s deepest idea: storage divorced from compute
One architectural decision underlies the warehouse, the lake, and the lakehouse alike, and it is the most important idea in this half of the book, so we derive it from the first book’s own physics. On a single machine, and on the classic on-premises warehouse, storage and compute were married: the disks and the processors lived in the same box, bought together, scaled together. That marriage has a cruel consequence. Your storage needs and your compute needs almost never grow in step. You might hold years of cheap-to-store history but query it for one hour a day; or hold modest data but hammer it with a thousand analysts at 9 a.m. and nobody at midnight. Married, you must buy enough of both for your peak of either, and pay for both around the clock. You overpay, constantly, in one dimension or the other.
The cloud broke the marriage, and this is the move. Put the data in object storage, which is cheap, effectively infinite, durable across continents, and always on, the first book’s blob shelf doing exactly what it does best: holding bytes for almost nothing. Then, when a question arrives, spin up compute on demand (a Spark cluster, a Snowflake virtual warehouse, a set of BigQuery slots), point it at the data in object storage, get the answer, and tear the compute down. You pay for storage continuously but trivially, and for compute only in the seconds you actually use it. The two scale independently because they are physically separate, and you stop overpaying for the dimension you are not using.
THE INTERFACE LENS
This is why the three architectures converged on one physical substrate. Warehouse, lake, and lakehouse now all bottom out in the same place: open files in object storage, queried by elastic compute summoned on demand. The differences that remain are about the layer of management over those files (a transaction log, or not; a closed engine, or an open one), not about where the bytes live. Once storage and compute divorced, “where does the data live?” got a permanent answer, object storage, and the interesting questions all moved up to what you put on top.
Three architectures, one table
Hold the three side by side, because an architecture review will ask you to.
| Warehouse | Lake | Lakehouse | |
|---|---|---|---|
| Storage | proprietary, columnar, managed | cheap object storage, open files | cheap object storage, open files |
| Data shapes | structured tables only | anything: tables, JSON, images, logs | anything, with tables made trustworthy |
| Schema timing | on-write (clean before load) | on-read (impose at query) | on-read, with enforcement available |
| Transactions | yes | no (the swamp risk) | yes, via a transaction log |
| Best at | clean, fast business analytics | cheap raw storage; ML fuel | both, over one copy of the data |
| The catch | schema-on-write tax; closed | no reliability; becomes a swamp | younger; tooling still maturing |
The lakehouse is not a fourth thing; it is the lake with the warehouse’s reliability bolted on by a journal. Convergence, not addition.
Earning each layer: bronze, silver, gold
The lakehouse also inherits the first book’s deepest discipline, that every layer must be earned, and gives it a memorable shape. Raw data lands in a bronze layer: exactly as it arrived from the source, untouched, the lake’s keep-everything promise honored, so you can always reprocess from the true original. Cleaned, deduplicated, conformed data lives in a silver layer: the manufacturing of truth from Piece One, now an explicit stage, where identities are matched and types are fixed. Business-level aggregates, the star schemas and metrics that dashboards and executives consume, live in a gold layer. This is called the medallion architecture, and it is the first book’s ladder of less, run forward instead of back: each tier is derived from the one below it, by a transformation you can inspect and rerun, so that when a gold number is wrong you can walk it back through silver to the bronze original and find exactly where truth went astray.
AARAV’S DESK
Aarav consolidates. The warehouse and the swampy lake become one lakehouse on Delta: bronze for the raw clickstream and API exhaust, silver for the reconciled customer model that cost him two weeks, gold for the board’s metrics. Torn writes vanish, the lost-events race is refereed away, and he can finally delete a customer cleanly. His data estate is, at last, both complete and trustworthy. And now the question that has been waiting since Piece One arrives in force, because a trustworthy estate is not the goal; it is the runway. He has gathered all the company’s data into one reliable place. The board’s next sentence is not “great dashboards.” It is “now what can we learn from it, and when do we get the AI?”
PIECE FOUR
From Records to Patterns
The ladder from dashboards to mining to learning, and a third kind of memory.
What do you do with assembled data?
Aarav has done the hard, unglamorous work: every system’s data, gathered, cleaned, reconciled, trustworthy. That was never the point, only the prerequisite. The point is to extract value, and value comes in rungs, each asking more of the data and the compute than the last. Naming the rungs in order is the bridge from the first half of this book (assembling data) to the second (learning from it), so walk them deliberately.
The first rung is description: what happened? Total revenue last quarter, tickets per week, active users by region. This is the warehouse’s native output, the star schema’s filter-and-sum, rendered as the dashboards and reports that run every company. It is SQL answering questions of fact about the past. The second rung is diagnosis: why did it happen? Revenue fell; you slice by region, by plan, by cohort, drilling until the cause surfaces. Still SQL, still the warehouse, now used as an instrument of inquiry rather than a mirror. These two rungs are what most people mean by analytics or business intelligence, and for an enormous share of real questions they are the entire answer, a fact this book will insist on again at the very end.
Data mining: the patterns you did not ask for
The third rung is different in kind: data mining. The first two rungs answer questions you posed. Data mining surfaces patterns you did not pose, structure hiding in the data that no one thought to look for. It is the discipline, crystallized in the 1990s under the banner of knowledge discovery in databases, of letting algorithms find regularities in large datasets rather than confirming a human’s hunch.
Three classic shapes make it concrete. Association rules find things that co-occur: customers who buy this also buy that. The legendary illustration, beer and diapers, claims a retailer discovered that the two sold together on Friday evenings; the story is very likely apocryphal, which is itself the lesson, because data mining surfaces correlations and leaves causation, and meaning, entirely to you. Clustering finds natural groupings no one defined in advance: feed in your customers and the algorithm partitions them into segments by behavior, segments you did not design and must then interpret. Classification and anomaly detection learn, from labeled past examples, to sort new cases or to flag the ones that do not fit, which is how fraud detection and spam filtering began. Notice what unites them: in each, the human stops specifying the answer and starts specifying only the search, and the machine returns structure. That shift, from stating the rule to discovering the rule, is the whole road to what comes next.
STOP AND THINK
Here is the move that defines the rest of the book, posed as a question. In every rung so far, you query the data: you ask, and the system reads stored records and hands some back, exactly or in aggregate. Machine learning does something a query cannot. Before reading on: what would it mean to take a dataset and, instead of storing it for later questions, squeeze the patterns out of it into a small object that can answer questions about cases that were never in the data at all?
The leap: learning is lossy compression
The fourth rung, prediction, is where machine learning proper begins, and it breaks the pattern of every rung before it. Up to here, every system stored records and answered by reading them. A machine learning model does not store the records. It is trained on them, and training adjusts a set of internal numbers, the parameters, until the model captures the regularities that connect inputs to outputs across the whole dataset. Then the data can be thrown away, and the model alone, those numbers, can take a brand-new input it has never seen and predict an output. Show a model a million labeled house sales and it learns the shape of how features map to price; afterward it prices a house that was never in the data. No stored record could do that, because the answer was never stored. It was generalized.
This is the conceptual hinge of both books, so state it plainly. A database is exact memory: you get back precisely what you put in, and nothing about a customer who was never entered. A model is a different kind of memory entirely. Training compresses a dataset into parameters, lossily, the way an audio file compresses a concert: not by keeping every sample but by keeping the structure, so it can reconstruct something faithful, and even fill gaps it never explicitly stored. The price of that magic is exactness. A model cannot recite a specific record reliably, because it did not keep records; it kept the shape of the whole. The reward for that price is generalization, the ability to answer about cases that were never in the data, which no exact store can do.
FIRST PRINCIPLE
A model is data compressed into a generalization. The first book’s memory hierarchy had two kinds: fast-and-volatile, slow-and-durable, both exact. This is the third kind, and it obeys its own law. Where fast memory forgets and lasting memory lags, learned memory generalizes, but cannot recite. Every strength and every failure of modern AI falls out of that one trade.
Two kinds of memory, side by side
Keeping the exact store and the learned store straight is the single most clarifying distinction in applied AI, because almost every production mistake comes from asking one to do the other’s job. Set them against each other.
| Exact store (database, lake, warehouse) | Learned store (a trained model) | |
|---|---|---|
| What it keeps | records, exactly as written | patterns across all records, lossily |
| Best question | “what exactly is X?” | “what is the likely answer for a new case?” |
| Novel inputs | knows nothing it was not given | generalizes to cases never seen |
| Recite a specific fact | perfectly, every time | unreliably; it kept shape, not records |
| Update one fact | change one row, instantly | retrain, slowly and expensively |
| Failure mode | missing data: it simply has none | confident invention where it lacks the pattern |
Neither is better; they are opposites built for opposite questions. The art of the second half of this book is using each for its own job, and never the other’s.
The fifth and final rung, generation, is prediction turned loose on a harder target. A predictive model outputs a number or a label; a generative model outputs an artifact, a sentence, an image, a paragraph of code, by predicting it piece by piece. A large language model is the generative rung applied to text at a scale the early data miners could not have imagined: a model that compressed a vast fraction of human writing into its parameters and produces new text by repeatedly predicting what comes next. It is the same lossy-compression idea as the house-price model, fed almost everything humans have written and asked to generalize over language itself. Everything that makes large language models miraculous, and everything that makes them treacherous, is the third kind of memory at maximum scale, and the next piece opens the box.
AARAV’S DESK
Aarav sees the ladder in his own company. His dashboards describe and diagnose; a data scientist mines the clickstream and finds an unasked-for cluster of customers who diagnose furiously for two weeks and then vanish, a churn pattern no one had named. A predictive model could flag those customers early. And his customers keep asking for the thing on the top rung: a way to simply ask their data questions in plain English, and a copilot that reads a workflow and suggests fixes in prose. To build any of that responsibly, Aarav has to understand what a language model actually is, where its knowledge comes from, and the one failure mode that will bite him hardest. That is Piece Five, and it is a story about data all the way down.
PIECE FIVE
The Model Is a Compression of Data
How a language model is built from a corpus, and why it dreams as a matter of physics.
Training is compression
A large language model arrives in the world wrapped in mystique, so strip it to the one sentence the last piece earned: a language model is a vast corpus of text, compressed into parameters, that produces new text by predicting the next piece. Everything else is detail on top of that sentence. The model is shown an ocean of writing and, over and over, asked the same childishly simple question: given this run of text, what token comes next? Each time it guesses, it is corrected toward the truth, and its billions of parameters nudge a hair. Do this across a large fraction of everything humans have written, for months, on tens of thousands of processors, and the parameters slowly come to encode the deep regularities of language: grammar, facts, styles, reasoning patterns, the statistical shadow of human thought. That encoding is the model. Training is the act of pressing the corpus into it.
Which means the question that decides everything about a model is not architectural but the question this entire book has been circling: what data, and how good? A model is its corpus, generalized. Feed it brilliance and it generalizes brilliance; feed it sludge and it generalizes sludge. The frontier labs understood early what the first half of this book has been building toward, that the data pipeline is not preparation for the real work, it is the real work, and the cleaning, deduplication, and curation of the corpus is where much of a model’s quality is won or lost. Every tool from Pieces One through Three, the lake, the lakehouse, Spark, the transform, gets pointed at the corpus.
Everything becomes a number first
Before a single word reaches the model, the first book’s oldest lesson repeats at the threshold of AI. The disk never saw files, only numbered blocks; the model never sees text, only numbers. Text is chopped into tokens, small common chunks of characters (a short word is one token, a longer word a few), and each distinct token is assigned an integer id. The sentence you type becomes a list of integers; the model consumes integers and emits an integer, which is mapped back to a chunk of text for you to read. The scheme, byte-pair encoding, began life as a data-compression algorithm in the 1990s and was borrowed for language, which is a quietly perfect detail: the interface to a model is, once again, a translation from human-meaningful symbols into machine-meaningful numbers, the same move the file system made over blocks, the same move SQL drivers made over wire protocols, one rung higher on the ladder.
THE INTERFACE LENS
The token matters in practice, not just in principle. It is why a model has a context limit measured in tokens, why it can stumble on tasks that depend on individual letters (it sees chunks, not characters), and why text in some languages costs more tokens, and therefore more money, than the same meaning in English. When you hear “context window,” “tokens per second,” or “price per million tokens,” you are hearing the model’s native unit, the integer it was always secretly operating on.
Two corpora, two philosophies
The data that makes a model is not one corpus but two, gathered on opposite principles, and the contrast is the most useful thing to understand about how models are built. The first is the pretraining corpus, and its philosophy is scale: as much high-quality text as can be found, collected, and cleaned. The public crawl of the web (the Common Crawl is the famous source), books, code from public repositories, reference works, and more, measured in trillions of tokens. This is raw fuel, and the lake from Piece Two is its natural reservoir; the work is collecting it, then the unglamorous, decisive labor of filtering out garbage, removing duplicates so the model neither wastes capacity nor memorizes, and screening for safety and quality. A model that has only pretrained is strange to talk to: it has absorbed the shape of language and a great deal of knowledge, but it merely continues text rather than answering you, because nobody has yet taught it that a question wants an answer.
The second corpus is built on the opposite philosophy, and it is where a raw model becomes an assistant. Post-training (instruction tuning and learning from human preferences) uses a comparatively tiny, painstakingly produced set of examples: demonstrations of helpful answers, and human judgments comparing two model responses to say which was better. Here the dial the first book kept turning between quantity and quality is slammed all the way to quality. These examples are few, expensive, and high-leverage; a modest number of excellent ones can transform how a model behaves, where a modest number of mediocre ones can quietly degrade it. This is human-labeled data as a refined product, and an industry of careful labeling exists to produce it.
AT THE FRONTIER
Constitutional AI and feedback at scale. Human preference data is powerful and slow to gather, so the frontier developed ways to let models help judge themselves. Anthropic’s Constitutional AI, published in 2022, gives the model a written set of principles, a constitution, and trains it partly on its own critiques of its own outputs against those principles, reducing the volume of human labeling needed for safety and alignment. It is a vivid instance of a pattern that recurs at the frontier: where human-generated data is the bottleneck, carefully designed model-generated data is used to extend it, under human-defined rules.
The shape of a training run. Pretraining a frontier model is among the largest computations humans perform: tens of thousands of specialized processors, running for months, streaming trillions of tokens from storage. The first book’s storage-and-compute separation reaches its extreme here, and its latency table sets the central engineering problem, keeping those processors fed with data fast enough that they are never idle, because an idle fleet of that size is a fortune burning. And the run must survive failure over months, so it checkpoints constantly: it writes its full state to durable storage at intervals, so a crash resumes from the last checkpoint rather than the start. That is the write-ahead log’s spirit (commit your state so a crash cannot erase your progress) guarding a hundred-million-dollar computation.
| Pretraining data | Post-training data | |
|---|---|---|
| Philosophy | scale: as much good text as possible | quality: a few excellent examples |
| Size | trillions of tokens | thousands to millions of examples |
| Source | web, books, code, reference works | human demonstrations and preferences; some model-assisted |
| What it teaches | language, knowledge, the shape of thought | to be helpful, honest, harmless, and follow instructions |
| Cost per token | low; the work is cleaning and dedup | high; skilled human judgment per example |
| The estate it uses | the lake and lakehouse, at the limit | labeling pipelines and evaluation sets |
Two corpora, two philosophies, the same dial from the first book: scale for the foundation, quality for the finish.
Why a model dreams
Now the failure that will bite hardest, and the gift of this book is that you can derive it instead of fearing it. A model sometimes produces a confident, fluent, completely fabricated answer: a fake citation, an invented statistic, a plausible event that never happened. This is called hallucination, and it is routinely treated as a bug to be stamped out. It is not a bug. It is the third kind of memory behaving exactly as its nature demands, and the last piece already told you why.
A model is lossy compression of patterns, not a store of records. When you ask for something whose exact form sits squarely in the patterns it absorbed, it reconstructs it well. When you ask for something it never quite stored, a precise figure, a specific source, a niche fact, it does not know that it does not know, because there is no record to find missing. It does the only thing it can do: it generates the most plausible continuation, the text that best fits the shape of the answer. A real database, asked for a row it lacks, returns nothing, because exact memory knows its own gaps. A model, asked for a fact it lacks, returns something shaped exactly like the truth, because generalizing memory has no gaps, only smooth interpolation. Hallucination is the precise cost of generalization, the same way volatility was the precise cost of RAM’s speed in the first book. You cannot have the one without the other; they are the same coin.
FIRST PRINCIPLE
Hallucination is not a defect added to the model; it is generalization seen from its bad side. A store that can answer about cases it never saw must, by the same machinery, answer about facts it never had. The cure is therefore never “make the model stop generalizing.” The cure is to pair the generalizing memory with an exact one, and let each do its own job. That pairing is the whole of Piece Six.
Two more consequences fall out of the same nature, and both point the same way. A model is frozen at the moment its training ended; its knowledge has a cutoff, and unlike a warehouse you cannot simply rerun last night’s ETL to refresh it, because refreshing means retraining, which costs a fortune and happens rarely. And a model knows nothing of your private world: your company’s data was not in its corpus, so it cannot answer about your customers, your documents, your numbers, no matter how fluently it answers about the public world. Lossy, frozen, and ignorant of your data: three properties, one root, and together they are precisely the problem the final piece exists to solve.
AARAV’S DESK
Aarav prototypes his copilot on a strong base model and is dazzled for a day. Then it cites a feature his product does not have, invents a confident answer about a customer it has never heard of, and describes his own pricing wrongly because his pricing was never in its training data. Nothing is broken. The model is doing exactly what a lossy, frozen, public-only memory must do. Aarav does not need a better model. He needs to connect the model he has to the trustworthy estate he built in the first four pieces, so that for anything exact, current, or private, the model defers to the records instead of dreaming. The bridge between the two kinds of memory is the last thing this book has to teach, and it is where everything finally connects.
PIECE SIX
Giving the Model an Open Book
Context, retrieval, tools, and how to wire a mind to the estate it must trust.
The context window is the model’s working memory
Everything converges here, and it converges through a single image the first book already gave you. The model’s parameters are its long-term memory: vast, frozen, lossy, holding the generalized shape of everything it learned. But a model also has a second, utterly different memory, the one you fill every time you talk to it: the context window, the run of tokens you hand it for the task at hand. The context is fast, it is exact (whatever you put there, the model sees verbatim), it is sharply limited in size, and it vanishes the moment the session ends. Read those four properties again and you are reading the first book’s description of RAM. The context window is the model’s workbench, its volatile working memory, and the parameters are its durable, slow-to-change long-term store. The first book’s two kinds of memory return, one last time, inside the mind itself.
This reframes the whole problem of the last piece. The model’s long-term memory is frozen, lossy, and ignorant of your data, and you cannot easily change that. But its working memory is yours to fill, fresh, with anything you like, exactly. So the entire strategy for making a model useful on real, current, private questions is one sentence: put the right exact information into the working memory at the moment of the question, and let the model reason over it rather than dream from its frozen store. Give the model an open book, opened to the right page, instead of demanding it recite from memory. That single idea, working memory loaded with retrieved truth, is the foundation of essentially every serious AI application running today.
Retrieval: opening the book to the right page
The working memory is small and your estate is vast, so the question becomes: of everything you know, which few pieces belong in the context for this particular question? You cannot put the whole warehouse in the window. You must fetch only the relevant fragments, and this is where the second half of the book reaches back and clasps the first. The technique is retrieval-augmented generation, named in 2020, and the name is a precise description: before the model answers, retrieve the relevant data and augment the context with it, so generation is grounded in fetched fact rather than frozen memory.
But relevance to a human question is about meaning, not keywords, and matching by meaning is exactly the problem the first book named in its final estate as the meaning layer. Here is the bridge, fully load-bearing at last. Every document in your estate is run through an embedding model, which turns a piece of text into a vector, a long list of numbers positioned so that texts with similar meaning sit near one another in space. Store those vectors, and a question can be embedded the same way and answered by geometry: find the document vectors nearest the question vector, and you have found the passages most likely to be relevant, by meaning, not by shared words. The first book introduced this as pgvector inside Postgres, an exotic-sounding corner of the estate. It is not a corner. It is the hinge on which production AI swings, the mechanism by which a frozen, lossy mind is connected, at the instant of each question, to an exact and current estate.
1. index: every document → embedding model → a vector, stored
2. ask: user question → embedding model → a vector
3. retrieve: find the stored vectors nearest the question vector
4. augment: place those documents into the context window
5. generate: the model answers, grounded in what it was handed
THE INTERFACE LENS
Watch the two kinds of memory finally cooperate. The vector search is exact memory at work (a real lookup over real records in the estate); the answer is generalizing memory at work (the model’s fluent reasoning over what it was handed). Retrieval lets the model do what it is wonderful at, understanding and composing language, while the estate does what it is wonderful at, holding exact, current, private fact. Neither is asked to do the other’s job. This is the resolution of the entire two-book arc: not one memory or the other, but each wired to its strength.
Tools: when the model picks up the phone
Retrieval handles questions answerable from documents, but some answers are not sitting in any document; they must be computed, fetched live, or looked up exactly, and for these the model is given a second power: tools. A model can be allowed to call functions, real APIs that fetch a live figure, run a calculation, query a system, or take an action, and to read the result back into its context before answering. The model does not know today’s revenue; it knows it can call a function that does, so it emits a request to call that function, the system runs it, the exact number returns to the context, and the model answers from fact rather than guess.
And now the first book’s interface ladder pays off its final promise. Its top rung was natural language compiled to SQL, a model translating “show me last month’s churned customers by plan” into a real query against the warehouse. That rung is no longer a forecast; it is the most consequential tool a business model is given. The model, handed a description of the warehouse’s tables, writes SQL, the warehouse executes it with all its exactness and all its transactional truth, and the rows return to the context for the model to explain in prose. The plain-English question Aarav’s customers kept asking for, answered against the gold layer of his lakehouse, with the model as translator and the estate as the source of truth it must defer to. The same interface lens that opened the first book closes the second: every rung from punched cards to plain English was one boundary, hiding mechanism and exposing intent, and the model is simply the newest interface to all the data underneath.
Four ways to give a model knowledge
There are, in the end, four ways to get knowledge into a model’s answer, and choosing among them is the decision-making skill of this book, the direct heir to the first book’s art of choosing a database. They are not rivals to pick one of; they are a toolkit to combine, and the discipline is matching each to what it is for.
| Method | What it is | Best for | The catch |
|---|---|---|---|
| In-context | put the facts directly in the prompt | the immediate task; small, known, current data | limited by window size and cost per token |
| Retrieval (RAG) | fetch relevant docs by meaning, add to context | large, changing, private knowledge; exact, current, auditable answers | only as good as what retrieval finds |
| Tool use | let the model call APIs, including SQL | live figures, calculations, the warehouse, taking action | needs reliable tools and guardrails on actions |
| Fine-tuning | train the model’s own weights on examples | behavior, format, tone, a specialized skill | expensive, slow to update; the wrong tool for facts |
A toolkit, not a menu. Most real systems combine retrieval and tools for knowledge, with light fine-tuning for behavior, and context carrying the task.
One error is common enough and expensive enough to earn the first book’s style of sharpened rule, because it is the exact analogue of confusing the exact store with the learned store. People reach for fine-tuning to teach a model facts, their product details, their documentation, their customer data, and it disappoints them: the facts blur, go stale the moment anything changes, and cannot be updated without retraining. The reason is the whole of Piece Five. Fine-tuning adjusts the lossy, generalizing memory, which is precisely the wrong place to store something that must be exact and current. Here is the rule:
Do not fine-tune to teach facts; retrieve facts and fine-tune behavior. Weights are for how the model should act; the estate is for what is true right now.
Facts are exact and change; they belong in the estate, reached by retrieval and tools. Behavior, the model’s tone, its format, its specialized judgment, is a generalization, and generalizations belong in the weights, which is what fine-tuning shapes. Send each to the memory built for it, and the system is sound. Cross the wires, and you get a model that recites your tone perfectly and your facts wrongly, which is the worst of both stores at once.
Question Zero, again: do you even need a model?
The first book opened its decision framework with Question Zero, the discipline of asking whether you need a database at all before choosing one, because the most expensive choice is the unnecessary one. The second book closes with the same question pointed at AI, and it matters more here, because the pull to reach for a model when a query would do is stronger and the cost of the mistake is higher. Before you build anything with a model, ask: does this question actually need generalization, language, or generation, the three things only the learned store can do? Or is it a question of exact fact about the past, which your warehouse answers faster, cheaper, and without ever dreaming?
An enormous share of what gets pitched as “AI” is description and diagnosis from Piece Four, a dashboard or a SQL query wearing a fashionable label. “What were sales last quarter” does not want a model; it wants the gold layer. “Which customers are likely to churn” may want a predictive model. “Summarize this contract” or “answer support questions from our docs” genuinely wants a language model, with retrieval. The skill is telling them apart, and the rule is the first book’s rule one rung up: reach for the model only when the question needs what only a model can do, and let the boring, exact, far cheaper estate answer everything else. Choose boring on purpose, here most of all.
FIRST PRINCIPLE
The best model is often a SQL query. Use the learned store only for generalization, language, and generation; send every question of exact fact to the estate built to answer it. A model bolted onto a question a query could have answered is the second book’s version of running a server you did not need: cost and risk with no payoff.
The flywheel
One loop ties the two halves of this book into a machine that compounds, and it is why data is so often called the moat. A model in production is used, and that use generates new data: the questions people ask, which answers they accept or correct, which retrievals helped, which tools were called, where the model failed. Captured in the estate, this exhaust becomes the raw material for the next improvement, better retrieval, better fine-tuning examples, better evaluations, sometimes a better model. The estate feeds the model at inference; the model’s use feeds the estate; the improved estate makes a better model. Round and round, and each lap is cheaper to run and harder for a competitor to copy, because they do not have your laps. The first half of this book built the estate; the second half taught the model to draw from it; the flywheel is what makes the whole thing accelerate.
How enterprises and frontier labs actually work with data
Step back to see the two worlds this book has been quietly describing all along, because they are the same machine at wildly different scales, and seeing that is the last piece of fluency.
An enterprise, Aarav’s company grown up, runs a recognizable stack. Data is pulled from its many systems by ingestion tools (Fivetran, Airbyte) into a lakehouse or warehouse (Databricks, Snowflake, BigQuery); it is transformed into clean, trustworthy, layered tables (often with dbt expressing the transformations as version-controlled code, the analytics-engineering discipline); it is consumed by dashboards for description and diagnosis, by data scientists for prediction, and, increasingly, by an AI layer for language and generation. Across all of it sit the unglamorous disciplines that separate a real estate from a swamp: governance (who may see what), lineage (where did this number come from, traceable through the medallion layers), and a semantic layer (one agreed definition of “revenue”, so the model and the analyst and the CFO mean the same thing). The enterprise AI pattern is now stable: retrieval over internal documents, plain-English questions compiled to SQL against the warehouse, and agents that call internal tools, with one non-negotiable rule, the estate is the source of truth and the model must defer to it, because in an enterprise a confident hallucination is not a curiosity, it is a liability.
AT THE FRONTIER
A frontier lab runs the same machine, multiplied by orders of magnitude, with data as both the bottleneck and the moat. Its pretraining corpus is a data-engineering effort at the edge of what is possible: collecting trillions of tokens, then the decisive work of cleaning, deduplicating, filtering for quality, and screening for safety, on the lake and lakehouse tooling of the first three pieces, at the largest scale anyone operates. Its training runs stream that data to tens of thousands of processors for months, where the first book’s storage-and-compute separation hits its limit and the central problem becomes feeding the fleet fast enough to keep it from idling. It checkpoints relentlessly, the write-ahead log guarding a computation worth more than most companies. And it increasingly manufactures its own data: synthetic data, where strong models generate training material for the next model under human-defined rules, is the flywheel turning at the frontier, a partial answer to the day when the supply of high-quality human text runs short. Evaluations become first-class data, carefully built test sets that measure whether each model is actually better. Provenance and versioning of datasets matter intensely, for reproducibility, for safety, and for law. The lab’s data estate is not support for the product; the data estate, compressed, is the product.
And the two are converging. Enterprises increasingly do lab-like things, fine-tuning models and building evaluation sets; labs run on the same warehouses, lakes, and Spark jobs that enterprises do, only larger. The boundary blurs because it was never a difference in kind, only in scale. Both are doing the one thing these two books have described from the physics of a leaking capacitor to the training of a frontier model: gathering data, making it trustworthy, and turning it into answers, now including answers about cases that were never in the data at all.
The pocket card
The second half of this book, compressed to what fits in a head walking into a meeting:
WIRING A MODEL TO THE ESTATE
Two memories. Weights are long-term memory: vast, frozen, lossy, generalizing. Context is working memory: small, fresh, exact, volatile. The estate is exact memory: records, current and private. Use each for its job.
Hallucination is generalization’s shadow. A lossy store invents where it lacks the pattern. The cure is not a better model; it is pairing the model with an exact store and making it defer.
Ground it. For exact, current, or private answers: retrieve (RAG, via embeddings and vector search) and call tools (including SQL against the warehouse). Open the book to the right page; do not ask the model to recite.
Facts versus behavior. Retrieve and tool-call for facts; fine-tune only for behavior, tone, and format. Never fine-tune to teach facts.
Question Zero. Reach for a model only when the question needs generalization, language, or generation. Everything else is a SQL query, cheaper and exact. The best model is often a query.
The flywheel. Production use generates data; data improves retrieval, tuning, and the next model. The estate feeds the model; use feeds the estate. That loop is the moat.
Both books in ten sentences
- Fast memory forgets, lasting memory lags, and a third kind, the model, generalizes but cannot recite; every system is a negotiation among the three.
- A single database answers one application’s questions, but a real organization’s questions cross many systems and can be answered only in a sixth place built on purpose.
- The warehouse manufactures one truth by copying and reconciling many systems, cleaning the data before it lands; that schema-on-write discipline is its strength and its tax.
- Cheap storage and messy data invert the warehouse into the lake, which keeps everything raw and decides later, and then re-suffers the four walls of a plain file until it becomes a swamp.
- The lakehouse cures the swamp with the write-ahead log a third time: a transaction journal over cheap open files, granting reliability to a continent of data, all over storage divorced from compute.
- Value climbs a ladder, description, diagnosis, mining, prediction, generation, and at the prediction rung data stops being stored and starts being compressed, lossily, into a model.
- A language model is a corpus compressed into weights; it is therefore lossy, frozen at a cutoff, and ignorant of your private data, and it hallucinates as the exact cost of being able to generalize.
- The cure is to pair the generalizing model with the exact estate: load working memory (the context window) with retrieved, current, private truth instead of asking the frozen store to recite.
- Retrieval by meaning (embeddings and vector search) and tool use (including English compiled to SQL) are the bridge; retrieve and tool-call for facts, fine-tune only for behavior.
- Reach for a model only for generalization, language, and generation; send all else to the estate, choose boring on purpose, and let the data flywheel compound. Enterprises and frontier labs run this one machine, only at different scales.
AARAV’S DESK
Aarav ships it. The clickstream and the API exhaust and the diagnosis files rest in the bronze layer; the reconciled customer model that cost him two weeks is the silver; the board’s metrics are the gold. His copilot reads a customer’s workflow, retrieves similar past cases by meaning from the estate, calls a tool that writes SQL against the gold layer for the exact current numbers, and answers in plain prose, deferring to the records for everything that must be true. When it does not know, it now says so, because it is allowed to look rather than forced to dream. The model still cannot recite a single fact reliably from its own frozen memory. It no longer has to, and that, in the end, was the whole problem to solve.
That is the second book, and the close of the arc the first one opened. The products in these pages will age faster than any in the first book, because this is the fastest-moving corner of the field; some names here have surely changed between the writing and your reading. The derivations will not. A leaking capacitor still forgets, a file still has four walls, a journal still makes scattered storage trustworthy, and a lossy compression of data still generalizes at the exact price of being able to recite. When the next remarkable system arrives wearing a benchmark, you now own the questions that outlast every product: which kind of memory is this, exact or learned; what does it promise when it does not know; and which of my questions, precisely, is it the right tool for? Ask those, across both books, and you will be the calmest person in the room, the one who can see the physics underneath the fashion.
BACK MATTER
Glossary
Every term this book earned, defined in one breath each. The first book’s glossary still stands beneath it.
| Term | In one breath |
|---|---|
| Analytics engineering | the discipline of transforming raw warehouse data into clean, modeled tables as version-controlled code, popularized by dbt. |
| Bronze / silver / gold | the medallion layers of a lakehouse: raw as-landed, cleaned and conformed, business-level aggregates. |
| Common Crawl | a large public crawl of the web, a common ingredient of language-model pretraining corpora. |
| Context window | the run of tokens a model is given for the task at hand: its fast, exact, limited, volatile working memory. |
| Data lake | raw data of any shape landed cheaply in object storage, with structure imposed only at query time (schema-on-read). |
| Data mart | a small, focused slice of a warehouse shaped for one team or subject area. |
| Data mining | finding patterns no one asked for in large datasets: association rules, clustering, anomaly detection; the ancestor of machine learning. |
| Data warehouse | a separate analytical database holding cleaned, reconciled copies of many systems’ data, modeled for questions about history. |
| Delta Lake / Iceberg / Hudi | open table formats: a transaction log over Parquet files, giving a data lake ACID, schema enforcement, updates, and time travel. |
| dbt | a tool for expressing warehouse transformations as version-controlled, testable SQL; the spine of analytics engineering. |
| Embedding | a vector representation of a piece of text positioned so that similar meanings sit near one another, enabling search by meaning. |
| ETL / ELT | extract, transform, load (or load then transform): the pipeline that moves and reconciles data into a warehouse or lakehouse. |
| Fine-tuning | further training a model’s weights on examples to shape its behavior, tone, or skill; the wrong tool for teaching exact facts. |
| Hallucination | a model’s confident, fluent fabrication: the exact cost of generalization, since a lossy store cannot know what it never stored. |
| Hadoop / HDFS | the mid-2000s framework, built from Google’s GFS and MapReduce papers, for storing and processing data across many cheap machines. |
| Lakehouse | the synthesis: a lake’s cheap open storage with a warehouse’s reliability and schema, via a transaction log over open files. |
| Medallion architecture | the lakehouse expression of earning each layer: bronze to silver to gold, each derived from the one below. |
| Parquet | an open columnar file format: data stored column by column for analytical speed and heavy compression. |
| Post-training | instruction tuning and learning from human preferences that turn a raw pretrained model into a helpful assistant; small, costly, high-leverage data. |
| Pretraining | the large-scale phase that compresses a vast text corpus into a model’s weights by predicting the next token. |
| RAG (retrieval-augmented generation) | fetching relevant data (usually by embedding similarity) and placing it in the context so the model answers from fact, not memory. |
| Schema-on-read / on-write | imposing structure at query time (lake) versus before loading (warehouse): the defining trade between them. |
| Semantic layer | one agreed, central definition of business metrics so every tool, model, and person means the same thing by “revenue.” |
| Separation of storage and compute | the cloud-era move of keeping data in cheap object storage and summoning elastic compute on demand, scaling and paying for each independently. |
| Spark | the in-memory successor to MapReduce: the default engine for processing lakes and lakehouses at scale. |
| Star schema | Kimball’s dimensional model: a central fact table of events surrounded by dimension tables, so analysis becomes filter-and-sum. |
| Synthetic data | model-generated training data used, under human-defined rules, to extend scarce human-generated data, especially at the frontier. |
| Token | the small chunk of text a model actually consumes, mapped to an integer id; the model’s native unit, the basis of context limits and pricing. |
| Tool use / function calling | letting a model call real APIs (a calculation, a live lookup, a SQL query, an action) and read the result back into its context. |
| Vector search | finding the stored vectors nearest a query vector: similarity search by meaning, the retrieval engine behind RAG. |
| Weights / parameters | the billions of numbers a model adjusts during training; its lossy, generalizing, long-term memory. |
BACK MATTER
Further Reading
Where to go when this book has done its job. The first book’s list pairs naturally with this one.
As before, everything below is either freely available or worth its price several times over, and the order is a suggested path rather than a ranking.
- Martin Kleppmann, Designing Data-Intensive Applications (2017). The bridge between both books: the operational systems of the first and the distributed processing of this one, at professional depth, with the same honesty about trade-offs.
- Ralph Kimball, The Data Warehouse Toolkit (1996 and later). The dimensional-modeling bible: facts, dimensions, and the star schema, from the man who shaped how analytical data is laid out to this day.
- Michael Armbrust, Matei Zaharia, et al., “Lakehouse: A New Generation of Open Platforms” (CIDR, 2021). The lakehouse argued by its architects; short, and exactly the synthesis of Piece Three.
- Patrick Lewis et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks” (2020). The paper that named RAG; the foundation of grounding a model in an exact estate.
- Yujian Bi, Chip Huyen, AI Engineering (2024), and Huyen’s Designing Machine Learning Systems (2022). The most practical guides to building production systems around models, including the context-versus-retrieval-versus-fine-tuning decisions of Piece Six.
- Yonghui Wu et al. and the Chinchilla scaling work (DeepMind, 2022). The line of research showing that data and compute must scale together, which reframed corpus size and quality as central rather than incidental.
- Anthropic, “Constitutional AI: Harmlessness from AI Feedback” (2022). How model-generated feedback under written principles extends scarce human labeling; a concrete instance of the frontier’s data philosophy.
- Richard Feynman, Six Easy Pieces (1994). The method both books borrowed: derivation over recitation, respect for the reader, and the conviction that the simplest honest explanation is the deepest one.
Where Data Learns · Part Two of Where Data Lives · produced June 2026. Set in Georgia and Arial. The field will move; the physics will not. Errors of fact are the authors’; errors of judgment are teaching opportunities, and we would still like to hear about both.