---
title: "Prompt compression — 프롬프트 압축"
source: "https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95"
wiki: "systems-analysis.info/int"
article: "Prompt_compression_—_프롬프트_압축"
language: "ko"
categories:
  - "Category:Korean"
  - "Category:Large language models"
  - "Category:Machine learning"
  - "Category:Prompt engineering"
revision_id: 6009
wiki_created_at: 2026-09-06T23:57:06Z
wiki_modified_at: 2026-09-06T23:57:06Z
downloaded_at: 2026-09-07T23:11:31Z
---

# Prompt compression — 프롬프트 압축

**프롬프트 압축** (영어: *prompt compression*) — 핵심 정보를 유지하면서 대형 언어 모델(LLM)에 입력되는 텍스트(프롬프트)의 길이를 줄이기 위한 프롬프트 엔지니어링 방법들의 총칭이다<sup>[\[1\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-jha2024-1)</sup>. LLM의 컨텍스트 창이 수백만 토큰(예: Google Gemini)까지 확장됨에 따라 매우 긴 텍스트를 처리할 수 있게 되었지만, 이로 인해 새로운 문제들이 발생했다: 높은 호출 비용, 지연 시간 증가, 그리고 「중간에서 길을 잃는」 효과로 인한 추론 품질 저하가 그것이다<sup>[\[2\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-survey2024-2)</sup>.

프롬프트 압축은 축약된 입력에 가장 중요한 데이터를 집중시키고 중복되는 내용을 제거함으로써 이러한 문제를 해결한다. 이를 통해 컨텍스트 한도 초과 위험을 줄이고, 생성 속도를 높이며, 비용을 절감하면서도 응답의 정확도를 유지한다<sup>[\[3\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-datacamp-guide-3)</sup>.

## 프롬프트 압축 방법

프롬프트 압축 방법은 몇 가지 주요 범주로 나눌 수 있다.

### 토큰 제거 (필터링)

이 접근법은 나머지 부분을 변경하지 않고 원본 텍스트에서 가장 정보량이 낮은 토큰, 구문 또는 문장을 제거하는 것이다. 토큰의 중요도는 휴리스틱 방식으로 결정된다.

- **LLMLingua**: Microsoft가 개발한 방법으로, 각 토큰의 퍼플렉서티를 계산하여 텍스트 예측 가능성에 거의 영향을 미치지 않는 토큰을 제거한다. **LongLLMLingua** 버전에서는 사용자의 특정 쿼리에 대한 단락의 관련성을 고려하여 긴 문서에 맞게 이 접근법을 적용한다<sup>[\[4\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-jiang2023_llmlingua-4)</sup>.
- **Selective-Context**: 소규모 언어 모델을 사용하여 각 토큰의 *self-information*을 평가하고, 정보량이 가장 낮은 토큰을 제거한다<sup>[\[5\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-li2023_selective-5)</sup>.
- **PCRL** (Prompt Compression via Reinforcement Learning): Reinforcement Learning을 통해 에이전트를 학습시켜 최종 응답의 품질 지표(예: ROUGE)를 최대화하는 것을 목표로 각 토큰에 대해 「유지」 또는 「제거」 결정을 내리도록 한다<sup>[\[6\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-jung2023_pcrl-6)</sup>.

### 추상적 압축 (요약)

이 접근법에서는 압축기 역할을 하는 모델(일반적으로 더 소규모)이 원본 텍스트의 간결한 추상적 요약을 생성하고, 이를 메인 LLM에 전달한다.

- **RECOMP** (Retrieval-Compression-Prompting): 지식 베이스의 각 문서에 대해 사용자의 가능한 쿼리를 고려한 간결한 요약(*query-aware summary*)을 미리 생성한다. 이를 통해 정보를 압축할 뿐만 아니라 사전 처리할 수 있다<sup>[\[7\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-xu2024_recomp-7)</sup>.
- **PRCA** (Prompt Compression with Reinforced Context Aggregation): 요약 모델 학습과 Reinforcement Learning을 결합하여 메인 LLM의 응답 품질을 최대한 향상시키는 요약을 생성한다<sup>[\[8\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-yang2023_prca-8)</sup>.
- **Prompt-SAW** (Semantic Aware Winnowing): 요약 전에 텍스트에서 지식 그래프(개체 및 관계)를 추출하고, 관련 그래프 노드를 선택한 후 이를 기반으로 압축된 텍스트를 생성한다<sup>[\[9\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-ali2024_promptsaw-9)</sup>.

### 추출적 압축

이 방법은 원본 텍스트에서 핵심 단락이나 문장을 재구성 없이 그대로 추출한다.

- **Reranker-LLMs**: 리랭커(*reranker*) 모델을 사용하여 현재 쿼리에 대한 각 단락 또는 문서의 중요도를 평가하고, 가장 관련성 높은 것만 선택한다<sup>[\[10\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-pradeep2023_reranker-10)</sup>.
- **CompAct**: 반복적인 추출-요약 방식을 보여준다. 모델은 긴 텍스트의 세그먼트를 순차적으로 가져와 압축하고, 응답에 충분한 정보가 있는지 확인한다. 충분하지 않으면 다음 세그먼트를 추가하여 다시 압축하며, 품질을 유지하면서 상당한 압축률을 달성한다<sup>[\[11\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-yoon2024_compact-11)</sup>.

### 증류 및 「메모리 토큰」

텍스트 대신 모델이 압축된 정보를 담은 특별히 학습된 대체 토큰이나 embedding을 받는 새로운 방법 범주이다.

- **Gist Tokens**: LLM이 긴 지시문을 소수의 특수 *gist 토큰*(예: 수천 개 대신 20~30개 토큰)으로 「축소」하도록 fine-tuning된다. 이 토큰들은 이후 원본 프롬프트 대신 사용되며, 품질 손실을 최소화하면서 최대 26배의 압축을 달성한다<sup>[\[12\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-mu2023_gist-12)</sup>.
- **Soft Prompt Tuning**: 텍스트 프롬프트 대신 특정 작업을 해결하도록 조정된 학습 가능한 「가상 토큰」(embedding)을 사용한다.
- **SelfCP**: 동결된 LLM 자체를 압축기로 사용하는 방법을 제안한다. 특수 마커와 함께 텍스트 세그먼트를 모델에 제공하면, 모델이 조밀한 표현(*memory tokens*)을 생성하고 이를 응답 생성에 다시 사용한다<sup>[\[13\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-gao2024_selfcp-13)</sup>.

## 효율성과 트레이드오프

- **속도 향상 및 비용 절감**: 트랜스포머의 복잡도가 시퀀스 길이에 대해 이차적으로(\$O(n^2)\$) 증가하기 때문에, 프롬프트를 몇 배 줄이면 상당한 절감 효과를 얻을 수 있다. 예를 들어, *gist tokens*은 26배 압축 시 최대 40%의 FLOPs 절감을 보여준다<sup>[\[12\]](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_note-mu2023_gist-12)</sup>.
- **품질 향상**: 원본 텍스트에 노이즈나 주의를 분산시키는 세부 사항이 포함된 경우, 프롬프트 압축이 오히려 응답 품질을 향상시킬 수 있다. 관련 없는 컨텍스트를 제거하면 모델이 작업의 중요한 측면에 더 잘 집중할 수 있다.
- **품질(faithfulness) 트레이드오프**: 지나치게 공격적인 압축은 중요한 세부 정보(날짜, 이름, 부정 표현)의 손실을 초래하여 응답 품질을 저하시킬 수 있다. 추상적 방법은 특히 환각(hallucination) 위험에 취약하다. 압축된 프롬프트의 완전성과 정확성(*faithfulness*) 제어가 핵심 과제이다.

## 다른 분야와의 연관성

- **Retrieval-Augmented Generation (RAG)**: RAG와 프롬프트 압축은 밀접하게 연관되어 있다. RAG는 외부 압축 단계로 볼 수 있다: 전체 데이터베이스를 처리하는 대신 관련 문서를 검색하고 선택한다. 프롬프트 압축은 LLM에 전달하기 전에 이미 선택된 문서의 양을 줄임으로써 RAG를 보완한다.
- **In-Context Learning**: 컨텍스트 내 예시(데모)는 프롬프트 길이를 크게 증가시킨다. 이러한 데모를 압축하는 것(예: 여러 예시를 하나의 짧은 지시문으로 대체하는 *Instruction Distillation*)은 활발한 연구 분야이다.

## 참고 문헌

- Ali, M. et al. (2024). *Prompt-SAW: Semantic-Aware Winnowing for Prompt Compression*. arXiv:2403.00000.
- Gao, J.; Cao, Z.; Li, W. (2024). *SelfCP: Compressing Over-Limit Prompt via the Frozen Large Language Model Itself*. arXiv:2405.17052.
- Jiang, H. et al. (2023). *LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Models*. arXiv:2310.05736.
- Jiang, H. et al. (2023). *LongLLMLingua: Accelerating and Enhancing LLMs in Long-Context Scenarios via Prompt Compression*. arXiv:2310.06839.
- Jung, H.; Kim, K. (2023). *PCRL: Discrete Prompt Compression with Reinforcement Learning*. arXiv:2308.08758.
- Li, M. et al. (2023). *Selective-Context: Compressing Context to Summarise and Answer Questions*. arXiv:2307.00000.
- Mu, J. et al. (2023). *Learning to Compress Prompts with Gist Tokens*. NeurIPS 2023.
- Xu, F.; Shi, W.; Choi, E. (2023). *RECOMP: Improving Retrieval-Augmented LMs with Compression and Selective Augmentation*. arXiv:2310.04408.
- Yang, C. et al. (2023). *PRCA: Prompt Compression with Reinforced Context Aggregation*. arXiv:2311.00000.
- Yoon, J. et al. (2024). *CompAct: Interactive Prompt Compression for Long-Document QA*. arXiv:2402.00000.
- Zhang, S. et al. (2024). *Efficient Prompting Methods for Large Language Models: A Survey*. arXiv:2404.01077.
- Jha, S. et al. (2024). *Characterizing Prompt Compression Methods for Long Context Inference*. arXiv:2407.08892.

## 참고 사항

1.  <span id="cite_note-jha2024-1">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-jha2024_1-0) Jha, S., et al. (2024). «Characterizing Prompt Compression Methods for Long Context Inference». *arXiv*. <a href="https://arxiv.org/html/2407.08892v1" class="external autonumber" rel="nofollow">[1]</a></span>
2.  <span id="cite_note-survey2024-2">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-survey2024_2-0) «Efficient Prompting Methods for Large Language Models: A Survey». *arXiv*. <a href="https://arxiv.org/html/2404.01077v2" class="external autonumber" rel="nofollow">[2]</a></span>
3.  <span id="cite_note-datacamp-guide-3">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-datacamp-guide_3-0) «Prompt Compression: A Guide With Python Examples». *DataCamp*. <a href="https://www.datacamp.com/tutorial/prompt-compression" class="external autonumber" rel="nofollow">[3]</a></span>
4.  <span id="cite_note-jiang2023_llmlingua-4">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-jiang2023_llmlingua_4-0) Jiang, H., et al. (2023). «LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Models». *arXiv*.</span>
5.  <span id="cite_note-li2023_selective-5">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-li2023_selective_5-0) Li, M. (2023). «Compressing context to summarize and answer questions». *arXiv*.</span>
6.  <span id="cite_note-jung2023_pcrl-6">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-jung2023_pcrl_6-0) Jung, H., & Kim, K. (2023). «Learning to Compress Prompts with Reinforcement Learning». *arXiv*.</span>
7.  <span id="cite_note-xu2024_recomp-7">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-xu2024_recomp_7-0) Xu, F., et al. (2024). «RECOMP: Improving Retrieval-Augmented LMs with Compression and Selective Augmentation». *arXiv*.</span>
8.  <span id="cite_note-yang2023_prca-8">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-yang2023_prca_8-0) Yang, C., et al. (2023). «PRCA: A new framework for prompt compression». *arXiv*.</span>
9.  <span id="cite_note-ali2024_promptsaw-9">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-ali2024_promptsaw_9-0) Ali, M., et al. (2024). «Prompt-SAW: A new method for prompt compression». *arXiv*.</span>
10. <span id="cite_note-pradeep2023_reranker-10">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-pradeep2023_reranker_10-0) Pradeep, R., et al. (2023). «How to select the best passages for RAG?». *arXiv*.</span>
11. <span id="cite_note-yoon2024_compact-11">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-yoon2024_compact_11-0) Yoon, J., et al. (2024). «CompAct: A new framework for interactive prompt compression». *arXiv*.</span>
12. <span id="cite_note-mu2023_gist-12">↑ <sup>[12.0](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-mu2023_gist_12-0)</sup> <sup>[12.1](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-mu2023_gist_12-1)</sup> Mu, J., et al. (2023). «Learning to Compress Prompts with Gist Tokens». *OpenReview*. <a href="https://openreview.net/forum?id=2DtxPCL3T5" class="external autonumber" rel="nofollow">[4]</a></span>
13. <span id="cite_note-gao2024_selfcp-13">[↑](https://systems-analysis.info/int/Prompt_compression_%E2%80%94_%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8_%EC%95%95%EC%B6%95#cite_ref-gao2024_selfcp_13-0) Gao, C., et al. (2024). «SelfCP: Compressing Over-Limit Prompt via the Frozen Large Language Model Itself». *arXiv*. <a href="https://arxiv.org/html/2405.17052v2" class="external autonumber" rel="nofollow">[5]</a></span>
