English

Prompt Baking

Computation and Language 2024-09-24 v1 Artificial Intelligence

Abstract

Two primary ways to change LLM behavior are prompting and weight updates (e.g., fine-tuning). Prompting LLMs is simple and effective, specifying the desired changes explicitly in natural language, whereas weight updates provide more expressive and permanent behavior changes, specified implicitly via training on large datasets. We present a technique for "baking" prompts into the weights of an LLM. Prompt Baking converts a prompt uu and initial weights θ\theta to a new set of weights θu\theta_u such that new "baked" LLM behaves like the original prompted LLM. Mathematically, we minimize the KL divergence between Pθ(u)P_\theta(\cdot | u) and Pθu()P_{\theta_u}(\cdot), where PP is the LLM's probability distribution over token sequences. Across all our experiments, we find prompts can be readily baked into weight updates. Baking chain-of-thought prompts improves zero-shot performance on GSM8K, ASDiv, MBPP, ARC-Easy, ARC-Challenge, and CommonsenseQA benchmarks. Baking news headlines directly updates an LLM's knowledge. And baking instructions & personas alleviates "prompt forgetting" over long sequences. Furthermore, stopping baking early creates "half-baked" models, continuously scaling prompt strength. Baked models retain their sensitivity to further prompting and baking, including re-prompting with the baked-in prompt. Surprisingly, the re-prompted models yield further performance gains in instruction following, as well as math reasoning and coding benchmarks. Taking re-prompting and re-baking to the limit yields a form of iterative self-improvement we call Prompt Pursuit, and preliminary results on instruction following exhibit dramatic performance gains. Finally, we discuss implications for AI safety, continuous model updating, enhancing real-time learning capabilities in LLM-based agents, and generating more stable AI personas.

Keywords

Cite

@article{arxiv.2409.13697,
  title  = {Prompt Baking},
  author = {Aman Bhargava and Cameron Witkowski and Alexander Detkov and Matt Thomson},
  journal= {arXiv preprint arXiv:2409.13697},
  year   = {2024}
}

Comments

25 pages, 8 figures

R2 v1 2026-06-28T18:51:42.209Z