Natural language processing
Capstone: Design, Evaluate, and Defend an End-to-End NLP System
Design a multilingual public-transport support system that combines routing, retrieval, extraction, summarization, translation, dialogue, human review, and monitoring.
By the end you can
- Translate a complex service problem into bounded NLP tasks and output contracts
- Design data, model, retrieval, evaluation, safety, and human-review components as one system
- Construct an evidence plan that covers ordinary quality, rare failures, multilingual behavior, and production change
- Defend architecture choices, fallback rules, release gates, and conditions for redesign or shutdown
Key idea
The service must help without pretending to know
A regional transit authority receives messages in eight languages. They arrive through web forms, email, chat, and speech transcripts. Users ask about refunds, accessibility, lost property, service disruptions, penalties, and safety incidents.
The proposed system may classify intent, retrieve official policy, extract journey details, summarize long cases, translate content, and draft replies. It must not invent policy, expose personal data, or automate high-consequence decisions without authorization.
That last prohibition is easy to write and has a documented price. New York City's official MyCity business chatbot advised businesses to break city law. It told landlords they need not accept Section 8 vouchers, which is illegal source-of-income discrimination in NYC. It told restaurants they could go cash-free, banned by a 2020 city council law. It told employers they could take workers' tips: “Yes, you can take a cut of your worker’s tips.”
The bot launched in October 2023 under Mayor Eric Adams and ran on Microsoft Azure AI. The Markup published the transcripts on 29 March 2024. Ten Markup staffers put the housing-voucher question to it, and it told all ten that buildings did not have to accept the vouchers. That is not one unlucky sample from a stochastic model. It was the system's settled answer.
The city left the pilot online. Its Office of Technology and Innovation said the bot “has already provided thousands of people with timely, accurate answers”. Four days later THE CITY found the tool still running, and the mayor defending it at a press conference: “We're identifying what the problems are, we're gonna fix them, and we're going to have the best chatbot system on the globe”.
Every element of that failure is available to the transit capstone. A government publisher. An authoritative rulebook that existed and was not consulted. A fluent wrong answer about a regulated obligation. A user population with no way to tell. And an operator whose evidence for the system was volume served.
The capstone succeeds only if the system knows what it may do, what evidence it needs, and when it must defer.
Visual
Whose language and consequences shape the design
Each stakeholder supplies different requirements and failure evidence. The MyCity case shows why one group alone is not enough. The business owners who asked got a fluent answer and no signal. The policy owners had a correct rule on file that the bot contradicted. The reading that matters legally came from outside the product team entirely: advising a landlord to refuse Section 8 vouchers is advice to commit illegal source-of-income discrimination. Legal Services NYC and the NYC Hospitality Alliance said so, reacting in a newsroom investigation. The Office of Technology and Innovation, meanwhile, held a metric that pointed the other way — thousands of people served with what it called timely, accurate answers.
Map each group below to the specific evidence it owns, and to the failure only it can see.
Passengers and advocates
Need accessible, multilingual, accurate help with clear escalation.
Support agents
Need evidence, concise case views, editable drafts, and reliable handoff.
Policy and operations teams
Own authoritative documents, service updates, and exception rules.
Privacy, safety, and legal teams
Set data limits, prohibited automation, retention, and incident obligations.
Engineering and evaluation teams
Build, measure, operate, diagnose, and retire the system.
Steps
Decompose the product into auditable language tasks
Do not assign one model the vague job of understanding customer messages. A single free-text path from question to answer has no place where a policy claim can be checked against a source. It has no place where low confidence can turn into a question. It has no place where a prohibited action can be refused. So when such a system is wrong, it is wrong fluently and repeatedly — as it was for all ten Markup staffers.
Each step below is a separate contract with its own output type, its own evidence requirement, and its own failure control.
1. Triage and urgency
Predict one or more routing labels with calibrated abstention.
2. Structured case extraction
Capture dates, routes, ticket references, accessibility needs, and incident locations.
3. Evidence retrieval
Find current policy passages and live service notices with source metadata.
4. Agent assistance
Summarize the thread and draft a response constrained by retrieved evidence.
5. Conversation and handoff
Track missing information, ask bounded questions, and transfer state to a human.
Comparison
Three architectures worth comparing before implementation
The capstone should defend a choice rather than assume the most complex design is best.
The “Higher verification burden” listed against the LLM-centered assistant has been measured, in a domain where a wrong citation is disqualifying. Dahl and colleagues profiled how often general-purpose models invent answers to verifiable questions about federal cases. They reported the result in the Journal of Legal Analysis in 2024: “we show that LLMs hallucinate at least 58% of the time”. ChatGPT 4 sat at that floor. Llama 2 ran as high as 88%.
That is the case for retrieval. The case against treating retrieval as the fix came from the same group. They ran the first preregistered evaluation of the retrieval-augmented commercial tools built for exactly this problem, and published it in the Journal of Empirical Legal Studies in 2025: “While hallucinations are reduced relative to general-purpose chatbots (GPT-4), we find that the AI research tools made by LexisNexis (Lexis+ AI) and Thomson Reuters (Westlaw AI-Assisted Research and Ask Practical Law AI) each hallucinate between 17% and 33% of the time.” The vendors had advertised “hallucination-free” citations.
Read the two numbers together before choosing a row. Grounding a generative component in authoritative sources moved the error rate from at least 58% to between 17% and 33%. It did not move it to zero. The products measured were built by document companies over their own authoritative corpora, and a transit assistant drafting refund and penalty replies over policy PDFs is not in a better position.
That residual is the whole argument for the hybrid governed row: deterministic gates on the consequential intents, claim-level attribution to a retrieved passage with a policy version, and abstention when support is missing. Those controls assume the generator will still be wrong sometimes. The alternative assumes retrieval has fixed it.
Rules plus search
Use deterministic routing for critical cases and lexical retrieval over approved documents.
- Fast to audit
- Strong for stable phrases
- Limited paraphrase coverage
- Useful baseline and fallback
Specialized NLP pipeline
Combine classifiers, extractors, hybrid retrieval, and templated response assembly.
- Clear component metrics
- Controllable output contracts
- More integration work
- Good for bounded workflows
LLM-centered assistant
Use a generative model for routing, extraction, retrieval orchestration, and drafts.
- Flexible interaction
- Broad language coverage
- Higher verification burden
- Requires strict tools and policy controls
Hybrid governed system
Use deterministic gates, specialized models, retrieval, and generation only where each earns its role.
- Defense in depth
- Independent fallbacks
- Complex ownership
- Best candidate when evidence supports it
Example
Evidence the team must assemble before training
The plan should separate what was convenient to build from what the team claims is ready to run in production.
Eight languages are not eight equal columns in that plan, and the inequality starts before any model runs. A 2023 NeurIPS paper measured it: “The same text translated into different languages can have drastically different tokenization lengths, with differences up to 15 times in some cases.” Even character- and byte-level models differed by over 4 times. A separate team audited OpenAI's API across 22 typologically diverse languages in 2023. Speakers of many supported languages are overcharged while obtaining poorer results, and they tend to come from regions where the APIs are least affordable.
For the transit system this converts three fairness intentions into engineering quantities. The same complaint, in two of the eight languages, can consume up to 15 times the tokens. The per-message cost differs by language. So does the latency, and so does the point at which a long thread is truncated out of the context window. A corpus and evaluation plan that does not record token length per language cannot tell later whether a language performed worse because the model is weaker on it, or because half its case history was silently cut.
- Corpus: policy documents, disruption notices, historical tickets, agent replies, metadata, language, channel, timestamps, and permission records — with the authoritative rulebook identified by version, since the MyCity failure was a contradiction of a rule that existed.
- Labels: intent, urgency, entities, answerability, evidence support, escalation reason, and final resolution, with guidelines and adjudication.
- Splits: group by conversation and passenger where permitted, preserve time order, and isolate policy revisions and future service periods.
- Coverage: sample ordinary traffic, low-resource languages, accessibility requests, transcription noise, long threads, and rare safety cases — recording tokens per message per language, since a 15-fold length difference changes cost, latency, and truncation before quality is measured at all.
- Challenge suites: negation, ambiguous dates, code-switching, outdated policies, prompt injection, unsupported requests, and privacy-sensitive text.
- Outcome evidence: agent edits, resolution time, recontact, appeal, escalation, passenger complaint, reviewer workload, and delayed correctness — noting which of these are throughput measures that can improve while quality falls.
Analogy
An air-traffic control handoff board
Controllers share a board that records each aircraft, its verified route, current status, unresolved issue, and responsible controller. The board supports coordination because claims are tied to evidence and ownership.
An aircraft has one position at a time. A language case has no single fully observable state. Passenger intent, policy exceptions, and missing history can all remain ambiguous, so the system needs uncertainty and repair.
A useful case state records evidence, uncertainty, responsibility, and the next safe action.
Steps
Build evaluation from component evidence to service outcomes
No single metric can certify the complete system.
Step 3 is where the transit authority's speech-transcript channel stops being an implementation detail. Five commercial speech recognizers — Amazon, Apple, Google, IBM and Microsoft — were tested on 19.8 hours of interviews with 42 white and 73 black speakers across five US cities. Koenecke and colleagues reported the result in PNAS in 2020: “We found that all five ASR systems exhibited substantial racial disparities, with an average word error rate (WER) of 0.35 for black speakers compared with 0.19 for white speakers.” The gap persisted on identical phrases, and it was traced to the acoustic models. It was not an artefact of what people happened to say.
A separate audit ran popular English ASR services against more than 2,700 speakers born in 171 countries, drawn from the Speech Accent Archive. Service performance had a statistically significant relationship to the speaker's country of birth. That held for every service tested.
A single headline word error rate averages 0.35 and 0.19 into one acceptable-looking figure. Every component downstream inherits the difference: intent routing on a corrupted transcript, entity extraction that loses a route number, a summary that drops the accessibility request. Report the slice or do not claim the channel works.
1. Validate each component
Measure routing, spans, retrieval recall, ranking, support, translation, and summarization separately.
2. Test end-to-end scenarios
Run complete conversations with missing fields, conflicting evidence, and policy updates.
3. Measure slices and languages
Report quality, abstention, latency, and escalation by language, channel, intent, and consequence.
4. Conduct expert human review
Separate factual support, completeness, clarity, policy compliance, and action safety.
5. Link to operational outcomes
Compare resolution, recontact, appeals, agent effort, user accessibility, and incidents.
Key idea
Write a safety case, not a list of reassuring features
For each prohibited or high-consequence action, state the hazard, triggering conditions, preventive controls, detection tests, fallback, and residual risk. Examples include mishandling a safety report, exposing another passenger’s data, or citing an obsolete refund rule.
The control most teams write down first is a human reviewer, and it is the one most often stated without evidence. It has been measured. Twenty-seven radiologists read 50 mammograms accompanied by a purported AI's BI-RADS suggestions. When the suggestion was wrong, the share of correctly rated mammograms collapsed: from 79.7% to 19.8% for inexperienced readers, from 81.3% to 24.8% for the moderately experienced, and from 82.3% to 45.5% even for the very experienced. Dratsch and colleagues published that in Radiology in 2023. Their conclusion: “The results show that inexperienced, moderately experienced, and very experienced radiologists reading mammograms are prone to automation bias when being supported by an AI-Based system.” Bernstein and colleagues reproduced the effect in another modality, reporting in European Radiology in 2023 that incorrect AI raised the false-negative rate from 2.7% with no AI to 33.0% when the AI result was shown and believed to be retained.
Note what expertise bought and what it did not. The very experienced readers held on to 45.5% where the inexperienced fell to 19.8%. Better, and still a control failing more often than it works. What produced the collapse was defined by what the interface showed and what the reader believed happened to the output, not by who the reader was. A human reviewer is not a complete control unless the interface shows evidence, time pressure is manageable, authority is clear, and disagreement can change the action. The safety case has to test that, not assert it.
Benchmarks rarely carry the weight a release places on them. Bowman and Dahl argued that in 2021, and their opening is blunt: “Evaluation for many natural language understanding (NLU) tasks is broken”. Unreliable and biased systems “score so highly on standard benchmarks that there is little room for researchers who develop better systems to demonstrate their improvements.” They “lay out four criteria that we argue NLU benchmarks should meet”. They hold that “most current benchmarks fail at these criteria”. And they reject the fashionable remedy: “adversarial data collection does not meaningfully address the causes of these failures”. A control resting on a benchmark inherits that benchmark’s validity. The safety case is where a team has to say which one.
A control counts only when its operating conditions and failure mode are tested.
Steps
Define release gates before seeing favorable results
The team should know which evidence can block launch and which limitations require the scope to be cut. For part of this the team no longer writes the list itself.
Article 14 of Regulation (EU) 2024/1689, the Artificial Intelligence Act, sets out human oversight for high-risk systems as named components. Overseers must be enabled to understand the system's relevant capacities and limitations and to duly monitor its operation. They must remain aware of “the possible tendency of automatically relying or over-relying on the output produced by a high-risk AI system (automation bias)” — the statute names the failure the mammography study measured. Under Article 14(4)(d) they must be able “to decide, in any particular situation, not to use the high-risk AI system or to otherwise disregard, override or reverse the output of the high-risk AI system;”. The article also requires an interruption path: a “stop” button or a similar procedure that allows the system to come to a halt in a safe state.
Article 14(5) goes further for the biometric identification listed at Annex III point 1(a). No action or decision may be taken on the basis of the identification unless it has been “separately verified and confirmed by at least two natural persons with the necessary competence, training and authority”. That requirement does not apply to certain law enforcement, migration, border control and asylum uses where Union or national law considers it disproportionate.
A RAND report summarises the same obligations as “human oversight measures to enable deployers to not use the system or to disregard it, override it, reverse its outputs, or interrupt it and bring it to a halt in a safe manner”. It records 2 August 2026 as the application date for most of the Act. The Chapter III high-risk requirements, Article 14 among them, were deferred by the Digital Omnibus on AI: to 2 December 2027 for stand-alone Annex III systems, and to 2 August 2028 for AI embedded in regulated products under Annex I.
Whether this transit assistant falls inside Annex III is itself a finding the design review must record rather than assume. Either way the article supplies a gate checklist a team can be held to. A named overseer. Evidence of the system's limits in front of them. A documented override that actually changes the outcome. A stop procedure that has been exercised. Each with a test, not a paragraph.
1. Set minimum component gates
Require retrieval coverage, span integrity, calibration, and policy-version correctness.
2. Set scenario gates
Block severe failures in safety, privacy, accessibility, and unsupported claims.
3. Set operational gates
Verify latency, capacity, logging policy, fallbacks, rollback, and on-call ownership.
4. Limit initial scope
Start with selected languages, intents, channels, and agent-assist mode.
5. Expand only with evidence
Use canary outcomes, incident review, and refreshed evaluations for each new scope.
Example
What the final design review must contain
A credible capstone is a decision package, not a polished architecture diagram alone. Each item below should be readable by someone looking for the thing that will fail.
- One-page problem statement: users, decisions, evidence boundary, prohibited actions, and success conditions — with the prohibited actions written as concretely as "do not tell a landlord they may refuse a housing voucher".
- System map: every component, artifact version, external dependency, fallback, privacy boundary, and human handoff.
- Data dossier: provenance, permissions, unit, labels, splits, coverage gaps, and refresh plan, including tokens per message by language where a 15-fold spread changes cost and truncation.
- Evaluation dossier: metrics, behavioral tests, challenge suites, human rubric, uncertainty, and release thresholds, sliced by language and channel rather than averaged into one word error rate.
- Operations plan: deployment, telemetry, review queues, incident response, rollback, index refresh, and retirement — with the named overseer, the tested override, and the stop procedure Article 14 requires.
- Decision memo: chosen architecture, rejected alternatives, expected costs, unresolved risks, and evidence that would trigger redesign, stating the residual unsupported-claim rate the team expects rather than implying retrieval removed it.
The best system may automate less than the original proposal
The design may conclude that generation should remain agent-assist only, that rare safety cases need deterministic routing, or that two languages lack enough evaluation evidence for launch. Such constraints are evidence of sound engineering rather than failed ambition.
One company published both ends of that argument using its own numbers. In its first month, Klarna's AI assistant did the equivalent work of 700 full-time agents, across 23 markets and more than 35 languages. Resolution time fell from 11 minutes to under 2. Repeat inquiries fell 25%. The company put the profit improvement for 2024 at an estimated $40 million. Its announcement on 27 February 2024 led with the volume: “The AI assistant has had 2.3 million conversations, two-thirds of Klarna’s customer service chats”. Fifteen months later Klarna was recruiting human agents again. CEO Sebastian Siemiatkowski told Fortune on 9 May 2025 that cost had been “a too predominant evaluation factor” and that “what you end up having is lower quality”.
Read the first list again knowing the second. Volume, handling time and repeat contacts all moved the right way, and every one of them is a throughput measure. The quality the operator eventually cared about was not among them, so nothing in the launch dashboard could report its decline. That is the case for the outcome evidence in the data plan, and for a bounded launch. Not caution for its own sake: it is the only way the thing that failed here becomes visible before fifteen months have passed.
A strong final defense distinguishes what the system knows, what it estimates, what it retrieves, what it is permitted to do, and what remains a human or policy decision.
The habit this lesson resists has a name too. A small set of influential benchmarks “operate as stand-ins”. They stand in for “a range of anointed common problems that are frequently framed as foundational milestones on the path towards flexible and generalizable AI systems”. And “State-of-the-art performance on these benchmarks is widely understood as indicative of progress towards these long-term goals.” Raji and colleagues wrote that in 2021, and their position paper asks whether that inference is valid at all. A capstone states what its evidence covers, and what it does not. It is answering the same objection at product scale.
Completion means a defensible scope and evidence plan, not maximum automation.
Key takeaways
- A complex NLP product should be decomposed into measurable routing, extraction, retrieval, generation, and interaction contracts. A single free-text path, like the MyCity bot's, gives a wrong policy claim nowhere to be caught.
- Architecture selection should compare rules, specialized models, generative models, and hybrid controls against the same requirements — knowing that retrieval over authoritative sources took legal hallucination from at least 58% to between 17% and 33%, not to zero.
- The data plan must preserve conversation groups, time, policy versions, language coverage, challenge cases, permissions, and delayed outcomes. It must also record tokens per language, where the same text can run up to 15 times longer in one language than another.
- End-to-end evaluation combines component metrics, behavioral scenarios, language and consequence slices, expert review, and service outcomes. An average word error rate of 0.35 against 0.19 disappears into one acceptable headline number.
- Release gates should cover severe hazards, component quality, operational readiness, fallback, rollback, and accountable ownership before exposure grows. For high-risk systems, Article 14 of Regulation (EU) 2024/1689 names the oversight components a team can be held to.
- The capstone is successful when its scope, evidence, limitations, and human responsibilities can be defended — even when that means less automation, as Klarna's 2.3 million conversations and its later rehiring of human agents together show.