Post

New post! ✨ Prompt caching ✨ My first big project post for @ngrok.com. 5 weeks, 12217 lines of code, 195 commits. I poured a lot into this one, and learned a lot in the process. I really hope you enjoy it ❤️

ngrok@ngrok.com

Yesterday we launched ngrok.ai into early access. Today we're bringing you a deep dive into LLM internals with beautiful visuals crafted by our very own @samwho.dev. Discover exactly what gets cached to offer you 10x cheaper input tokens. ngrok.com/blog/prompt-...

20 reposts94 likes

The attention part was new to me. I’m trying to understand why and how they “project” now: how do they write a poem where the last word rhymes? They do and we know that, and my simplistic understanding is they somehow project forward. But how does that rhyme 🙌 with token by token?

I enjoyed the post, especially the interactive elements. Maybe an error or just a different preference, but it seems like the row labels in the attention weights matrix should all be shifted up one. For example it looks like ‘Mary’ has a 1.0 weight for ‘Mary’ rather than for ‘had’.

It’s not an error, it’s just that I very poorly explained it 😅 While the result of 100% is the contribution to the next token, the calculation is done by comparing the Q and K vectors of the token on itself. I didn’t really mention the term “self-attention” anywhere and that was a mistake.

You’re very welcome. It really helps me improve when people give this sort of feedback, I greatly appreciate it. 🙏

Awesome post, incredibly well done as always. 💯 I know I’m in the minority with an iPhone Mini but I noticed a little issue on the smaller screen. The text in this demo wraps, causing height changes that make the rest of the article below jump up and down a bit.

Thank you ❤️ I did notice this while making it. Sadly that was the last visual I made and it was done the day before publishing, and I made the pragmatic decision to accept the imperfection. The smallest screen size I tend to target is the iPhone SE, is the Mini smaller? I might use that instead.

According to Google (AI) they have the same logical widths of 375 px. But maybe there are other factors. Anyway it’s not a major issue at all, especially as it’s so close to the end.