[Paper Review] Semantic Compression With Large Language Models
This paper proposes using large language models (LLMs) like GPT-3.5 and GPT-4 for semantic compression—lossy, intent-preserving data reduction—demonstrating that GPT-4 can compress text and code while preserving semantic meaning, enabling effective reconstruction of original content from compressed prompts with up to ~5× more effective token utilization than native limits.
The rise of large language models (LLMs) is revolutionizing information retrieval, question answering, summarization, and code generation tasks. However, in addition to confidently presenting factually inaccurate information at times (known as "hallucinations"), LLMs are also inherently limited by the number of input and output tokens that can be processed at once, making them potentially less effective on tasks that require processing a large set or continuous stream of information. A common approach to reducing the size of data is through lossless or lossy compression. Yet, in some cases it may not be strictly necessary to perfectly recover every detail from the original data, as long as a requisite level of semantic precision or intent is conveyed. This paper presents three contributions to research on LLMs. First, we present the results from experiments exploring the viability of approximate compression using LLMs, focusing specifically on GPT-3.5 and GPT-4 via ChatGPT interfaces. Second, we investigate and quantify the capability of LLMs to compress text and code, as well as to recall and manipulate compressed representations of prompts. Third, we present two novel metrics -- Exact Reconstructive Effectiveness (ERE) and Semantic Reconstruction Effectiveness (SRE) -- that quantify the level of preserved intent between text compressed and decompressed by the LLMs we studied. Our initial results indicate that GPT-4 can effectively compress and reconstruct text while preserving the semantic essence of the original text, providing a path to leverage $\sim$5$ imes$ more tokens than present limits allow.
Motivation & Objective
- Address the critical limitation of LLM input token constraints, which restrict processing of large or continuous data streams.
- Investigate whether LLMs can perform approximate compression that preserves semantic intent rather than requiring exact reconstruction.
- Develop and validate novel evaluation metrics to quantify both semantic and exact reconstruction fidelity in LLM-based compression.
- Demonstrate the feasibility of using LLMs to compress and later reconstruct source code and natural language descriptions with high functional accuracy.
- Enable scalable software analysis and code generation by extending effective context length beyond native LLM token limits.
Proposed method
- Utilize GPT-3.5 and GPT-4 via ChatGPT interfaces to compress input text and code into shorter, semantically rich prompts.
- Design and apply two new metrics: Exact Reconstructive Effectiveness (ERE) for word-for-word fidelity and Semantic Reconstruction Effectiveness (SRE) for intent preservation.
- Evaluate compression by prompting the LLM to reconstruct the original input from the compressed version and comparing outputs against the source.
- Test the approach on diverse inputs including natural language descriptions, Python code, and software documentation.
- Apply prompt engineering techniques to optimize compression quality and ensure consistent, reproducible results across trials.
- Analyze the trade-offs between compression ratio, reconstruction accuracy, and semantic fidelity across different data types and model versions.
Experimental results
Research questions
- RQ1Can LLMs effectively perform approximate compression of text and code while preserving the original semantic intent?
- RQ2To what extent can GPT-4 reconstruct original content from compressed LLM-generated representations compared to baseline models?
- RQ3How do the novel metrics SRE and ERE quantify the balance between semantic fidelity and exact textual reconstruction in LLM outputs?
- RQ4What is the maximum effective token utilization achievable through LLM-based semantic compression, and how does it scale with model capability?
- RQ5How do resource constraints and model updates affect the reproducibility and consistency of LLM compression results?
Key findings
- GPT-4 demonstrated strong semantic compression capability, enabling reconstruction of original content with high semantic fidelity even after significant compression.
- The Semantic Reconstruction Effectiveness (SRE) metric successfully quantified intent preservation, showing that compressed outputs retained core meaning across diverse input types.
- Exact Reconstructive Effectiveness (ERE) revealed that while exact word-for-word reconstruction was lower, the compressed representations still conveyed essential information accurately.
- GPT-4 achieved an effective token utilization of up to ~5× the native input limit by compressing and reconstructing large inputs through iterative prompting.
- The study found that prompt engineering significantly improved compression quality, with optimized prompts yielding higher SRE and ERE scores.
- Despite limitations in reproducibility due to model updates and non-deterministic outputs, consistent compression patterns were observed across multiple trials.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.