← Latest papers
💬 NLP

TextReg: Mitigating Prompt Distributional Overfitting via Regularized Text-Space Optimization

The paper introduces TextReg, a regularization framework that mitigates prompt distributional overfitting in large language models by controlling representational inefficiency through textual gradients, thereby significantly improving out-of-distribution generalization compared to existing optimization methods.

Original authors: Lucheng Fu, Ye Yu, Yiyang Wang, Yiqiao Jin, Haibo Jin, B. Aditya Prakash, Haohan Wang

Published 2026-05-21
📖 4 min read☕ Coffee break read

Original authors: Lucheng Fu, Ye Yu, Yiyang Wang, Yiqiao Jin, Haibo Jin, B. Aditya Prakash, Haohan Wang

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

Imagine you are teaching a very smart but literal-minded robot how to solve a puzzle. You give it a set of instructions (a "prompt").

In the past, when researchers tried to automatically improve these instructions using the robot's own feedback, a strange problem happened. The instructions would get longer and longer, filling up with tiny, specific rules like, "If the number is 7, do X," and "If the object is a tomato, do Y."

At first, this seemed great because the robot got perfect scores on the practice puzzles. But when you gave it a new puzzle it hadn't seen before, it failed miserably. It was like a student who memorized the answers to a specific practice test but didn't understand the math, so they couldn't solve a slightly different problem.

The authors call this "Prompt Distributional Overfitting." In simple terms, the instructions became too "stuck" on the specific practice examples and lost their ability to handle the real world.

The Solution: TextReg (The "Smart Editor")

The paper introduces a new method called TextReg. Think of TextReg as a strict, wise editor who watches the robot's instruction-writing process and stops it from getting messy.

Here is how TextReg works, using three simple analogies:

1. The "Double-Check" Filter (Dual-Evidence Gradient Purification)

Imagine the robot suggests a new rule: "Always count tomatoes as vegetables."

  • The Old Way: The robot might just accept this because it worked for the specific tomato example in the practice test.
  • The TextReg Way: TextReg asks two questions:
    1. "Did this rule only work because of this one specific tomato?" (Local Check)
    2. "Have we seen this rule work for other fruits or objects before?" (Global Check)
      If the rule only works for tomatoes and hasn't been seen elsewhere, TextReg throws it out. It only keeps rules that are broad and useful, like "Count all fruits."

2. The "Fitness Tracker" (Semantic Edit Regularization)

Every time the instructions change, TextReg checks the "health" of the prompt. It looks at two things:

  • Length: Did the instructions get unnecessarily long? (Like adding too many words to a sentence).
  • Scope: Did the instructions get too narrow? (Like adding a rule that only applies to one specific day of the week).
    If the instructions get too long or too specific, TextReg generates a "correction signal" telling the robot to trim the fat and broaden the rules. It's like a personal trainer yelling, "Stop adding junk food to your diet!"

3. The "Guided Rewrite" (Regularization-Guided Prompt Update)

Finally, when the robot rewrites the instructions, it doesn't just listen to the task feedback (how to solve the puzzle). It also listens to the "fitness tracker."

  • If the task says, "Add a rule about tomatoes," but the fitness tracker says, "Don't make it specific," TextReg forces the robot to find a middle ground. It might rewrite the rule to be about "vegetables" in general instead of just tomatoes.

The Results: Why It Matters

The authors tested this on various reasoning tasks (like logic puzzles and math problems). They found that:

  • Old methods (like TextGrad or REVOLVE) often created long, messy instructions that worked well on practice tests but failed on new, harder versions of the same tasks.
  • TextReg created shorter, cleaner instructions. Because the rules were broad and not tied to specific examples, the robot performed much better on new, unseen problems (what researchers call "Out-of-Distribution" generalization).

In fact, TextReg improved accuracy by up to 16.5% compared to previous methods on difficult tasks.

The Bottom Line

TextReg treats writing instructions for AI like writing a good textbook. A good textbook shouldn't just list every single example you've ever seen; it should teach the general principles so you can solve problems you've never seen before. TextReg ensures the AI's instructions stay focused on those principles, preventing it from memorizing the practice test.

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 →