Association for Computational Linguistics (Oral)2026
Learning from Near-Misses: Error-Aware Contrastive Few-Shot Learning for NL2Formula
View larger imageAbstract
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.
Materials
Citation
@inproceedings{shuai2026learning,
author = {Shuai, Zhihao and Chen, Yiyun and Ma, Maolin and Chen, Yutong and Qiu, Hanjia and Xu, Jing and Chen, Ziye and Yang, Weikai},
title = {Learning from Near-Misses: Error-Aware Contrastive Few-Shot Learning for {NL2Formula}},
booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
publisher = {Association for Computational Linguistics},
year = {2026},
pages = {29662--29676},
doi = {10.18653/v1/2026.acl-long.1368},
url = {https://aclanthology.org/2026.acl-long.1368/}
}