TextBFGS: A Case-Based Reasoning Approach to Code Optimization via Error-Operator Retrieval

Zizheng Zhang, Yuyang Liao, Chen Chen, Jian He, Dun Wu +6 more
1/20/2026
cs.LGcs.AI

No confident code implementation found for this paper.

Abstract

Iterative code generation with Large Language Models (LLMs) can be viewed as an optimization process guided by textual feedback. However, existing LLM self-correction methods predominantly operate in a stateless, trial-and-error manner akin to first-order search, failing to leverage past problem-solving experiences.

Show full abstract

To bridge this gap, we introduce TextBFGS, a Case-Based Reasoning (CBR) framework inspired by the Quasi-Newton optimization method. Instead of retrieving raw, unstructured textual instances, TextBFGS maintains a dynamic Case Base of historical "Error-to-Operator" correction trajectories to approximate the semantic curvature (inverse Hessian matrix) of the task. Specifically, given a textual error feedback (the target problem), TextBFGS retrieves analogous historical correction patterns (Retrieve) and applies these abstract operators to refine the current code (Reuse/Revise). Furthermore, successful adaptations are continuously retained back into the Case Base (Retain), enabling a self-evolving system. Empirical evaluations on Python code optimization tasks (HumanEval, MBPP) demonstrate that TextBFGS significantly outperforms stateless baselines. It achieves superior pass rates with fewer model calls, establishing an efficient, experience-driven paradigm for LLM-based code optimization.

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. Any repos shown below are weak matches — 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{zhang2026textbfgs,
  title  = {TextBFGS: A Case-Based Reasoning Approach to Code Optimization via Error-Operator Retrieval},
  author = {Zizheng Zhang and Yuyang Liao and Chen Chen and Jian He and Dun Wu and Qianjin Yu and Yanqin Gao and Jin Yang and Kailai Zhang and Eng Siong Chng and Xionghu Zhong},
  year   = {2026},
  eprint = {2602.00059},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.00059v2}
}

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/2602.00059.svg)](https://codeofpaper.com/paper/2602.00059)

Discussion