5.3 The Built System

This chapter illustrates

✓ The Modeling Thesis · ✓ The Alignment Thesis

The timeline told what happened. This chapter tells what got built, because none of the governance in the rest of the book makes sense until you can see the shape of the thing it governs. DocAble is a real system, live in beta: hand it a document a university actually distributes and it hands back a version a screen reader can read. Frontier models do the parts that require understanding a slide; ordinary deterministic code does everything else. The interesting engineering lives in how those two halves are joined.

5.3.1 What the system does, end to end

A user uploads a file. The system figures out what kind of document it is, breaks it into work, remediates each piece, checks the result against a real accessibility standard, stamps what it changed, and returns the corrected file with evidence that the job was done. Six moving parts carry that load.

Learn more about this governance mechanism: standards-grounded check engine.

Learn more about this governance mechanism: fidelity validator.

Learn more about this governance mechanism: per-mutator provenance stamps.

Those six parts are the product. What surrounds them is larger. In the talk this book grew from, I put the code-to-test ratio provocatively: the industry is happy with one line of tests per line of code, and I had one-to-four. The real recorded figure across the whole tree is close to that in spirit — the support apparatus, tests and lints and models and load-bearing documentation together, runs about 3.0 times the size of the production code. Call that inversion gold-plating if you like — but the more code the fleet produces, the smaller the fraction of it any human reads, and at this volume no one reads the diffs at all. The apparatus is the review.

Two design commitments run underneath all six. Every format is touched through one structured model, never the raw library, so a fix applied once holds everywhere. And the system fails loud: when the model is unreachable, the pipeline stops rather than quietly shipping a degraded file.

Learn more about this governance mechanism: one structured model per format.

5.3.2 The document is the hard part

None of this would be worth building if a document were merely text in a box, and of course it is not. A slide is a visual and semantic artifact — figures, tables, equations, an order the eye follows, emphasis carried by layout and color. To make it accessible, the system must recover enough of that meaning to present it through another channel. For years that was out of reach. The turn came with vision-language models that can look at a rendered slide and say what it means: read the equation, describe the figure, name what the slide is trying to teach.

That capability is real, and it is not a system. You can paste a small deck into a chat model and get useful output. You cannot get a corrected file back, a guarantee it satisfies the standard, or any evidence the meaning survived the trip. The model understands the slide and understands nothing about the file format, the standard, the university, or the cost of being wrong. Turning that flash of capability into something a university can trust is the engineering. The next section gives the pattern that does the turning.

5.3.3 Designing with a probabilistic component: the LLM as a function call

A model is a probabilistic component. Ask it the same question twice and you may get two answers. Ask it a question slightly outside what it saw in training and it will answer anyway, confidently, wrong. A deterministic function you can reason about; a probabilistic one you cannot. And yet the model is the only thing that can look at a figure and describe it. You have to build a reliable system out of an unreliable part.

The pattern that makes this work is to treat the model as a typed function call. Deterministic algorithms control the workflow and define the objective of each step. When a step needs semantic understanding, the system delegates a bounded task to a tool-equipped model — then a deterministic module validates the returned artifact before it is allowed in. The workflow is deterministic. The model is a subroutine inside it. The subroutine is never trusted on its word.

The same pattern, in another domain — and its lineage. The shape is old and rigorous. Proof engineering separates the untrusted work of writing a proof from the trusted kernel that checks it: the kernel, not the author's confidence, decides what is admitted. Ringer and colleagues survey what it takes to make formally verified software scale: proof organization, automation, and maintenance 11. Talia Ringer et al., “QED at Large: A Survey of Engineering of Formally Verified Software,” Foundations and Trends in Programming Languages 5, nos. 2–3 (2019): 102–281, https://arxiv.org/abs/2003.06458.. Recent systems put a language model inside that loop, letting it search for proof structure while a prover returns counterexamples and admits only a closed proof 22. Haoxin Tu et al., “Agentic Verification of Software Systems,” 2025, https://arxiv.org/abs/2511.17330.. Our own AutoSOUP is one: it verifies component-level memory safety by representing scope, loop bounds, and environment assumptions as explicit unit-proof artifacts, delegating bounded inference through an LLM-as-function-call architecture, and validating each choice against the verification objective 33. DocAble Research Group, “Deterministic Workflows with Bounded Model Delegation for Software Verification,” 2026, https://arxiv.org/abs/2605.10712..

