跳过导航
Redis built a cache that cuts LLM costs by 90%!
0:00 / 0:29

Redis built a cache that cuts LLM costs by 90%!

Avi Chawla

@_avichawla7.9万 位关注者

在 X 上查看
1,209 个赞下载原帖

166,230 次观看

Redis built a cache that cuts LLM costs by 90%! Production LLM apps do not receive completely new questions every time. A customer-support assistant might receive all three of these: - "Can I get a refund after buying the monthly plan?" - "Is the monthly subscription refundable?" - "Can I cancel the plan and get my money back?" The wording is different, but the underlying question and its answer remain the same. Yet LLM apps process every version as a new request. They assemble the prompt, send it to the model, and generate an answer that may have already been generated. Prefix caching reduces part of these repeated calls. When requests begin with the same system prompt or context, the model can reuse the KV states already computed for that shared prefix. But the request still hits the LLM. The new tokens must be processed, and the complete answer must still be decoded. So even with a prefix-cache hit, there's another generation call involved. To solve this, instead of only caching computation inside the model, the application can cache the generated response outside it. When another question arrives, the system embeds it and compares it with previously answered questions. If it finds a sufficiently close match, it returns the stored response without invoking the LLM again. A cache hit removes the input tokens, output tokens, and decoding time associated with another LLM call. In practice, it is important to decide which questions can safely share an answer since a production setup needs well-tuned similarity thresholds, expiration policies, data isolation, and monitoring for incorrect matches. If you want to use this in practice, Redis already implements it as a managed service called Redis LangCache. Under the hood, it generates embeddings, searches previous responses, and returns a matching answer before another model call occurs. Redis also handles access scopes, custom filtering, TTL and eviction controls, and cache monitoring through Redis Cloud. I built an interface to compare it against direct LLM inference. The video below shows this in action, and I worked with Redis on this post to put this together. For the paraphrased question in my run, direct inference took 2.232 seconds and consumed 514 input tokens plus 250 output tokens. Redis returned the earlier response in 0.37 seconds with zero LLM input or output tokens. That was roughly 6x faster in this run. Redis reports API cost savings of up to 90% and cache-hit responses up to 15x faster. The actual result depends on how much safe repetition exists in the workload. You can try Redis LangCache here: If you want to dive deeper, I have already written a detailed breakdown of KV, prefix, prompt, and semantic caching in the article quoted below. This demo builds on the final technique and shows it running in practice. Read it below.

24 条评论

评论来自 X (Twitter) 上的原帖

  • Buswe 的头像

    @buswe_com

    Normalizing the question before embedding it (lowercase, strip order IDs and names) lifts the hit rate a lot on support traffic.

    5 个赞

  • Avi Chawla 的头像

    @_avichawla

    Yeah, makes sense since names and order IDs can push otherwise identical questions far in embedding space.

    1 个赞

  • Timothy Murphy 的头像

    @Timothy98537991

    I think customer services apps have been using this trick for a long time and it has worked very poorly. I hope that it's going to work better this time.

    2 个赞

  • Ishwar | Infrastructure Systems 的头像

    @Ishwarinfra

    Prefix caching still sends the request to the LLM, semantic caching can skip the LLM call entirely. The hard part is deciding when two different questions can safely share the same answer.

    1 个赞

  • Nick Woodhead | GPTree | Foremerge | TranslateTech 的头像

    @naw103

    This works when the answer is a function of the question alone. Inside a conversation it usually is not: the same sentence has a different correct answer depending on the three turns before it. The cache key has to include the state, not just the embedding of the question.

    1 个赞

  • Tech 的头像

    @moat_technology

    utm_source=influencer&utm_medium=paid-post&utm_campaign=2026-09-ai_in_production-influencer&utm_content=a-chawla-x Hey, please mark paid collabs clearly using the X sponsored post feature.

    1 个赞

  • Sai sharan 的头像

    @Saisharan0099

    The 90% depends on cache-hit quality: semantic similarity needs strict thresholds, or one customer's answer becomes another customer's confidently wrong answer.

  • DEV 的头像

    @aiceodev

    This cache approach could transform how we handle repetitive queries in LLMs.

  • Jordan Lee 的头像

    @SP3NC3R5395

    Redis cutting LLM costs by 90% with response caching is the kind of boring infra win that actually matters

  • Nikhil Lamba 的头像

    @NikhilLamba6

    It goes to what we usually do in systems. Redis - for frequently used stuff (RAM). postgres/sql- sits on the disks/SSDs LV Cache- sits inside the GPUs.

  • AI Mastery Guide 的头像

    @aiseomastery

    90% cost cut is huge

  • Daniel García 的头像

    @dgarc_IA

    How does this handle “Do X” vs “Don’t do X”? Vector similarity is not enough in most of the cases “I want to know how to get a refund” “I DONT want to know how to get a refund” might be the clearest example

  • vedant 的头像

    @vedantshah2001

    @grok summarise and briefly explain the different caches for llms

  • Gregor 的头像

    @bygregorr

    yeah and the part that bites you is policy changes. your refund terms update, semantic cache has no idea, keeps serving the stale answer until someone notices a support ticket contradiction.

  • Stephens Rafael 的头像

    @tanatan74948099

    The long-term impact of digital privacy will depend on governance, regulation, and responsible innovation in real-world applications.

  • Aleksandar Janca 的头像

    @datachad

    depends what % of those calls are actually narrow and constant, those are worth owning not just caching

  • T2x 的头像

    @T2XFactor

    In the early days of the internet, bandwidth was expensive, so caching became a very interesting solution. Players like McAfee, Cisco, CacheFlow, Bluecoat, and Symantec did a lot of business there. I think it looks like this business model of caching AI is going to be another big

  • Venkata Subrahmanyam 的头像

    @VenkataSub34

    Redis LangCache demonstrates an important distinction. Semantic caching can avoid the entire LLM call, not just reuse a prompt prefix. The real production challenge is deciding when two questions are safe to treat as equivalent. That’s where MonkDB can add value by combining vector similarity with tenant, role, policy version, data scope, freshness, and provenance checks. The result is not just a faster cache, but a governed response reuse layer that knows when to reuse an answer and when to call the model again. The 90% savings claim will depend on the workload and safe cache hit rate, but the architectural direction is absolutely compelling. #LLM #SemanticCaching #AIInfrastructure

  • Preyforge 的头像

    @preyforge

    i write complaints verbatim before fixing; near-duplicate support questions show whether a cache understands intent or just matches strings.

  • Smarter Flow Notes 的头像

    @Susaotong

    客服场景确实吃这套 很多问题就是换个问法 语义缓存命中率能上去 但退款退款政策这种一变就得整片失效 缓存失效策略才是真坑