---
title: "Discussion on \"Building an LLM Inference Engine with AI: The Code Was the Easy Part\" | Hashnode"
description: "Discussion on \"Building an LLM Inference Engine with AI: The Code Was the Easy Part\". What continuous batching, KV-cache ownership, speculative decoding, and performance regressions taught me about AI-assisted systems engineering."
url: "https://hashnode.com/posts/building-an-llm-inference-engine-with-ai-the-code-was-the-easy-part/6abe72a3fc62b6676761bd5b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building an LLM Inference Engine with AI: The Code Was the Easy Part](https://pujun-ml-sys-blogs.hashnode.dev/building-an-llm-inference-engine-with-ai-the-code-was-the-easy-part?utm_source=hashnode&utm_medium=feed)

What continuous batching, KV-cache ownership, speculative decoding, and performance regressions taught me about AI-assisted systems engineering.

Oct 1 · 19 min read · pujun-ml-sys-blogs.hashnode.dev  
Updated Oct 8  
Read the article

-   [#llm](https://hashnode.com/tag/llm)
-   [#ai](https://hashnode.com/tag/ai)
-   [#software-engineering](https://hashnode.com/tag/software-engineering)
-   [#rust](https://hashnode.com/tag/rust)
-   [#software-architecture](https://hashnode.com/tag/software-architecture)

## Written by

[Pujun Lun](https://hashnode.com/@lunpujun)

@lunpujun

  
[View profile](https://hashnode.com/@lunpujun)

## Responses 1

Markdown supported · ⌘↵ to post

[Damiano Bianda](https://hashnode.com/@damianobianda)

[Oct 27](https://hashnode.com/posts/building-an-llm-inference-engine-with-ai-the-code-was-the-easy-part/6abe72a3fc62b6676761bd5b/comment/6ae0af3b185b9b139c1d6329)

Reading this the day after Cloudflare published their GLM-5.3 postmortem makes the title land even harder. The part that was "easy" — generating tokens — worked fine from day one. What leaked 155 responses across tenants was everything around it: a KV pool sized from leftover GPU memory (681K tokens) while the advertised context was 1M, and a rejection path that swapped the over-length prompt for a one-token placeholder instead of actually stopping the request, so the decode node generated from stale cache pages that still held other users' sessions. The two lessons they list map directly onto your point about understanding the system: they validated HTTP status codes at long contexts but never the output's coherence, and nothing forced the pool size and the context length to agree — now they check it from the running engine before every deploy. The code really was the easy part.
