Skip to content

Overview

TensorZero Recipes are a set of pre-built workflows for optimizing your LLM applications. You can also create your own recipes to customize the workflow to your needs.

The TensorZero Gateway collects structured inference data and the downstream feedback associated with it. This dataset sets the perfect foundation for building and optimizing LLM applications. As this dataset builds up, you can use these recipes to generate powerful variants for your functions. For example, you can use this dataset to curate data to fine-tune a custom LLM, or run an automated prompt engineering workflow.

In other words, TensorZero Recipes optimize TensorZero functions by generating new variants from historical inference and feedback data.

Recipes

Supervised Fine-tuning

A fine-tuning recipe curates a dataset from your historical inferences and fine-tunes an LLM on it. You can use the feedback associated with those inferences to select the right subset of data. A simple example is to use only inferences that led to good outcomes according to a metric you defined.

We present two sample fine-tuning recipes:

See complete examples using the recipes below.

Dynamic In-Context Learning

Dynamic In-Context Learning (DICL) is a technique that leverages historical examples to enhance LLM performance at inference time. It involves selecting relevant examples from a database of past interactions and including them in the prompt, allowing the model to learn from similar contexts on-the-fly. This approach can significantly improve the model’s ability to handle specific tasks or domains without the need for fine-tuning.

We provide a sample recipe for DICL with OpenAI. The recipe supports selecting examples based on boolean metrics, float metrics, and demonstrations.

Custom Recipes

You can also create your own recipes.

Put simply, a recipe takes inference and feedback data stored that the TensorZero Gateway stored in your ClickHouse database, and generates a new set of variants for your functions. You should should be able to use virtually any LLM engineering workflow with TensorZero, ranging from automated prompt engineering to advanced RLHF workflows. See an example of a custom recipe using DSPy below.

Examples

We are working on a series of complete runnable examples illustrating TensorZero’s data & learning flywheel.