We introduce a lightweight encoder-only framework for efficient context compression in Retrieval-Augmented Generation (RAG), addressing the high computational cost and memory overhead associated with processing lengthy retrieved documents. Built upon ModernBERT, EnComp proposes Amortized Marginal Contribution Scoring, which estimates each sentence's importance based on its contribution to passage answerability rather than relying on conventional binary relevance classification. The framework employs counterfactual sentence removal to generate contribution-based supervision signals and introduces a Marginal-Contrastive Objective that encourages the model to distinguish answer-critical evidence from irrelevant context. During inference, EnComp predicts sentence-level importance scores through a single full-context encoding, enabling efficient query-aware pruning without expensive repeated evaluations or autoregressive generation.
Extensive experiments across five question-answering benchmarks demonstrate that EnComp maintains competitive answering accuracy while requiring 3.7× less peak GPU memory and nearly 3× lower compression latency than the strongest baseline, highlighting its effectiveness for resource-constrained RAG applications.
Code, data, and an interactive demo are available at: Coming Very Soon...