Towards Context-Robust LLMs: A Gated Representation Fine-tuning Approach

Shenglai Zeng, Pengfei He, Kai Guo, Tianqi Zheng, Hanqing Lu +2 more
2/19/2025
cs.CLcs.IR

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

Large Language Models (LLMs) enhanced with external contexts, such as through retrieval-augmented generation (RAG), often face challenges in handling imperfect evidence. They tend to over-rely on external knowledge, making them vulnerable to misleading and unhelpful contexts. To address this, we propose the concept of context-robust LLMs, which can effectively balance internal knowledge with external context, similar to human cognitive processes. Specifically, context-robust LLMs should rely on external context only when lacking internal knowledge, identify contradictions between internal and external knowledge, and disregard unhelpful contexts. To achieve this goal, we introduce Grft, a lightweight and plug-and-play gated representation fine-tuning approach. Grft consists of two key components: a gating mechanism to detect and filter problematic inputs, and low-rank representation adapters to adjust hidden representations. By training a lightweight intervention function with only 0.0004\% of model size on fewer than 200 examples, Grft can effectively adapt LLMs towards context-robust behaviors.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zeng2025towards,
  title  = {Towards Context-Robust LLMs: A Gated Representation Fine-tuning Approach},
  author = {Shenglai Zeng and Pengfei He and Kai Guo and Tianqi Zheng and Hanqing Lu and Yue Xing and Hui Liu},
  year   = {2025},
  eprint = {2502.14100},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.14100v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.14100.svg)](https://codeofpaper.com/paper/2502.14100)

Discussion