This repository explores CAG and its integration with Granite language models, demonstrating how Granite’s extended context windows and processing power enhance efficiency by directly utilizing precomputed information.
13
stars
9
commits
Python
primary language
Sep 18, 2025
updated
This repository explores Cache Augmented Generation (CAG) and its usage with Granite language models, demonstrating how Granite’s extended context windows and processing power enhance efficiency by directly utilizing precomputed information.
Unlike Retrieval-Augmented Generation (RAG), which dynamically fetches relevant chunks of information in real-time followed by response generation, CAG prepares and stores all necessary information in advance.

Clone the Repository:
git clone https://github.com/IBM/Cache-Augmented-Generation-Granite.git
cd Cache-Augmented-Generation-Granite
Install Dependencies:
By default, the dependencies are managed with uv Python package and project manager. Install it, if not already.
uv sync
Activate Virtual Environment:
source .venv/bin/activate
Configure Environment Variables:
cp .env.sample .env
.env with your Hugging Face token:
HF_TOKEN=<your_hf_token>
Run the Script:
python cag_script.py
8 commits
1 commits
Python
100.0%
This repository explores CAG and its integration with Granite language models, demonstrating how Granite’s extended context windows and processing power enhance efficiency by directly utilizing precomputed information.
13
stars
9
commits
Python
primary language
Sep 18, 2025
updated
This repository explores Cache Augmented Generation (CAG) and its usage with Granite language models, demonstrating how Granite’s extended context windows and processing power enhance efficiency by directly utilizing precomputed information.
Unlike Retrieval-Augmented Generation (RAG), which dynamically fetches relevant chunks of information in real-time followed by response generation, CAG prepares and stores all necessary information in advance.

Clone the Repository:
git clone https://github.com/IBM/Cache-Augmented-Generation-Granite.git
cd Cache-Augmented-Generation-Granite
Install Dependencies:
By default, the dependencies are managed with uv Python package and project manager. Install it, if not already.
uv sync
Activate Virtual Environment:
source .venv/bin/activate
Configure Environment Variables:
cp .env.sample .env
.env with your Hugging Face token:
HF_TOKEN=<your_hf_token>
Run the Script:
python cag_script.py
8 commits
1 commits
Python
100.0%