← Latest papers
🤖 AI

When Rules Learn: A Self-Evolving Agent for Legal Case Retrieval

This paper proposes a self-evolving, parameter-free framework that leverages an LLM-based agent to iteratively generate, validate, and refine rule-driven query rewriting strategies, thereby significantly enhancing BM25 performance for Chinese legal case retrieval on the LeCaRD-v2 benchmark.

Original authors: Mingxu Tao, Jiawei Hu, Xian Zhou, Wenpeng Hu, Jiajun Cheng, Yunbo Cao, Zhunchen Luo, Guotong Geng

Published 2026-06-17
📖 4 min read☕ Coffee break read

Original authors: Mingxu Tao, Jiawei Hu, Xian Zhou, Wenpeng Hu, Jiajun Cheng, Yunbo Cao, Zhunchen Luo, Guotong Geng

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Big Problem: Finding the Right Needle in a Legal Haystack

Imagine you are a lawyer trying to find a past court case that is almost exactly like your current client's problem. You type a description into a search engine, but the results are messy.

The paper points out a surprising fact: The old-school search method (called BM25) is actually better than the fancy, high-tech AI search methods for finding legal cases. Why? Because legal language is very specific. If you say "car accident" and the old case says "vehicle collision," a fancy AI might miss the connection, but the old-school method is very good at matching the exact words.

However, the old method has a flaw: it needs your search words to be perfect. If you use the wrong legal term, it fails.

The Solution: A "Self-Evolving" Search Coach

The authors built a system to fix this without retraining the AI. Think of it like hiring a search coach who doesn't change the search engine itself but teaches you how to ask better questions.

This coach is an AI agent that follows a set of rules to rewrite your search query.

  • Example Rule: "If the user says 'car crash,' add 'vehicle collision' and 'traffic accident' to the search."

The problem is: Who writes these rules? Usually, you need a human expert. But experts are expensive, and they might miss good ideas.

The Innovation: The Agent Learns by Trial and Error

The authors created a Self-Evolving Framework. Instead of a human writing the rules, the AI agent writes them, tests them, and improves them all by itself.

Here is how the agent works, using a Gardener Analogy:

  1. Planting Seeds (Rule Generation): The agent starts with one basic rule (a seed). It then tries to "plant" new rules. Maybe it thinks, "What if I also add the Latin legal term for this?"
  2. Testing the Garden (Experiment Planning): The agent picks a few rules to test together. It runs a simulation: "If I use Rule A and Rule B together, do I find more relevant cases?"
  3. Weeding (Rule Elimination): This is the most important part. The agent looks at the results. If a rule didn't help, or made things worse, the agent pulls it out (eliminates it).
  4. The Loop: The agent repeats this process hundreds of times. It creates new ideas, tests them, and weeds out the bad ones. It does this without changing its own brain (no complex math training); it just learns by looking at the results of its experiments.

The Results: Bigger Brains Work Better

The team tested this on a Chinese legal database (LeCaRD-v2). They compared their "Self-Evolving Agent" against:

  • Humans writing rules.
  • A "Greedy" strategy (picking the best rules once and sticking with them).
  • Different sizes of AI "brains" (Core LLMs).

The Findings:

  • Small Brains Struggle: When they used a smaller AI model to be the "coach," it got confused. It couldn't figure out which rules worked well together. It often made things slightly worse than the simple "Greedy" strategy.
  • Big Brains Succeed: When they used a very large, powerful AI (like gpt-oss-120b), the system beat everyone. It found better rule combinations than the human experts and the greedy strategy.
  • Why? The big AI was good at two things:
    1. Planning: It could look at past experiments and say, "Rule A worked, and Rule B worked separately; let's try them together."
    2. Weeding: It was good at identifying which rules were useless and removing them to keep the search clean.

The Catch (Limitations)

The paper admits a few things:

  • Language Matters: The AI needs to be really good at understanding and writing in the specific language of the law (in this case, Chinese). If the AI is bad at the language, it generates "garbage" rules that don't make sense.
  • Not Magic: The system doesn't work well with small AI models. You need a "smart" coach to manage the garden effectively.

Summary

The paper shows that you don't always need to build a new, super-complex AI to solve hard problems. Sometimes, you just need a smart agent that can write its own instructions, test them, and fire the bad ones until it finds the perfect way to search for legal cases. It's like having a search engine that teaches itself how to speak the language of the law better than a human ever could.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →