Papers
Topics
Authors
Recent
Search
2000 character limit reached

Prompt Baking

Published 4 Sep 2024 in cs.CL and cs.AI | (2409.13697v1)

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 $u$ and initial weights $\theta$ to a new set of weights $\theta_u$ such that new "baked" LLM behaves like the original prompted LLM. Mathematically, we minimize the KL divergence between $P_\theta(\cdot | u)$ and $P_{\theta_u}(\cdot)$, where $P$ 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.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (37)
  1. Online continual learning with maximally interfered retrieval, 2019. URL https://arxiv.org/abs/1908.04742.
  2. Concrete problems in ai safety, 2016. URL https://arxiv.org/abs/1606.06565.
  3. Anthropic. Golden gate claude, 05 2024. URL https://www.anthropic.com/golden-gate-claude. Accessed on August 30, 2024.
  4. Gradient-free neural network training via synaptic-level reinforcement learning. arXiv preprint arXiv:2105.14383, 2021.
  5. What’s the magic word? a control theory of llm prompting, 2024. URL https://arxiv.org/abs/2310.04444.
  6. Language models are few-shot learners, 2020. URL https://arxiv.org/abs/2005.14165.
  7. How to tell deep neural networks what we know. CoRR, abs/2107.10295, 2021. URL https://arxiv.org/abs/2107.10295.
  8. The llama 3 herd of models, 2024. URL https://arxiv.org/abs/2407.21783.
  9. The Feynman Lectures on Physics, Vol. III: Quantum Mechanics. Addison-Wesley, Reading, Massachusetts, 1965. Chapter on Operators.
  10. Robert M. French. Catastrophic forgetting in connectionist networks. Trends in Cognitive Sciences, 3(4):128–135, 1999. ISSN 1364-6613. doi: https://doi.org/10.1016/S1364-6613(99)01294-2. URL https://www.sciencedirect.com/science/article/pii/S1364661399012942.
  11. Deep Learning. MIT Press, 2016. http://www.deeplearningbook.org.
  12. Large language models can self-improve, 2022. URL https://arxiv.org/abs/2210.11610.
  13. Llmlingua: Compressing prompts for accelerated inference of large language models, 2023. URL https://arxiv.org/abs/2310.05736.
  14. Daniel Kahneman. Thinking, fast and slow. Farrar, Straus and Giroux, 2011.
  15. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521–3526, March 2017. ISSN 1091-6490. doi: 10.1073/pnas.1611835114. URL http://dx.doi.org/10.1073/pnas.1611835114.
  16. Learning to solve the credit assignment problem. arXiv preprint arXiv:1906.00889, 2019.
  17. Scalable agent alignment via reward modeling: a research direction, 2018. URL https://arxiv.org/abs/1811.07871.
  18. Measuring and controlling instruction (in)stability in language model dialogs, 2024. URL https://arxiv.org/abs/2402.10962.
  19. An empirical study of catastrophic forgetting in large language models during continual fine-tuning, 2024. URL https://arxiv.org/abs/2308.08747.
  20. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of Learning and Motivation, 24:109–165, 1989. ISSN 0079-7421. doi: https://doi.org/10.1016/S0079-7421(08)60536-8. URL https://www.sciencedirect.com/science/article/pii/S0079742108605368.
  21. Bennet B Murdock Jr. The serial position effect of free recall. Journal of experimental psychology, 64(5):482, 1962.
  22. Quantum cognition. Annual review of psychology, 73(1):749–778, 2022.
  23. Engineering flexible machine learning systems by traversing functionally-invariant paths, 2023. URL https://arxiv.org/abs/2205.00334.
  24. Learning representations by back-propagating errors. nature, 323(6088):533–536, 1986.
  25. Progress & compress: A scalable framework for continual learning, 2018. URL https://arxiv.org/abs/1805.06370.
  26. Distilling reasoning capabilities into smaller language models, 2023. URL https://arxiv.org/abs/2212.00193.
  27. Reward is enough. Artificial Intelligence, 299:103535, 2021.
  28. Judgment under uncertainty: Heuristics and biases: Biases in judgments reveal some heuristics of thinking under uncertainty. science, 185(4157):1124–1131, 1974.
  29. A comprehensive survey of continual learning: Theory, method and application, 2024a. URL https://arxiv.org/abs/2302.00487.
  30. Large language model enhanced knowledge representation learning: A survey, 2024b. URL https://arxiv.org/abs/2407.00936.
  31. Self-consistency improves chain of thought reasoning in language models, 2023a. URL https://arxiv.org/abs/2203.11171.
  32. Self-instruct: Aligning language models with self-generated instructions, 2023b. URL https://arxiv.org/abs/2212.10560.
  33. Chain-of-thought prompting elicits reasoning in large language models, 2023.
  34. A survey on knowledge distillation of large language models, 2024. URL https://arxiv.org/abs/2402.13116.
  35. Continual learning through synaptic intelligence. In International Conference on Machine Learning, pages 3987–3995. PMLR, 2017.
  36. A comprehensive study of knowledge editing for large language models, 2024. URL https://arxiv.org/abs/2401.01286.
  37. Representation engineering: A top-down approach to ai transparency, 2023. URL https://arxiv.org/abs/2310.01405.

