{"slug": "deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai", "title": "Deterministic tools with probabilistic interfaces are the future of AI", "summary": "DoorDash cut LLM search costs from $7.90 to $0.11 per thousand queries — a 98% reduction — while raising accuracy from 93.4% to 93.9%, by replacing its model provider's built-in search with its own deterministic search gateway that the model calls as a tool, according to a DoorDash engineering blog post. With a warm cache, 99.4% of queries never reached a search provider, and the structured tool response also fixed an instruction-following failure in which Claude Sonnet 4 ignored an explicit \"answer only, no explanation\" directive 78.1% of the time when built-in search was enabled. The post argues the pattern — LLMs as the fuzzy-to-precise interface, deterministic software doing the actual work — is spreading, citing Claude Code creator Boris Cherny's account on the Latent Space podcast that letting the model use grep and read files \"outperformed everything, by a lot\" over an embeddings-based RAG index, and dbt's semantic-layer benchmarking for text-to-SQL.", "body_md": "While scrolling HN I cam across a blog post from DoorDash with an interesting, title: [How DoorDash Reduced LLM Search Costs by 98% Without Losing Accuracy](https://careersatdoordash.com/blog/how-doordash-reduced-llm-search-costs-by-98-without-losing-accuracy/). Ninety-eight percent. Not by switching to a cheaper model, and not by some clever prompt. They did it by no longer letting the model do the work, but going back to boring deterministic software.\n\nAnd they are not the only ones. Look around and you start seeing the same move everywhere. The big players are quietly converging on a pattern where the AI is the *interface*, not the *worker*. Ask questions, have conversations, but the work is all just regular software.\n\nLLMs are amazing at one thing in particular: taking something fuzzy that a human said and turning it into something precise (most of the time). \"How did revenue do last quarter in Europe?\" becomes `metric=revenue, period=Q3, region=EU`. That translation step is where the magic is, and nothing else we have does it nearly as well if you are working with unstructured input.\n\nWhat LLMs are *not* great at is doing the actual work afterwards. Fetching data, doing math, joining tables, looping over 10,000 rows. They can do it, sure, but every time you ask you pay per token, you wait, and you might get a slightly different answer than last time. And especially the price part is pushing people to a new pattern.\n\nThe pattern looks like this:\n\nSame input to the tool, same output. Every time. Cheap, fast, testable, and you can actually explain to an auditor what happened. Let's look at a few places where this is happening. Just how Uncle Bob intended it.\n\nBack to DoorDash. Their query understanding system needs web search to figure out what people are actually searching for (is \"450 north\" a restaurant or a brewery?). Originally they used the model provider's built-in search. One request goes in, one answer comes out, and everything in between is a black box.\n\nThey replaced that with their own search gateway that the model calls as a tool. The gateway handles caching, picks a search provider, falls back to another one if it times out, and logs what everything costs. The model just asks the question.\n\nThe results on their production workload: accuracy went from 93.4% to 93.9%, and the search cost went from $7.90 to $0.11 per thousand queries. With a warm cache, 99.4% of queries never even hit a search provider.\n\nBut my favorite finding in that post is a side note. With the built-in search turned on, Claude Sonnet 4 ignored an explicit \"answer only, no explanation\" instruction **78.1%** of the time, happily starting with \"Based on the search results…\". Great for a chat window, terrible when the next step in your pipeline expects `Yes` or `No`. Moving search into a tool with a structured response mostly fixed that. So a deterministic tool didn't just make it cheaper, it made the model behave better.\n\nCoding agents went through the same thing. Boris Cherny, who created Claude Code, said on the [Latent Space podcast](https://www.latent.space/) that an early version indexed codebases with embeddings, the classic RAG setup. Then they tried just letting the model use `grep` and read files, and it \"outperformed everything, by a lot\". The oldest search tool on your machine beat the blazingly fast modern vector database.\n\nText-to-SQL is the dream demo. Ask a question in plain English, the AI writes SQL, you get a number. The problem is that it gives you a *plausible* number. If it joins the wrong table or averages line items instead of orders, nothing actually breaks but you just get a wrong number that looks like a right one.\n\nA semantic layer turns this around. The business logic (what \"revenue\" means, how tables join, which edge cases to handle) is defined once in code. The model only picks the metric and the dimensions, and a compiler generates the SQL deterministically.\n\ndbt [benchmarked this](https://docs.getdbt.com/blog/semantic-layer-vs-text-to-sql-2026) earlier this year. On the same data, text-to-SQL scored 84–90% while the semantic layer scored 98–100%. Or as they put it, the semantic layer \"can't produce correct-looking numbers that are subtly different across runs.\"\n\nAtScale [ran something similar](https://www.atscale.com/blog/semantic-layer-text-to-sql-accuracy) with seven models and found something I think is even more interesting. Switching between models moved accuracy by at most 17.6 points. Adding the semantic layer improved *every* model by 20 to 31 points. Building the right tool for the job mattered more than \"who\" was doing the job.\n\nAnd Fivetran [found](https://www.fivetran.com/blog/what-a-dbt-project-is-worth-to-an-agent) that Haiku, a small and cheap model, working through a semantic layer matched the accuracy of Fable writing raw SQL. At 1/13th of the cost per answer. Again, hammer meets nail.\n\nThe classic way agents use tools is one call at a time. Call a tool, get the result back into the context, think, call the next tool, and so on. That means every intermediate result travels through the model, and you pay for it in tokens every single time.\n\nAnthropic wrote about [an alternative](https://www.anthropic.com/engineering/code-execution-with-mcp) in their original MCP announcement post: let the model write a small program that calls the tools, and run that program in a sandbox. The intermediate data stays in the sandbox, and only the final result goes back to the model. In their example, a workflow copying a meeting transcript from Google Drive into Salesforce went from 150,000 tokens to 2,000.\n\nCloudflare took the same idea with [Code Mode](https://blog.cloudflare.com/code-mode-mcp) and exposed their *entire* API, more than 2,500 endpoints, through two tools in about 1,000 tokens. Amazon [deployed it](https://aclanthology.org/2026.emnlp-industry.78.pdf) across 19 production agents and saw input tokens drop by 77%.\n\nThe model is still doing the smart part: understanding the task and writing the plan. The determinisitc part just still happens in normal code.\n\nThe logical end of this pattern is that some steps don't need a model at all.\n\nCommure built an [AI claim summary](https://eng.commure.com/blog/dont-use-a-sledgehammer-to-crack-a-nut-lessons-from-tuning-an-llm-feature-for-speed-cost-and-quality) where the model called a tool to fetch the claim before writing the summary. But *every* summary needed that claim. So the model wasn't making a decision or doing anything smart. It was just a fancy endpoint for a static resource. Fetching the data in code first, plus switching to a smaller model, made the feature roughly 3x faster and 23x cheaper: from about $38.8K a month to $1.65K. Their rule of thumb: \"Tool calling is valuable when the model has to decide what to look up. If the answer is always the same, do it in code.\"\n\nTetrate [puts it](https://tetrate.io/blog/not-everything-needs-llm) even more simply. Don't ask \"can the LLM do this?\", because the answer is almost always yes. Ask \"does the LLM's judgment change the outcome?\" If not, don't use it.\n\nA couple of years ago, getting an LLM to do *anything* felt like a win. Now these things run in production (at scale) and different questions start to matter:\n\nOf course this is not a silverbullet, unfortunately there is no such thing. When giving an LLM tools, their output can only be as good as the tool allows.\n\nDoorDash found that for questions about recent events, the model provider's built-in search still won across every model they tested. dbt's semantic layer scored a flat 0% on questions that needed more joins than it supported. The tool can only answer what you built it to answer. But at least it says \"I can't\" instead of guessing, so that's something.\n\nAlso worth saying: a lot of these benchmarks come from companies selling the tool being benchmarked. So as with any software benchmark, take it with a grain of salt.\n\nThe pattern across all of these is the same. The model's job is shrinking to the part only it can do: understand what a human wants, pick the right tool, and explain the result. Everything in between is moving to software that does the same thing every time.\n\nSo if you are building something with AI, a simple rule goes a long way:\n\nIf it can be computed, compute it. If it needs to be interpreted, use the model.", "url": "https://wpnews.pro/news/deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai", "canonical_source": "https://weidev.nl/blog/deterministic-tools-with-probabilistic-interfaces", "published_at": "2026-11-30 23:32:49+00:00", "updated_at": "2026-11-30 23:45:52.885766+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models"], "entities": ["DoorDash", "Claude Sonnet 4", "Boris Cherny", "Claude Code", "Latent Space", "dbt"], "also_reported_by": [], "takeaway": "Replacing a provider's built-in LLM search with a self-hosted tool gateway that caches, fails over between providers and returns structured responses cut DoorDash's search cost from $7.90 to $0.11 per thousand queries while accuracy rose from 93.4% to 93.9%, with 99.4% of warm-cache queries never hi", "recommendation": {"advice": "Move search out of the model into a deterministic tool gateway with caching, provider fallback and structured responses; DoorDash cut cost 98% and fixed Claude Sonnet 4's 78.1% instruction-ignoring rate.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai", "markdown": "https://wpnews.pro/news/deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai.md", "text": "https://wpnews.pro/news/deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai.txt", "jsonld": "https://wpnews.pro/news/deterministic-tools-with-probabilistic-interfaces-are-the-future-of-ai.jsonld"}}