Abstract
As Large Language Models (LLMs) become central to modern natural language processing, the demand for efficient and secure text representations has intensified. Standard sentence embeddings are often high-dimensional and contain extraneous information, including sensitive user attributes. We present TexShape, a novel framework that utilizes information-theoretic principles to "shape" sentence embeddings. By optimizing mutual information (MI) through neural estimation, TexShape produces representations that are simultaneously compressed, utility-preserving, and privacy-aware. Our experiments demonstrate that TexShape can effectively scrub sensitive attributes while maintaining high performance on target tasks, outperforming traditional compression baselines and providing a robust mechanism for informational filtering.
Introduction
The proliferation of LLMs has created a significant tension between data utility and resource constraints. While high-dimensional sentence embeddings capture rich semantic nuances, they are often "leaky," containing a wealth of information beyond what is required for a specific task. This extraneous data often includes sensitive attributes—such as geographic location or demographic details—posing substantial privacy risks.
Traditional approaches to this problem, such as Principal Component Analysis (PCA) or autoencoders, focus on minimizing reconstruction error (Mean Squared Error). However, minimizing distortion does not guarantee the preservation of the semantic information necessary for downstream utility. Conversely, privacy-preserving techniques that rely on additive noise often result in a significant degradation of model performance. TexShape addresses these challenges by treating embedding generation as an optimization problem rooted in information theory, aiming to create an "optimal" encoder that retains only the desired information.
Methodology
Architecture
The TexShape framework consists of two primary modules: a projection encoder and an information-theoretic evaluator.
- The Encoder: The process begins with a frozen, off-the-shelf sentence transformer (e.g., MPNet) to generate a high-dimensional base embedding. This is followed by a trainable Deep Neural Network (DNN) that projects the base embedding into a lower-dimensional space.
- The Information-Theoretic Evaluator: This component serves as the objective function for the training process. Rather than using standard loss metrics, TexShape utilizes Mutual Information (MI). Given the difficulty of calculating MI for high-dimensional continuous data, the framework employs a neural estimator based on the Donsker-Varadhan representation of Kullback–Leibler divergence.
Training Objective
The training objective is formulated as a weighted linear combination of three distinct MI terms, allowing users to "shape" the resulting embedding:
- General Compression: Maximizing MI between the compressed embedding and the original representation.
- Utility Preservation: Maximizing MI between the embedding and "public" (task-specific) labels.
- Privacy/Fairness: Minimizing MI between the embedding and "sensitive" (private) labels.
By adjusting the weights ($\gamma, \lambda, \mu$) of these terms, the framework can be tuned for various use cases, ranging from task-agnostic compression to rigorous privacy-preserving data sharing.
Experimental Setup
TexShape was evaluated across three public datasets, each modified to include both a "public" utility label and a "private" sensitive label:
- SST-2 (Stanford Sentiment Treebank): Public label: Sentiment; Private label: Sentence length.
- Corona-NLP: Public label: Author location (US vs. Non-US); Private label: Sentiment.
- MultiNLI (Multi-Genre Natural Language Inference): Utilized for testing general, task-agnostic compression across diverse logical relationships.
Results and Discussion
Privacy-Utility Trade-offs
TexShape demonstrates a superior ability to filter sensitive information without compromising task performance. On the SST-2 dataset, the framework reduced the MI of the private label from 0.5552 to 0.1334—a significant reduction in data leakage. Crucially, the MI for the public sentiment label remained nearly identical to the original (0.50 vs. 0.47), proving that informational filtering can be achieved without sacrificing utility.
Compression and Fairness
In task-agnostic scenarios (MultiNLI), TexShape embeddings of size 128 significantly outperformed random projections of the same dimensionality, achieving 61.0% accuracy compared to the 51.1% baseline. This suggests that MI-based compression preserves semantic meaning more effectively than linear or random methods.
Furthermore, the framework proved effective as a de-biasing tool. By minimizing MI with respect to sentence length in SST-2 and sentiment in the Corona-NLP location task, TexShape successfully removed inherent biases from the representations, leading to fairer downstream model behavior.
Stability and Implementation
Neural MI estimation is known for instability. To ensure convergence, the authors utilized specific regularization techniques and an iterative training schedule that separates the updates for the encoder and the MI estimator. This approach proved vital for maintaining a stable training signal across high-dimensional projections.
Conclusion and Future Work
TexShape introduces a paradigm shift in embedding generation, moving from simple dimensionality reduction to "informational sculpting." By leveraging the Donsker-Varadhan representation, the framework provides a flexible way to balance the competing needs of compression, utility, and privacy.
Future research will focus on automating the selection of hyperparameter weights ($\gamma, \lambda, \mu$) and exploring non-linear combinations of the MI objectives. Additionally, as LLMs continue to scale, investigating the computational efficiency of MI estimators for billion-parameter models remains a priority.
Summary updated