MAGE carries the same trust boundary out of the proof assistant and into ordinary production. The external authority need not be a theorem prover. It can be a type system, a semantic lint, a preservation check, an architecture gate, a conformance engine, or a deploy rule. What must not blur is the guarantee each one carries: a lint proves less than a verifier, a preservation check proves only the property it encodes, and no green local check certifies the whole system. The untrusted generator paired with a trusted checker is not MAGE's invention; MAGE's move is to compose that one shape across the whole line.

Read the pattern in three moves, drawn in Figure 5.3-1.

The LLM as a typed function call A left-to-right pipeline in four stages. A deterministic caller owns the workflow and decides when a step needs judgment. It packs the task into a typed input contract and hands it to the probabilistic component, the model, drawn as a dashed box to mark that its output is not trusted. The model returns a candidate answer that must conform to a typed output contract. A deterministic validator then checks that candidate: on a pass, the result is incorporated and control returns to the caller; on a fail, the caller retries or falls back. The trust boundary sits at the validator, not at the model. The dashed model box and the solid caller and validator boxes together say the same thing the prose does: guidance aims, machinery holds. Deterministic caller owns the workflow; decides each step typed input contract Model the probabilistic “function” — one bounded task typed output contract Deterministic validator checks the candidate trust boundary pass result incorporated fail → caller retries or falls back The model is called like a function: a typed task in, a typed answer out — never trusted until a deterministic check has passed it.
Figure 5.3-1. LLM as a Function Call. A deterministic caller packs a task into a typed input; the model returns output under a typed contract; a validator passes it before use. Determinism on both ends makes the model safe to call: a bad generation costs a retry, never a corrupt result.

This is why DocAble can make a defensible claim on top of an infinite midwit. The model supplies the one thing deterministic code cannot: it looks at the figure and understands something. Everything around that understanding — when to ask, what to ask, whether to believe the answer — stays in code you can reason about and test. The probabilistic part is sealed inside a bounded call with a check on the way out.

This discipline was earned the hard way. Skip the wrapper and the model will find the exception you did not guard — I assure you. Agents are the fastest road to a working demo and the fastest road to a subtle, confident, wrong result. The function-call shape keeps the first from becoming the second.

5.3.4 Three views of the same system

A model shows a view. The sections below draw three architectural views of DocAble from its real system models. Each answers a different question. The first asks how the services are shaped, and why that shape let the whole system change its deployment target without a rewrite. The second asks how the front end is decomposed, and how the editor changes a document through a small edit language. The third connects that edit language to the automated pipeline, and shows the join as a concrete instance of the function-call pattern above. Read together, they are the standing structure the rest of the book governs.

5.3.5 View 1 — a reactive service seam, and how it made serverless natural

The back end is a set of small services wired to react to events. A user's upload lands at a web front door, which splits the document into chunks and enqueues each chunk as a unit of work. A queue hands each chunk to a stateless worker. The worker remediates its chunk and publishes a completion. A fan-in step collects the completions and assembles the finished file. Every hop is an event handed forward, not a component polling for work. Two commitments hold the seam together: services stay reactive and stateless, and the split of duties is declared — Redis carries communication, the database carries truth. Figure 5.3-2 draws the seam and the two ways it deploys.

Learn more about this governance mechanism: service-flow model.

