When Rules Learn: A Self-Evolving Agent for Legal Case Retrieval
Legal case retrieval remains highly challenging due to linguistic complexity and the need for precise lexical alignment, with BM25 still serving as a strong baseline. This work proposes a training-free, self-evolving framework that leverages large language model (LLM) agents within an automated evaluation environment to iteratively generate query rewriting rules, design validation experiments, and dynamically prune ineffective rules based on historical feedback, thereby optimizing BM25 performance. To the best of our knowledge, this is the first approach to endow rule-based query rewriting with self-evolution capabilities, effectively integrating LLMs’ prior knowledge with empirical experimental feedback. Evaluated on the LeCaRD-v2 Chinese legal retrieval benchmark, the method significantly outperforms non-evolutionary baselines—including handcrafted rules and greedy selection strategies—especially when powered by high-performance LLMs.