Live data from Hacker News

Prompt caching for cheaper LLM tokens

ngrok.com

51–60 of 76 posts

Re: Prompt caching for cheaper LLM tokens

#51
post #30

Earlier quoted context omitted.

I was wondering about this when I was reading around the topic. I can’t personally think of a reason you would need to segregate, though it wouldn’t surprise me if they do for some sort of compliance reasons. I’m not sure though, would love to hear something first-party.

I wonder if there is valuable information that can be learned by studying a companies prompts? There may be reasons why some companies want their prompts private.

[deleted]

Re: Prompt caching for cheaper LLM tokens

#52
post #30

Earlier quoted context omitted.

I was wondering about this when I was reading around the topic. I can’t personally think of a reason you would need to segregate, though it wouldn’t surprise me if they do for some sort of compliance reasons. I’m not sure though, would love to hear something first-party.

They absolutely are segregated With OpenAI at least you can specify the cache key and they even have this in the docs: Use the prompt_cache_key parameter consistently across requests that share common prefixes. Select a granularity that keeps each unique prefix-prompt_cache_key combination below 15 requests per minute to avoid cache overflow.

Does anyone actually compute / use this key feature? Or do you rely on implicit caching? I wish HN had a comment with a poll feature.

Re: Prompt caching for cheaper LLM tokens

#53
post #50

Earlier quoted context omitted.

For ChatGPT: > Prompt caches are not shared between organizations. Only members of the same organization can access caches of identical prompts. https://platform.openai.com/docs/guides/prompt-caching#frequ...

I don't find it really viable. There are so many ways to express the same question, and context does matter: the same prompt becomes irrelevant if the previous prompts or LLM responses differ. With the cache limited to the same organization, the chances of it actually being reused would be extremely low.

Think of it as a very useful prefix match. If all of your threads start with the same system prompt, you will reap benefits from prompt caching.

Re: Prompt caching for cheaper LLM tokens

#54
post #50

Earlier quoted context omitted.

For ChatGPT: > Prompt caches are not shared between organizations. Only members of the same organization can access caches of identical prompts. https://platform.openai.com/docs/guides/prompt-caching#frequ...

I don't find it really viable. There are so many ways to express the same question, and context does matter: the same prompt becomes irrelevant if the previous prompts or LLM responses differ. With the cache limited to the same organization, the chances of it actually being reused would be extremely low.

It gets used massively in a conversation, also anything that has a lot of explain actions in the system prompt means you have a large matching prefix.

Re: Prompt caching for cheaper LLM tokens

#57
post #30

Earlier quoted context omitted.

I was wondering about this when I was reading around the topic. I can’t personally think of a reason you would need to segregate, though it wouldn’t surprise me if they do for some sort of compliance reasons. I’m not sure though, would love to hear something first-party.

I wonder if there is valuable information that can be learned by studying a companies prompts? There may be reasons why some companies want their prompts private.

I realize cache segregation is mainly about security/compliance and tenant isolation, not protecting secret prompts. Still, if someone obtained access to a company’s prompt templates/system prompts, analyzing them could reveal:

- Product logic / decision rules, such as: when to refund, how to triage tickets

- Internal taxonomies, schemas, or tool interfaces

- Safety and policy guardrails (which adversaries could try to route around)

- Brand voice, strategy, or proprietary workflows

That is just off the top of my head.

Re: Prompt caching for cheaper LLM tokens

#58
post #56

What a fantastic article! How did you create the animations?

Sam has a long history of building beautiful visual explanations like this - I didn't realize he works for ngrok now, here's his previous independent collection: https://samwho.dev/

Simon, you’re too kind. Thank you. <3

Re: Prompt caching for cheaper LLM tokens

#59

What a fantastic article! How did you create the animations?

Thank you! These are all built with React and CSS animations (or the Web Animations API where I needed it). I’m not very good at React so the code is a real mess. 2 of the components also use threejs for the 3D bits.

For the stuff on my personal site, which simonw graciously linked to in another reply, you can see all the code behind my work at https://github.com/samwho/visualisations

Re: Prompt caching for cheaper LLM tokens

#60
post #33
post #30

Earlier quoted context omitted.

I was wondering about this when I was reading around the topic. I can’t personally think of a reason you would need to segregate, though it wouldn’t surprise me if they do for some sort of compliance reasons. I’m not sure though, would love to hear something first-party.

The only thing that comes to mind is some kind of timing attack. Send loads of requests specific to a company you’re trying to spy on and if it comes back cached you know someone has sent that prompt recently. Expensive attack, though, with a large search space.

No, the search space is tiny: you can just attack 1 BPE at a time! Stuff like password guessing is almost trivial when you get to do a timing attack on each successive character. So that lets you quickly exfiltrate arbitrary numbers of prompts, especially if you have any idea what you are looking for. (Note that a lot of prompts are already public information, or you can already exfiltrate prompts quite easily from services and start attacking from there...)
Post reply on HN