The reactive service topology, and why it made serverless natural Two stacked panels compare the same event-driven flow under two deployment targets. The top panel, the reactive seam, reads left to right: the web front door accepts an upload and enqueues chunks onto a work queue; a queue hands each chunk to a stateless worker that remediates it and publishes a completion; a fan-in step collects the completions and assembles the finished document. Every arrow is an event, not a poll. A note reads: services are reactive and stateless; Redis carries communication, the database carries truth. The bottom panel shows the same flow realized two ways. On the left, the retired Kubernetes poll plane: workers reach into size-stratified Redis queues to claim work, and a custom autoscaler watches queue depth to add or remove worker pods. On the right, the serverless push plane: a managed task queue pushes each chunk to a worker that scales from zero, and a managed topic fans in completions, with no custom autoscaler at all. The takeaway, stated across the bottom: because the services were already reactive and stateless, moving from poll to push was a change of deployment target, not a rewrite. The reactive seam was the enabler. The reactive seam Web front door; splits into chunks enqueue Queue chunk = task hands off Worker stateless; remediates a chunk publishes Fan-in assembles the file Every arrow is an event, never a poll. Services stay reactive and stateless — Redis carries communication, the database carries truth. Same flow, two deployment targets Kubernetes poll plane (retired) Worker pool pulls work Custom autoscaler Workers PULL from size-stratified Redis queues; a bespoke loop watches depth and adds or removes pods. Serverless push plane Managed task queue Worker, scale-from-0 The platform PUSHES each chunk to a worker that scales from zero; native autoscale — no custom scaler at all. The move was a change of deployment target, not a rewrite. Because the services were already reactive and stateless, poll-to-push was natural. The reactive seam was the enabler.
Figure 5.3-2. The Reactive Seam. Top: an event-driven flow — web enqueues chunks, a queue hands each to a stateless worker, a fan-in assembles the result. Bottom: the same flow two ways — the retired Kubernetes poll plane and the serverless push plane, native autoscale, no custom scaler.

That shape is what made a hard migration easy. For most of the system's life the workers ran on a Kubernetes cluster, and the dispatch worked by poll: workers reached into size-stratified Redis queues and claimed the next chunk, while a custom autoscaler watched queue depth and added or removed worker pods. The cluster billed around the clock, which for a bursty, low-traffic product was the wrong cost shape. The fix was to move to a serverless push plane: a managed task queue hands each chunk to a worker that scales from zero, a managed topic fans in the completions, and the platform's native autoscaler replaces the custom one.

In the industry a re-platforming like that is a quarters-long migration with a rewritten coordinator and a nervous cutover. Here it was close to a change of deployment target. The reason is the seam. A reactive, input-triggered handler is the serverless execution model (an event in, work out), so the workers did not need new logic to be pushed to instead of polling. A stateless worker can be spun up on demand and thrown away, because it carries nothing between invocations. And the split that kept coordination in Redis and truth in the database meant the durable state did not live in any worker that serverless would recycle. The poll-to-push inversion then deleted complexity rather than adding it: the custom autoscaler, the one-cluster-per-prefix rule, and the idle-scaling controller all fell away, replaced by the platform's native scale-to-zero.

None of the three hardening pushes that produced this shape — the reactive conversion, the move to statelessness, the modeling of the cross-service invariants — was aimed at serverless. Each was motivated on its own terms. Their convergence is the lesson: a system built reactive, stateless, and modeled is, almost by accident, a system that is safe to run serverless. The reactive seam was not a feature of the migration. It was its precondition.

Here is how fast the seam let the migration go — the operating loop the rest of the book describes. The timeline already tells the migration itself: a Monday teardown of an idle Kubernetes cluster, serverless by that night, about 400 commits structured into 27 phased designs. What matters here is the loop those phases ran: the agent proposes a phased design, it surfaces the decisions that need a human — one to eight judgment calls a phase — I make those calls, and it executes. It was a re-platforming that would be a quarters-long project in industry, run over two days because the seam had already been built right.

5.3.6 View 2 — the front end as model-view-controller over a shared edit language

The front end is a small single-page application plus a set of supporting surfaces — an account view, a job history, an operator dashboard, and the editor. The piece worth drawing is the editor, because it shows the cleanest decomposition. The editor is a model-view-controller loop over one document, drawn in Figure 5.3-3.

