Skip to content

Update post: How a Transformer Really Works: Attention, the KV Cache, and Why Inference Eats Memory - #42

Merged
HumbleBee14 merged 1 commit into
mainfrom
post/how-transformers-work-with-attention-and-kv-cache-tdrdjg
Jul 22, 2026
Merged

Update post: How a Transformer Really Works: Attention, the KV Cache, and Why Inference Eats Memory#42
HumbleBee14 merged 1 commit into
mainfrom
post/how-transformers-work-with-attention-and-kv-cache-tdrdjg

Conversation

@ml-systems-publisher

Copy link
Copy Markdown
Contributor
╔════════════════════════════════════════════════════╗
║                                                    ║
║             𝗠 𝗟 𝗦 𝗬 𝗦 𝗧 𝗘 𝗠 𝗦 . 𝗗 𝗘 𝗩              ║
║                                                    ║
╚════════════════════════════════════════════════════╝

How a Transformer Really Works: Attention, the KV Cache, and Why Inference Eats Memory

A from-scratch tour of what's actually inside an LLM: how a transformer turns tokens into predictions, what Query, Key, and Value really mean, and how generating text one token at a time builds the KV cache — the growing pool of memory that makes inference so expensive.


Important

To confirm your identity, please comment below with your name.

Tip

Preview — a link to your post appears below once the Cloudflare check passes.


Questions or issues? Email admin@mlsystems.dev with this PR link.

@ml-systems-publisher ml-systems-publisher Bot added blog-submission Post submitted via the /write portal post-update labels Jul 22, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mlsystems with  Cloudflare Pages  Cloudflare Pages

Latest commit: b116d42
Status:⚡️  Build in progress...

View logs

@HumbleBee14
HumbleBee14 merged commit 79b777d into main Jul 22, 2026
3 of 4 checks passed
@HumbleBee14
HumbleBee14 deleted the post/how-transformers-work-with-attention-and-kv-cache-tdrdjg branch July 22, 2026 07:21
HumbleBee14 added a commit that referenced this pull request Aug 21, 2026
Ports personal-site's equivalent tool: npm run convert-post -- <path>
runs a hand-written or agent-written index.mdx through the same
convertMdx -> serializePost pipeline the editor uses, writes
.write-source.json next to it, and rewrites index.mdx to the editor's
canonical form if publishing from /write would have changed it.
Refuses to write anything if the editor's own output isn't stable
under a second conversion pass.

Audited for the personal-site equivalent's destination-field gap (a
field buildFrontmatter branches its entire frontmatter shape on, that
convertMdx deliberately leaves for the caller to supply) — mlsystems
has no such field; every PostMeta field, including date, is set
directly by convertMdx on a normal parse, so no analogous fix needed
here.

Validated against the real how-transformers-work-with-attention-and-kv-cache
PR (#42) round trip, including its mermaid diagram: the script's SVG
output for that diagram matched the pre-publish state byte-for-byte,
since serializeMermaid only ever passes through whatever SVG is
already baked into the block rather than re-rendering it — a browser
session touching the diagram live is the only thing that changes its
baked pixel measurements, not this script.

Documents the same in docs/authoring/mdx-format.md's new "Checking it
before you publish" section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blog-submission Post submitted via the /write portal post-update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant