Choosing Between AI and Deterministic Logic in Product Features
Machine LearningModel answerLast updated
Decide when a feature should use a model versus plain code, covering fit criteria, anti-patterns, AI-native design, and cost/trust trade-offs.
You are working with a product team that is deciding whether new features should be powered by machine learning or built with ordinary deterministic code. Walk through how you would make that call.
In your answer, address:
- What characteristics make a problem a strong candidate for a learned model.
- Which categories of problems should generally stay deterministic.
- What distinguishes an "AI-native" product from a conventional product that simply bolts an AI feature on top.
- The practical trade-offs involved: accuracy, latency, cost, explainability, safety, and user trust.
Support your reasoning with concrete examples, and be explicit about how you would measure success before shipping.
Hints
Hint 1
Start from the cost of being wrong, not from which model you'd like to use — the tolerance for error usually decides the architecture.
Hint 2
Ask whether a domain expert could write the rules down completely and whether those rules change often; if yes, code beats a model.
Hint 3
Compare against the dumbest baseline you can think of (a dropdown, a lookup table, a form redesign) before proposing anything learned.
Hint 4
For AI-native design, ask what the product would look like if the model were assumed to do the first pass and the human supervised it.
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
What is really being tested
This is a judgment question. The interviewer is checking whether you treat ML as one option among several rather than the default, whether you can articulate concrete selection criteria, and whether you understand that adopting a model changes the product surface — evals, guardrails, feedback loops, support load — and not just the code.
The two failure modes to avoid are equally bad: reaching for a model where an error is unacceptable, and refusing to use one where it clearly wins.
A decision framework, applied in order
1. Can the rules be written down? If a domain expert can specify the logic completely and it changes rarely, write code. Computing a tax liability from published formulas, applying a withholding table, or converting currency at a quoted rate are all deterministic by nature — a model can only add noise. The same goes for input validation, date arithmetic, sorting, and permission checks.
2. Is the input unstructured or extremely variable? Free text, images, audio, and messy real-world strings are exactly where hand-written rules collapse. Parsing a photographed receipt, transcribing a call, or mapping the merchant string SQ *JOES CAFE #4 to a spending category is a losing battle for regex once you leave the curated examples.
3. What does an error cost, and can it be caught? If a wrong answer is cheap, visible to the user, and easily undone, a model is attractive. If it is expensive, silent, or irreversible — moving money, submitting a filing, deleting records — you need a deterministic path or a hard human checkpoint.
4. Is "mostly right" genuinely useful? A ranked list of suggested help articles at 85% relevance is a good product. Payroll at 85% accuracy is a liability. Separate the cases where approximation degrades gracefully from those where it doesn't.
5. Do you have data and a way to measure quality? Without labeled examples, an offline eval set, and a production feedback signal, you cannot ship responsibly — you'd be flying blind with no way to detect regressions.
6. Does it beat a trivial baseline? Compare against rules, lookup tables, and plain UX changes. If a dropdown or a better form eliminates the problem, ship that instead.
Problems that fit a learned model
- Perception and extraction: OCR on documents and receipts, invoice field parsing, speech-to-text.
- Language understanding and generation: answering "can I deduct a home office?" in plain language with citations, drafting reminder emails, summarizing a long support thread.
- Prediction from patterns: cash-flow forecasting, churn scoring, next-best-action ranking.
- Fuzzy classification: transaction categorization, intent routing, spam detection — the label space is real but the boundary is not writable.
- Personalization and ranking: which article, product, or next step to surface.
- Anomaly detection: fraud, duplicate invoices, unusual expenses, where patterns drift over time.
The common thread: rules are hard to author, inputs vary widely, approximate answers retain value, and feedback data exists to improve the system.
Problems that should stay deterministic
Exact computation with defined rules (tax math, payroll withholding, interest, ledger balancing); compliance and access decisions (who may see which data, whether a filing satisfies a legal requirement); simple stable logic; irreversible high-stakes actions without review; and low-data settings where quality can't be measured.
A useful formulation: the model proposes, deterministic systems dispose. A model extracts a W-2 box value or suggests a deduction; validation rules, a calculation engine, and explicit user confirmation decide what actually happens.
AI-added versus AI-native
An AI-added product is an existing workflow with a model attached. A "summarize" button, a chatbot sidebar in a forms app. Remove the model and the product is essentially unchanged.
An AI-native product is designed around the assumption that a model does first-pass work. Four differences matter:
| Dimension | AI-added | AI-native |
|---|---|---|
| Interaction | Forms and menus plus an optional chat box | Goal-driven: user states intent, system plans and acts, user reviews |
| Workflow | Human does the work, model assists | Model does the first pass, human supervises and corrects |
| Data loop | Logs rarely feed back | Every correction becomes training and eval signal |
| Architecture | A model call bolted onto a service | Evals, guardrails, routing, human-in-the-loop, and observability are first-class |
Concretely: AI-added tax prep means filling in the usual interview screens with a chatbot on the side. AI-native means uploading documents, having values extracted and the return pre-filled, seeing uncertain items flagged with confidence, and being asked only the targeted questions needed to resolve them. Note that the tax computation itself stays deterministic even in the AI-native version.
Trade-offs
Accuracy. Models fail probabilistically and sometimes confidently. Mitigate with confidence thresholds, abstention, human routing, and deterministic cross-checks (extracted wages must reconcile with withholding ranges). Measure precision and recall per segment, not just as one average.
Latency. Large-model calls run from hundreds of milliseconds to several seconds. Inline UX such as autocomplete needs small models, caching, or precomputation; nightly batch jobs can afford a bigger model. Stream and go async where the experience allows it.
Cost. Inference scales with usage in a way static code does not. Estimate upfront: 50M calls/month at $0.001 each is $50K/month. Use a tiered design — rules or lookup first, a cheap classifier next, an LLM only for the hard tail.
Explainability. In regulated domains, users and auditors need reasons. Prefer interpretable models or attach evidence: citations to the tax code, highlighted source fields, reason codes on credit decisions.
Safety and compliance. Prompt injection, PII leakage, hallucinated financial advice, and bias in credit or fraud models are the usual risks. Counter with guardrails, red-teaming, data minimization, and fairness audits.
User trust. Easy to lose, slow to rebuild. Show confidence, make outputs editable and reversible, label generated content, never take irreversible actions silently. Start with suggestions and graduate to automation only after measured reliability.
Before shipping
Define the metric set first: task-level quality (extraction F1, top-1 ranking accuracy, edit rate on generated text), a safety metric (unsafe output rate, false-approval rate), and an operational metric (p95 latency, cost per request). Hold out an eval set, run a shadow or A/B deployment, and define the rollback threshold in advance. If you cannot state how you'd know the feature got worse, you are not ready to ship it.