The editor’s model-view-controller loop and the shared edit language A model-view-controller triangle sits over a document. The View is the two-pane editor the user sees: a rendered page on the left with overlay boxes marking structure, and a card list on the right with editable fields for alt text, role, and reading order. A user gesture flows from the View to the Controller. The Controller does not mutate the document directly. Instead it emits a typed edit operation drawn from a small, closed vocabulary: set alt text, set role, set decorative, reorder reading, set title, set language, set actual text. That operation is the Model’s only input. The Model applies the operation to the document intermediate representation and returns the updated state, which re-renders the View. The closed operation set is labeled the shared edit language. A note beneath it says: this same language is the target the automated remediation produces. The takeaway: the editor UI and the automated pipeline both speak one edit language, so one document model has exactly one way to be changed. The editor: one MVC loop over the document View — two-pane editor page + overlays editable cards user gesture Controller emits one typed edit operation — never a raw mutation emits The shared edit language one closed set of edit operations set-alt-text · set-role · set-decorative reorder-reading · set-title · set-lang set-actual-text also what the pipeline produces applies to Model — the document IR applies the op, returns updated state re-render One model, one way to change it.
Figure 5.3-3. The editor as one MVC loop over the document. A gesture flows View to Controller; the controller emits one typed edit op from a closed vocabulary; the model applies it and returns state to re-render the View. The same edit language is what the automated pipeline produces.

The operation the controller emits is drawn from a small, closed vocabulary: set the alt text, set the role, mark an element decorative, reorder the reading order, set the document title, set the language, override the displayed text. That vocabulary is a little language for changing a document — an edit language. Every gesture routes through it for the reason that runs under the whole system: a document has exactly one way to be changed. The editor never edits the document. It speaks the edit language, and the model is the only thing that touches the document.

Learn more about this governance mechanism: closed edit-operation vocabulary.

The read-only diff views for slides and word processor files share this shape, differing only in the adapter that fetches their structure. One surface, one edit vocabulary, many formats. The uniformity is the payoff: a fix or a constraint applied to the edit language holds for every format and every producer that speaks it — and the more producers speak it, the more each fix is worth. This is the Modeling Thesis in miniature — a structured model binding what a change means to how the document is touched, so intent and implementation cannot drift apart.

5.3.7 View 3 — the edit language as the target of automated remediation

Here the two halves of the system join, and the join is the function-call pattern from earlier in the chapter, seen once more.

The edit language the editor speaks is not only the editor's. It is the same target the automated pipeline produces. When the pipeline decides a figure needs alt text, the result it emits is an edit operation — the very set-alt-text the editor would emit if a human did it by hand. The human path and the automated path are two producers of one language, and they flow into one document model that applies each operation and stamps it.

The mapping from a remediation task to an edit operation is a function: task in, operation out. And that function is a concrete instance of the LLM as a function call. Inside it, a bounded task — this figure, this context, this question — is packed into a typed input and handed to the model as a call; the model returns a candidate; and a deterministic validator checks the candidate before it is allowed to become an edit. The edit language is the typed output contract. An honest caveat: this task-to-edit function is mostly hardcoded today and will be fleshed out. What matters now is the shape and the trajectory, not a finished implementation — the concept is that automated remediation and hand editing are the same operation reached two ways. Figure 5.3-4 draws both paths into one edit language.

