Why Your LLM Gives Different Answers — and How to Control It
Last Updated on November 2, 2026 by Editorial Team
Author(s): Jayesh Pattamatta
Originally published on Towards AI.
Understand the settings behind inconsistent answers — and build a prompt you can actually test.
This is Part 1 of The Engineering Behind Better Prompts Series.

After the lead, the article explains that LLM answers are generated token-by-token, with the prompt providing context for predictions while decoding settings control how the model samples among token probabilities. It breaks down how temperature changes the concentration of choices, and how top-k and top-p filtering restrict the candidate pool—both affecting variation but not guaranteeing factual correctness. The piece then argues that you should first make the task well-specified (e.g., defining labels and requiring evidence in structured output like JSON), use targeted few-shot examples only when boundaries are confusing, and avoid “perfect-looking” prompts by running small evaluations on a reviewed dataset. Finally, it provides a practical checklist—identify what you’re specifying, how you’re selecting continuations, and how you’ll measure success—emphasizing measurable improvement over clever phrasing.
Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.
Published via Towards AI
Towards AI Academy
We Build Enterprise-Grade AI. We'll Teach You to Master It Too.
15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.
Start free — no commitment:
→ AI Engineering For Production — our new book, coming before the end of 2026. Join the waitlist.
→ Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.
→ Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate, and apply AI for complex work tasks.
Note: Article content contains the views of the contributing authors and not Towards AI.