Waitlist open Our new book, AI Engineering For Production, is coming before the end of 2026. Get the release date first.New book: AI Engineering For Production, coming before the end of 2026. Join the waitlist
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: pub@towardsai.net
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab VeloxTrend Ultrarix Capital Partners Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

What Actually Happens After You Hit Enter on an LLM Prompt
Latest   Machine Learning

What Actually Happens After You Hit Enter on an LLM Prompt

Last Updated on October 29, 2026 by Editorial Team

Author(s): Veera RS

Originally published on Towards AI.

Tokenization, routing, continuous batching, the KV cache, and why prefill and decode hit completely different hardware limits

Training a frontier model can cost hundreds of millions of dollars and take months. But once that model is produced, it’s just a huge set of numbers sitting idly in memory. A model can’t do anything on its own. So what happens behind the scenes to bring that model to life?

What Actually Happens After You Hit Enter on an LLM Prompt

From prompt to response (Source: AI-Generated Image)

After the lead, the article explains how inference differs from training, why serving (inference) is repeated and often more expensive, and what inference engines do—scheduling requests, managing GPU resources, and deciding how to process work together. It walks through the end-to-end path of a user request: authentication and routing in the data center, prompt assembly (including system instructions, history, retrieved context, and tool definitions), tokenization, and batching strategies like continuous batching to keep GPUs efficient while balancing throughput vs. latency. It then details the two core inference phases—prefill (reading the full prompt and building the KV cache, typically compute-bound) and decode (generating tokens one at a time while repeatedly using the KV cache, typically memory-bandwidth-bound)—and how latency is measured via TTFT and inter-token latency (ITL). The piece concludes by framing the whole system as the machinery that turns static model weights into usable real-time responses.

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.