Sounds kinda useless, TBH. This sounds as if it assumes the exact same context window across requests. If so, given the 5 minute window, unless for example your entire team is operating in the same codebase at the same time, you won't really see any savings beyond simple prompts. Are contexts included in the prompt cache? Are they identified as the same or not? What happens if we approach the 10k token range? 128k? 1…
I have a system prompt of around 100k which includes a couple of internal schema definitions. Having this cached could be super useful to us.
Prompt Caching
21–30 of 75 posts
Re: Prompt Caching
#22Why does prompt caching reduce costs? I'm assuming that the primary cost driver is GPU/TPU FLOPS, as opposed to any network / storage / etc costs. My understanding is that an LLM will take in the stream of text, tokenize it (can be faster with caching, sure, but it's a minor drop in the bucket), then run a transformer on the entire sequence. You can't just cache the output of a transformer on a prefix to reduce workl…
You actually can cache the "output" of a transformer on the prefix by caching what happens in the attention layer for that text string (specifically the "K" and "V" tensors). Since the attention layer is a big part of the compute cost of the transformer, this does cut down FLOPs dramatically.
Re: Prompt Caching
#23Sounds kinda useless, TBH. This sounds as if it assumes the exact same context window across requests. If so, given the 5 minute window, unless for example your entire team is operating in the same codebase at the same time, you won't really see any savings beyond simple prompts. Are contexts included in the prompt cache? Are they identified as the same or not? What happens if we approach the 10k token range? 128k? 1…
I'm primarily limited by how much context I need for my queries, and for the majority of the time, the context can often largely be the same across multiple queries over periods of 1-60 minutes. This is the case whether it's a codebase I'm working with or a PDF (or other form of text documentation).
Simple queries are where I expect there to be the least gain for this kind of thing.
Re: Prompt Caching
#24Far less "in the realm of", "in today's fast-moving...", multifaceted, delve or other pretentious wank.
There is still some though so they obviously used the same dataset that's overweight in academic papers. Still, I'm hopeful I can finally get it to write stuff that doesn't sound like AI garbage.
Kind of weird there's no moderation API though. Will they just cut me off if my customers try to write about things they don't like?
Re: Prompt Caching
#25Earlier quoted context omitted.
You actually can cache the "output" of a transformer on the prefix by caching what happens in the attention layer for that text string (specifically the "K" and "V" tensors). Since the attention layer is a big part of the compute cost of the transformer, this does cut down FLOPs dramatically.
Oh interesting, didn't know. How does this work past the first transformer in the stack?
This means that every attention layer can use previously calculated outputs for the same prompt prefix. So it only needs to calculate from scratch starting from the first unique token in the prompt sequence.
Re: Prompt Caching
#26Sounds kinda useless, TBH. This sounds as if it assumes the exact same context window across requests. If so, given the 5 minute window, unless for example your entire team is operating in the same codebase at the same time, you won't really see any savings beyond simple prompts. Are contexts included in the prompt cache? Are they identified as the same or not? What happens if we approach the 10k token range? 128k? 1…
Re: Prompt Caching
#27https://ai.google.dev/gemini-api/docs/caching?lang=python
Costs $1 / 1M / 1h
Re: Prompt Caching
#28I just tried Claude the other day. What a breath of fresh air after fighting the dogshit that is OpenAI. Far less "in the realm of", "in today's fast-moving...", multifaceted, delve or other pretentious wank. There is still some though so they obviously used the same dataset that's overweight in academic papers. Still, I'm hopeful I can finally get it to write stuff that doesn't sound like AI garbage. Kind of weird t…
Re: Prompt Caching
#29Re: Prompt Caching
#30Earlier quoted context omitted.
I’m building an app with OpenAI, using structured outputs. Does OpenAI also support prompt caching?
I'm sure internally they use it for the system prompt at least, probably since launch. And maybe for common initial user queries that exactly match.