Two producers of one edit language, and the task-to-edit function Two producers converge on one shared edit language, which drives one document model. The top producer is the human path: a person working in the editor emits edit operations by hand. The bottom producer is the automated path: a remediation task, such as a figure that needs alt text, becomes an edit operation through a task-to-edit function. Inside that function, the bounded task is packed into a typed input and handed to a model as a typed function call; the model returns a candidate; a deterministic validator checks it before it is allowed through. This is the same LLM-as-function-call shape described earlier in the chapter, applied here. Both producers emit the same closed set of edit operations, and both flow into one document model that applies them and stamps each change. A note marks the task-to-edit mapping as mostly hardcoded today, to be fleshed out, so this is the concept and the trajectory rather than a finished implementation. Two takeaways sit at the bottom. First, routing both producers through one language and one validated boundary buys traceability, every edit is a typed, validated, stamped result you can explain and reverse, and confidence, the deterministic validator holds the line. Second, scoping each call to one bounded task also scopes the reasoning, which lowers token cost. That scoping is the same move as building the whole remediation as a series of small, bounded transformations, seen from the cost angle instead of the pipeline angle. Two producers, one edit language Editor (human) emits ops by hand Remediation task (e.g. alt text) task-to-edit function an instance of LLM-as-function-call Model bounded call Validator checks candidate Shared edit language Document model applies + stamps each edit The task-to-edit mapping is mostly hardcoded today — to be fleshed out. Concept and trajectory, not a finished build. Traceability and confidence — plus cheaper reasoning One language and one validated boundary makes every edit a typed, validated, stamped result you can explain and reverse (traceability); the deterministic validator holds the line (confidence). Scoping each call to one task also scopes the reasoning — the same move as small transformations, priced.
Figure 5.3-4. Two Producers, One Language. The human path emits ops by hand; the automated path turns a remediation task into an op through a task-to-edit function — an instance of LLM-as-function-call. Both emit the same closed edit vocabulary into one document model that applies and stamps each edit.

Why route through the language at all

The frontier models can already skip all of this. Opus and the project's own agent can take a slide deck and remediate it directly — at least for slides — with no pipeline, no edit language, no validator. So why build the machinery at all? Direct remediation buys neither of the two things a university needs. You cannot audit what a direct edit changed: the model hands back a file, not a list of typed changes you can inspect, explain, and reverse. And you cannot trust it: there is no deterministic check that the standard was met and the meaning survived. Routing every change through one edit language and one validated boundary buys both. Traceability comes free, because every edit is a typed, validated, stamped result with a history you can reconstruct. Confidence comes from the validator that sits at the trust boundary and refuses a candidate that fails.

There is a third dividend, and it connects this view to a habit the book returns to later. Scoping each model call to one bounded task also scopes the reasoning: the tighter the task, the less the model must reason over, and the fewer tokens the reasoning costs. A model asked to describe this figure under this context does less work than a model asked to remediate a whole document in one shot. That token-scoping is the same move as building the remediation as a series of small, bounded transformations rather than one giant leap — the same idea seen from the cost angle instead of the pipeline angle. A chain of scoped passes is cheaper to run and cheaper to reason about, because each link asks the model for exactly one small thing. (See: transformation — everything a model does well is a sized transformation, and sizing the leap is the skill.)

These three views were not drawn by hand. They were rendered from DocAble's real system models — typed records the fleet reasons through — and those models stay true to the code only because a traceability substrate re-checks them against it, the deep-dive we return to in the Model Zoo.

5.3.8 Same song, second verse

Notice the shape of the argument, because the book made it again at a larger scale. A model can do the one thing deterministic code cannot — look at a figure and understand it — and it is unreliable. You do not make it reliable by trusting it more. You make a reliable system by wrapping it: bound what you ask, type what comes back, validate before you believe. Inside DocAble, the wrapped component is a vision-language model writing alt text.

Zoom out one level and the coding agents that built DocAble are the same kind of component: powerful, probabilistic, capable of a confident wrong turn. The methods in the earlier chapters are the same pattern applied to them — bound the task, type the interface, validate before you trust. You have now seen, in the small, the pattern the rest of the book applied in the large. Same song, second verse.

Works Cited

  1. Ringer, Talia, Karl Palmskog, Ilya Sergey, Milos Gligoric, and Zachary Tatlock. “QED at Large: A Survey of Engineering of Formally Verified Software.” Foundations and Trends in Programming Languages 5, nos. 2–3 (2019): 102–281. https://arxiv.org/abs/2003.06458.
  2. Tu, Haoxin, Huan Zhao, Yahui Song, Mehtab Zafar, Ruijie Meng, and Abhik Roychoudhury. “Agentic Verification of Software Systems.” 2025. https://arxiv.org/abs/2511.17330.
  3. DocAble Research Group. “Deterministic Workflows with Bounded Model Delegation for Software Verification.” 2026. https://arxiv.org/abs/2605.10712.
© James C. Davis, 2026–present