Saved in:
Bibliographic Details
Main Authors: Zhang, Zizheng, Liao, Yuyang, Chen, Chen, He, Jian, Wu, Dun, Yu, Qianjin, Gao, Yanqin, Yang, Jin, Zhang, Kailai, Chng, Eng Siong, Zhong, Xionghu
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2602.00059
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910083519086592
author Zhang, Zizheng
Liao, Yuyang
Chen, Chen
He, Jian
Wu, Dun
Yu, Qianjin
Gao, Yanqin
Yang, Jin
Zhang, Kailai
Chng, Eng Siong
Zhong, Xionghu
author_facet Zhang, Zizheng
Liao, Yuyang
Chen, Chen
He, Jian
Wu, Dun
Yu, Qianjin
Gao, Yanqin
Yang, Jin
Zhang, Kailai
Chng, Eng Siong
Zhong, Xionghu
contents 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. 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.
format Preprint
id arxiv_https___arxiv_org_abs_2602_00059
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle TextBFGS: A Case-Based Reasoning Approach to Code Optimization via Error-Operator Retrieval
Zhang, Zizheng
Liao, Yuyang
Chen, Chen
He, Jian
Wu, Dun
Yu, Qianjin
Gao, Yanqin
Yang, Jin
Zhang, Kailai
Chng, Eng Siong
Zhong, Xionghu
Machine Learning
Artificial Intelligence
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. 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.
title TextBFGS: A Case-Based Reasoning Approach to Code Optimization via Error-Operator Retrieval
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2602.00059