PromptIntern: Saving Inference Costs by Internalizing Recurrent Prompt during Large Language Model Fine-tuning

Jiaru Zou, Mengyu Zhou, Tao Li, Shi Han, Dongmei Zhang
7/2/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: microsoft/PromptIntern (7 stars, MIT, last commit 2025-09-17).

Abstract

Recent advances in fine-tuning large language models (LLMs) have greatly enhanced their usage in domain-specific tasks. Despite the success, fine-tuning continues to rely on repeated and lengthy prompts, which escalate computational expenses, require more resources, and lead to slower inference. In this paper, we present a novel approach, PromptIntern, which internalizes prompt knowledge during model fine-tuning to achieve efficient inference and save costs. Instead of compressing the prompts for a vanilla model, PromptIntern aims to embed the recurrent prompt directly into the model parameters. We design a fine-tuning pipeline that includes instruction template compression, few-shot example absorption, and a progressive internalization strategy, effectively diminishing the need for intricate prompts during inference. Comprehensive experiments on challenging NL2Code tasks demonstrate that our method reduces input tokens by more than 90%, accelerates inference by 4.2 times, and reduces monetary inference costs by 88.3%.

View on arXivView PDF

Code Implementations(1)

MIT

Code and data of EMNLP'24 paper "PromptIntern: Saving Inference Costs by Internalizing Recurrent Prompt during Large Language Model Fine-tuning".

70PythonOct 2, 20241 years agoMIT

Cite this paper

@article{zou2024promptintern,
  title  = {PromptIntern: Saving Inference Costs by Internalizing Recurrent Prompt during Large Language Model Fine-tuning},
  author = {Jiaru Zou and Mengyu Zhou and Tao Li and Shi Han and Dongmei Zhang},
  year   = {2024},
  eprint = {2407.02211},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.02211v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.02211.svg)](https://codeofpaper.com/paper/2407.02211)

Discussion