Lighter And Better: Towards Flexible Context Adaptation For Retrieval Augmented Generation
The existing Retrieval-Augmented Generation (RAG) systems face significant challenges in terms of cost and effectiveness. On one hand, they need to encode the lengthy retrieved contexts before responding to the input tasks, which imposes substantial computational overhead. On the other hand, directly using generic Large Language Models (LLMs) often leads to sub-optimal answers, while task-specific fine-tuning may compromise the LLMs' general capabilities. To address these challenges, we introduce a novel approach called FlexRAG (<u>Flex</u>ible Context Adaptation for <u>RAG</u>). In this approach, the retrieved contexts are compressed into compact embeddings before being encoded by the LLMs. Simultaneously, these compressed embeddings are optimized to enhance downstream RAG performance. A key feature of FlexRAG is its flexibility, which enables effective support for diverse compression ratios and selective preservation of important contexts. With these designs, FlexRAG achieves superior generation quality while significantly reducing running costs. The experiments across multiple QA datasets validate our approach as a cost-effective and flexible solution for RAG systems (codebase: https://github.com/wcyno23/FlexRAG).
Authors
- Senzhang Wang (ORCID: https://orcid.org/0000-0002-3615-4859)
- Chaozhuo Li (ORCID: https://orcid.org/0000-0002-9867-1712)
- Shitao Xiao (ORCID: https://orcid.org/0000-0003-2567-6843)
- Ninglu Shao (ORCID: https://orcid.org/0009-0003-2120-3528)
- Defu Lian (ORCID: https://orcid.org/0000-0002-3507-9607)
- Chen Zhang (ORCID: https://orcid.org/0000-0002-3306-9317)
- Zheng Liu (ORCID: https://orcid.org/0000-0001-7765-8466)
- Chenyuan Wu
Institutions
- University of Science and Technology of China (CN)
- Central South University (CN)
- Beijing University of Posts and Telecommunications (CN)
- Hong Kong Polytechnic University (HK)
- Beijing Academy of Artificial Intelligence (CN)
- Renmin University of China (CN)
Publication Details
- Published
- 2025-02-26
- DOI
- https://doi.org/10.1145/3701551.3703580
- Citations
- 3
- Primary Topic
- Multimodal Machine Learning Applications
- Type
- article
- Field-Weighted Citation Impact
- 3.83