Why we keep using LLMs for O(1) problems

Jamie16 Novice 10h ago 82 views 4 likes 2 min read

Deterministic logic and LLM calls are fundamentally different tools, yet I see too many teams treating them as interchangeable just to slap an "AI-powered" label on a landing page.

The "Shiny Object" Tax

We've all seen it: a dev needs to validate an email address, and instead of a regex, they implement a model call. Suddenly, you've got API latency, loading spinners, and a monthly bill for something that should take a microsecond. You've essentially traded a local CPU cycle for a round-trip to a data center.

Determinism vs. Probabilism

The core difference is simple: an if statement is deterministic. The same input always yields the same output. An LLM is probabilistic—it can give you a different answer based on the temperature setting or a model update.

  • If-statement: Zero cost, millisecond execution, 100% predictable.
  • LLM call: Per-token cost, seconds of latency, variable output.
Why we keep using LLMs for O(1) problems

When to actually use each

If you're building an AI workflow, you need to be ruthless about where the model actually adds value.

Stick to standard code (if/else, regex, lookups) when:

  • The rule is binary. (e.g., "Is the cart total over $50?")
  • You need absolute consistency. (e.g., Billing logic, permission checks).
  • Performance is critical and there's no ambiguity.

Deploy an LLM agent when:
  • The task requires nuance or judgment. (e.g., Summarizing a transcript).
  • The input is unpredictable free text. (e.g., "What is this customer actually upset about?").
  • Variability is a feature, not a bug. (e.g., Creative copywriting).

Real-world examples

Password strength: "8 characters and a symbol" is a rule. Don't use AI for this.
Urgency detection: Checking if a ticket contains the word "urgent" is a keyword search. Understanding that a customer is subtly furious based on their tone is a language problem. Use AI here.
Discount codes: Checking if a code is expired is a database lookup. Stop asking models to check your DB.
Meeting notes: Condensing 200 pages of rambling into three bullet points? That's exactly what LLMs are for.

Choosing the wrong tool doesn't just look like over-engineering; it kills your UX with unnecessary latency and burns your budget on tasks that a junior dev could solve with three lines of JavaScript.

AIAI ProgrammingAI Codingproductivitywebdev

All Replies (3)

C
Casey51 Novice 10h ago
Saw a dev use one for a date parser once. Simple regex would've been instant.
0 Reply
K
KaiDev Expert 10h ago
Does it actually cost more in latency than just writing a switch statement?
0 Reply
C
ChrisPunk Novice 10h ago
Had a team try this for basic math; the token cost was a joke for a calculator.
0 Reply

Write a Reply

Markdown supported