Abstract
Prompt Baking is a novel technique that converts ephemeral natural language prompts into permanent Large Language Model (LLM) weight updates. By minimizing the KL divergence between a prompted model and its unprompted, "baked" counterpart, this method allows for the durable incorporation of instructions, personas, and new knowledge. This approach reduces context window usage and eliminates "persona drift" in long conversations, effectively transitioning from slow "System 2" prompting to fast "System 1" weight-based intuition.
Introduction
Large Language Models (LLMs) are typically adapted through two primary paradigms: prompting and fine-tuning. Prompting offers explicit, high-level control but is temporary, consumes valuable context window space, and suffers from "persona drift" over long sequences. Fine-tuning provides permanent behavioral changes but requires labor-intensive curated datasets and offers less direct control over what the model learns.
Prompt Baking bridges this gap by taking the explicit control of a prompt and "baking" it directly into the model's weights. This makes the behavior permanent, context-efficient, and more robust against decay.
Methodology
The core of Prompt Baking is a self-distillation process. Given an initial set of weights $\theta$ and a prompt $u$, the goal is to find new weights $\theta_u$ such that the unprompted model $P_{\theta_u}(\cdot)$ behaves like the prompted model $P_\theta(\cdot|u)$.
Optimization Objective
The researchers minimize the KL divergence between the prompted model's output distribution and the baked model's distribution: $$\theta_u = \text{argmin}_{\theta_u} D_{KL}(P_\theta(\cdot|u) || P_{\theta_u}(\cdot))$$
Optimization is performed using gradient descent on a Monte Carlo approximation of this loss. To ensure generalization, trajectories are sampled using diverse "intermediate sequences" (e.g., questions from the SQuAD dataset) as starting points. For efficiency, the process often utilizes Low-Rank Adaptation (LoRA), allowing a prompt to be baked in as little as five minutes.
Experimental Setup and Datasets
The methodology was evaluated across several dimensions:
- Academic Benchmarks: GSM8K, ASDiv, MBPP, ARC, and CommonsenseQA were used to measure zero-shot performance.
- Persona Stability: A benchmark was designed to measure how well a model maintains a specific persona (e.g., "depressing answers") over long dialogues.
- Knowledge Baking: A curated dataset of news events from August 2024 tested the model's ability to incorporate information post-training cutoff.
Key Results
- Performance Parity: Baked models achieved zero-shot accuracy within 1.4% of the original few-shot prompted models across academic benchmarks.
- Enhanced Reasoning: On GSM8K, a "baked + prompted" model reached 81.2% accuracy, exceeding the base Llama 3 performance (79.6%) using identical examples.
- Knowledge Retention: Baking news headlines enabled the model to answer questions about recent events with 77.5% accuracy, compared to just 5% for the base model.
- Persona Stability: Unlike standard prompted models that exhibit drift after a few turns, baked models maintained near-constant persona stability over 30+ turns of dialogue.
Discussion and Limitations
Prompt Baking offers unique advantages over traditional methods. "Half-baking" allows for continuous control over prompt strength by stopping the optimization process early. Furthermore, baking in weight space produces more semantic interpolations than logit-space blending.
However, limitations remain. "Half-baking" factual data can occasionally trigger hallucinations or recency bias. Future work will explore "Negative Prompting" to remove harmful biases and investigate how these techniques scale to multi-stage reasoning tasks.
Summary updated