Context Caching for Fine-tuned Gemini Models

You can use context caching for your fine-tuned Gemini models to improve performance and reduce costs for prompts that include large amounts of context. By caching frequently used context, you avoid re-sending large amounts of data with each request to your fine-tuned model.

The management operations (Read, Update, Delete) of the context cache for tuned Gemini models remain consistent with base models. Only cached content creation and inference require specific adjustment, which is detailed in the following sections.

Prerequisites

Fine-tuning a Gemini Model: You need a deployed fine-tuned Gemini model based on a supported base model (see Context caching overview). For details on how to fine-tune a Gemini model, see Fine-tune a Gemini model. To get the endpoint for your deployed tuned model, see Deploy a tuned model.

Make sure that you have the following information:

  • The ID and the version of the tuned Gemini model
  • The endpoint resource name for the deployed fine-tuned model

Supported versions

Fine-tuned Gemini models support implicit caching for the following versions:

Explicit caching is not supported for fine-tuned models.