Subtext
Type an English subtitle line and get it in the Spanish a Mexican subtitler would actually write — with proof. Every reading is retrieved from 103.6 million real English–Spanish subtitle pairs and cites the exact lines it rests on. Built in two weeks for the Agentic Cinema hackathon (Google Cloud, ClickHouse track); open source and running.
The problem
Streaming lets you choose everything about a film except one thing: how much of the original line survives into the subtitle. Four independent studies, and my own measurement over 688,000 lines, agree that roughly 40% of strong language never reaches the Spanish subtitle. And if you are Mexican it gets worse: in the corpus, only 241 of 135,470 films are subtitled in recognisably Mexican Spanish. Peninsular Spanish outnumbers it seven to one.
Ask a language model for “Mexican Spanish” and it reaches for whatever sounds Mexican, with nothing behind the choice. Subtext replaces intuition with evidence: what did Mexican subtitlers actually write, and can the answer cite them?
What it does
One English line in, every reading the corpus attests out — because English you is tú, usted and ustedes at once, and a subtitle line arrives with no scene attached. Returning one answer would mean choosing silently.
$ subtext localise "Shut up!" EN Shut up! ES ¡Cállate! [tú] cited: pair_id 13142143, 83689621, 83067397 ES ¡Cállese! [usted] cited: pair_id 84948787, 81922469, 2911163 ES ¡Cállense! [ustedes] cited: pair_id 12557894, 63519068, 88388771
Nothing there was written by a model. Each line was written by a Mexican subtitler, and the pair_id says which one. Under every answer the site also prints two uncited controls: the same Gemini model asked for Mexican Spanish with no corpus behind it, and Google Translate. On Get out of my car. the controls say carro and coche; Mexican subtitlers write auto four to one, and Subtext cites the lines that prove it.
How it works
- Two retrieval channels, always both, failing in opposite directions. A vector index (Gemini embeddings behind an HNSW index in ClickHouse, ~6 ms instead of ~41 ms brute force) always answers something, which is exactly why its evidence is labelled weaker. An exact-phrase index over 172,000 n-grams is silent on anything it has not seen — and when it speaks, it reports what every line carrying the phrase agreed on.
- Enrichment beats frequency. Sorting renderings by count reproduces the industry’s own softening. Ranking by how much a rendering is enriched in Mexican productions versus the full corpus recovers what is Mexican: jódete scores 0.9×, chinga tu madre 188×. The same idea separates the answer from the noise inside a phrase: el appears in five of six lines and means nothing (4×); the real rendering appears in three and is 5,790× enriched.
- It abstains. Below a swept enrichment bound the phrase channel says nothing, because an agreement asserted where none exists is worse than none — it reads as citable.
- One Gemini call per reading, and the loop is closed by Python. The model receives the evidence and the grammar of the reading it is writing. Deterministic gates then check register against the corpus lexicon, re-tag the form of address, and verify citations; one retry names what was wrong. Nothing asks the model whether it is happy with its own output.
- A guess and a citation are never rendered the same way. A reading whose nearest precedent is too far to support it is flagged
WEAKrather than shipped with apair_idthat does not back it. - Agents on Google ADK. The localisation pipeline is an ADK LoopAgent: a deterministic evidence agent, one LLM translator, a deterministic gate, bounded iterations. A second agent answers questions over the corpus and reaches ClickHouse only through the official MCP server, behind a read-only SQL guard.
Measured, not asserted
A test set chosen by the people who built the system proves nothing, so the origin of every phrase travels with its row. The strongest group comes first: 40 lines selected by published translation scholars as documented cases of difficulty, with the official subtitle printed beside them; then 102 lines sampled from films, all verified absent from the corpus.
An earlier evaluation was withdrawn on purpose: it scored the retriever against a synthetic corpus whose labels came from the same process that wrote the dialogue. Numbers produced that way measure self-consistency, not retrieval, so they were removed rather than caveated. The replacement is measured against text this project did not write.