
-
Deterministic tasks — the same input always produces the same output. There is a single correct answer and you can write exact rules to compute it:
- Calculate a tip
- Sort a list
- Convert a date format
- Check if an email contains an
@symbol
-
Non-deterministic tasks — the right answer depends on judgment, context, or interpretation:
- Summarize a legal document
- Decide if a customer email sounds angry or confused
- Write a professional reply to a complaint

Rule of thumb: Deterministic → code. Judgment/language → LLM.
Examples, side by side:
- Calculate shipping cost based on weight — code (deterministic).
- Summarize a product review — LLM (reading comprehension).
- Check if a password meets a minimum length — code:
- Decide if a review is positive or negative — LLM (requires interpretation).
- Convert Celsius to Fahrenheit — code (exact formula).
- Extract a name and job title from an email — LLM (names and formats vary).
- It’s slower. An API call takes hundreds of milliseconds; a line of code runs in microseconds — roughly a thousandfold difference.
- It costs money. Every call consumes tokens and billing.
- It can be wrong. LLMs are probabilistic token predictors and may make arithmetic or factual errors.
- It can be unpredictable. Even with temperature set to 0, outputs may vary across calls or model versions.

Avoid unnecessary LLM calls: they add latency, cost, and potential inconsistency. Encapsulate deterministic logic in reliable functions and reserve LLMs for tasks that require judgment, context, or natural language.
- The math — subtotal, tax, total — is deterministic and should be implemented in code.
- The friendly thank-you note at the bottom that varies in wording is a good fit for an LLM.
- Tools = code (deterministic, testable, fast).
- LLM = decides, composes, interprets (judgment, context, natural language).
