explaingit

reezanahamed/meaningcache

Analysis updated 2026-05-18

0PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A single-file, CPU-only semantic cache that lets rephrased prompts hit a cached answer instead of calling an LLM again, with a documented false-match rate.

Mindmap

mindmap
  root((meaningcache))
    What it does
      Semantic LLM cache
      No GPU needed
      Single file
    Tech stack
      Python
      model2vec embeddings
      CPU only
    Use cases
      Cost optimization
      Rephrased prompt matching
      Threshold tuning
    Audience
      Developers
      LLM app builders
      Cost conscious teams

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Reduce LLM API costs by serving cached answers for rephrased versions of the same question.

USE CASE 2

Add semantic caching to an app without installing torch, a GPU, or a separate server.

USE CASE 3

Tune a similarity threshold to balance cache hit rate against wrong-answer risk.

USE CASE 4

Benchmark cache accuracy against a real dataset of paraphrased question pairs.

What is it built with?

Pythonmodel2vec

How does it compare?

reezanahamed/meaningcache0xallam/my-recipe0xhassaan/nn-from-scratch
Stars00
LanguagePythonPythonPython
Last pushed2022-11-22
MaintenanceDormant
Setup difficultyeasymoderatemoderate
Complexity2/52/54/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
MIT license: free to use, copy, modify, and distribute, as long as you keep the original copyright notice.

In plain English

meaningcache is a semantic cache for calls to a large language model that runs with no torch, no separate server, no API key, and no GPU. It is a single readable Python file that uses small static embeddings to compare the meaning of a new prompt against previously stored prompts, so a rephrased question like can I get a refund can be matched to a stored answer for what is the policy on refunds instead of triggering another expensive model call. The README is upfront about the tradeoff involved. Tested on 5,000 real question pairs from a public dataset, the tool serves about 70 percent of reworded questions from cache at its default similarity threshold, but it also wrongly matches about 28 percent of genuinely unrelated questions at that same setting. The threshold is the one adjustable setting, and raising it catches fewer rephrasings while lowering the rate of wrong matches, so the project frames itself as a cost optimizer rather than a correctness guarantee. Using it means creating a SemanticCache object with a chosen threshold, checking it for a match before calling your model, and storing the result afterward, or wrapping a function so this happens automatically. Internally, each prompt is turned into a vector using a small CPU only model called model2vec, about 60 megabytes in size, and a lookup compares that vector to all stored prompts by similarity, which the README says takes about 0.1 milliseconds and can process tens of thousands of prompts per second on a laptop CPU. The README lists clear limitations: it can return a wrong cached answer when two prompts are close in meaning but actually need different answers, it works best on prompts whose correct answer does not depend on time or personal context, and its lookup speed is linear in the number of stored prompts, so very large caches would need a proper vector index instead. It has only been tuned and tested on English prompts. Installation is a simple git clone followed by running a demo script with the uv tool. The project is released under the MIT license.

Copy-paste prompts

Prompt 1
Show me how to wrap my LLM call function with meaningcache's cache.wrap decorator.
Prompt 2
Explain the tradeoff between cache hit rate and false match rate in meaningcache's threshold table.
Prompt 3
Help me run meaningcache's benchmark.py on my own set of prompt pairs.
Prompt 4
Walk me through saving and loading a meaningcache SemanticCache to disk.

Frequently asked questions

What is meaningcache?

A single-file, CPU-only semantic cache that lets rephrased prompts hit a cached answer instead of calling an LLM again, with a documented false-match rate.

What language is meaningcache written in?

Mainly Python. The stack also includes Python, model2vec.

What license does meaningcache use?

MIT license: free to use, copy, modify, and distribute, as long as you keep the original copyright notice.

How hard is meaningcache to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is meaningcache for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.