Learning from Near-Misses: Error-Aware Contrastive Few-Shot Learning for NL2Formula
Zhihao Shuai, Yiyun Chen, Maolin Ma, Yutong Chen, Hanjia Qiu, Jing Xu, Ziye Chen, Weikai Yang
Abstract
Natural Language to Excel Formula (NL2Formula) translates user intent into executable spreadsheet formulas. However, current models often produce near-miss outputs—formulas that parse correctly yet fail at execution due to an incorrect function, operator, or reference. Through a systematic error analysis, we find that these errors repeatedly arise from a small set of structural decision points, motivating the need for typed error supervision rather than general error signals. To this end, we introduce an abstract syntax tree (AST)-based error taxonomy that organizes common error modes by the kind of decision that goes wrong in the parse tree. Building on this taxonomy, we propose Error-Aware Contrastive Few-Shot Learning (ECFL), an error-aware framework that unifies training and inference around typed error supervision. During offline training, ECFL mines near-miss errors, assigns error types under the taxonomy, and builds error-aware contrastive demonstrations for fine-tuning. During online inference, a lightweight predictor estimates likely error types and triggers targeted retrieval of contrastive demonstrations to guide single-generation inference. Experiments show ECFL improves Exact Match (EM) by 6.4 points over supervised fine-tuning (SFT) and matches self-consistency (SC@5) accuracy at substantially lower inference cost.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 9f85834c-44a1-4558-9ed1-29b8a9d6ef75Builds on18
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
- Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
- Tree of Thoughts: Deliberate Problem Solving with Large Language ModelsShunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran et al.NeurIPS 2023 · 5,068 citations
- MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained TransformersWenhui Wang, Furu Wei, Li Dong, Hangbo Bao et al.NeurIPS 2020 · 2,727 citations
- SimCSE: Simple Contrastive Learning of Sentence EmbeddingsTianyu Gao, Xingcheng Yao, Danqi ChenEMNLP 2021 · 2,496 citations
Related papers
- CLER: Improving Multimodal Financial Reasoning by Cross-MLLM Error ReflectionShuangyan Deng, Zhongsheng Wang, Rui Mao, Ciprian Doru Giurcaneanu et al.AAAI 2026
- FormulaSPIN: Self-Play Fine-Tuning for Natural Language to Spreadsheet Formula GenerationCy XieACL 2026
- Learning from Scoring Disagreements: Contrastive Error Mining for Efficient and Robust LLM-based AssessmentLei Chen, Tengteng Cheng, Boyu Gao, Zitao Liu et al.AAAI 2026
- Hard Sample Aware Prompt-TuningYuanjian Xu, Qi An, Jiahuan Zhang, Peng Li et al.ACL 2023 · 4 citations
- Enhancing Relation Extraction via Supervised Rationale Verification and FeedbackYongqi Li, Xin Miao, Shen Zhou, Mayi Xu et al.AAAI 2025