Summary

  • The paper demonstrates Prompt Baking, embedding prompt instructions into LLM weights to simulate prompted behavior.
  • It uses KL divergence minimization via gradient descent to bake prompts quickly (in as little as 5 minutes) while nearing few-shot accuracy.
  • The approach overcomes prompt decay and supports sequential knowledge integration, paving the way for continuous learning.

"Prompt Baking": An Authoritative Summary

The paper "Prompt Baking" discusses an innovative technique for integrating prompts into the weights of LLMs. This methodology, coined Prompt Baking, enables the retention of knowledge and instructions, typically conveyed through ephemeral prompts, in a more enduring and efficient manner via weight adjustment. This essay explores the mechanisms and implications of this approach as detailed in the paper.

Prompt Baking Methodology

Prompt Baking transforms a prompt u\mathbf{u} and initial LLM weights θ\theta into a new set of weights θu\theta_{\mathbf u}, such that the LLM's behavior with weights θu\theta_{\mathbf u} simulates the LLM's performance with weights θ\theta and the prompt u\mathbf{u}. The goal is to align the baked model's output distribution to that of the prompted model by minimizing the KL divergence between them. Practically, this process involves optimizing a loss function derived from this divergence through gradient descent, leveraging Monte Carlo sampling for efficient computation. Figure 1

Figure 1: An illustration of Prompt Baking.

Performance and Practical Results

Efficiency and Practicality

Prompt Baking is notably efficient, often requiring minimal time (as little as 5 minutes) for integrating prompts into weight updates. This rapid conversion is a significant advantage over traditional fine-tuning methods, which are resource-intensive and time-consuming.

Improved Performance on Benchmarks

The paper reports that baking chain-of-thought prompts significantly enhances zero-shot performance across various benchmarks, including GSM8K and CommonsenseQA. Baked models achieve performances within 1.4% accuracy of few-shot prompted models, highlighting the efficacy of Bakers in capturing complex reasoning processes through simple prompts. Figure 2

Figure 2: Baking instruction following prompts yields models that perform within 8% of original prompted accuracy.

Handling Prompt Decay

Another success of Prompt Baking is its ability to counteract "prompt decay"—a phenomenon where the continued influence of prompts diminishes over long sequences. Baking instructions and persona information directly into the model’s weights ensures consistent behavior without repeated prompting, thus mitigating decay over extended dialogues and interactions. Figure 3

Figure 3: Baking in persona and instruction prompts prevents prompt decay compared to prompted counterparts.

Knowledge Integration and Continuous Learning

Knowledge Baking

The paper demonstrates how Prompt Baking can be utilized to update an LLM's knowledge base through the baking of new information, such as current news headlines. This seamless integration without traditional retraining shows promise for keeping models up-to-date with evolving knowledge.

Sequential Knowledge Integration

Models can bake multiple, non-conflicting news items in sequence, effectively retaining information from all prompts. This sequential baking capability opens pathways for continuous learning, significantly mitigating issues of catastrophic forgetting that often plague LLMs in incremental learning scenarios.

Implications and Future Directions

Prompt Baking offers a robust framework for enhancing LLM adaptability through prompt integration. It provides a novel solution to persistent issues such as prompt stability, catastrophic forgetting, and knowledge updating. As LLMs continue to expand their role in various applications, the refinement of baking processes could lead to more versatile, responsive, and accurate AI systems.

The ability to reduce reliance on external data and prompt infrastructure for learning new behaviors not only enhances efficiency but aligns with cognitive models of learning where ephemeral instructions become automatic functions. Future research could explore deeper optimization techniques within Prompt Baking to further exploit its potential in real-time applications and AI agent adaptability.

Conclusion

The research presented in "Prompt Baking" details a formidable technique for embedding prompt behavior into LLM weights, considerably improving model efficiency and capability retention. This advancement holds significant promise for the future of AI-mediated learning and inference tasks, hinting at a new trajectory for LLM methodologies centered around prompt integration and dynamic learning patterns.

Paper to Video (Beta)

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 17 tweets with 233 likes about this paper.

HackerNews

  1. Prompt Baking (8 points, 1 comment)