arXiv:2510.14331cs.LG2025-10被引 2

用大模型先生成程序再验证,少样本学算法更高效

LLM Priors for ERM over Programs

  • 用预训练大模型生成候选程序,无需穷举搜索
  • 仅需少量标注数据就能准确恢复底层规则
  • 适合需要强泛化能力的算法学习任务

我们研究了在样本和计算上都高效的程序学习方法。经典学习理论指出,当目标可由短程序描述(如简短的Python代码)时,可通过在程序类上进行经验风险最小化(ERM)从少量例子中学习。但该方法依赖枚举候选程序,通常随描述长度呈指数增长;梯度训练避免显式搜索,但在某些短程序族上仍需指数级样本才能成功。我们提出 extsc{LLM-PV}:一种提议-验证范式,可在不完全枚举的情况下实现程序类上的ERM选择——预训练大模型生成候选程序分布,每个程序在保留验证集上执行并评分,选出最优者,无梯度更新或验证反馈用于调整采样分布。在奇偶性变体、模式匹配和素数判定等算法任务中, extsc{LLM-PV}常能从小规模标注集恢复精确底层规则,并显著超越训练序列长度进行泛化,而基于SGD的Transformer、微调、上下文学习及经典机器学习基线虽能拟合训练数据,却无法可靠泛化。这些结果表明,预训练大模型先验可作为有效搜索偏差,缩小统计效率与计算效率之间的差距。

原文摘要 · Abstract (English)

We study program-learning methods that are efficient in both samples and computation. Classical learning theory suggests that when the target admits a short program description, for example a short piece of ``Python code'', it can be learned from few examples by ERM over the program class. However, this approach relies on enumerating candidate programs, which is typically exponential in the description length; gradient-based training avoids this explicit search but, for some families of short programs, can require exponentially many samples to succeed. We propose \textsc{LLM-PV}, a propose-and-verify recipe that enables ERM-style selection over a discrete program class without exhaustive enumeration: a pretrained LLM induces a proposal distribution over candidate programs, each proposal is executed and scored on a held-out validation set, and the best program is selected, with no gradient updates or validation feedback used to adapt the sampling distribution. Across algorithmic tasks including parity variants, pattern matching, and primality testing, \textsc{LLM-PV} often recovers the exact underlying rule from a small labeled set and generalizes far beyond the training sequence lengths, while SGD-trained transformers, fine-tuning, in-context learning, and classical ML baselines can fit the training data yet fail to generalize reliably. Together, these results suggest that pretrained LLM priors can serve as effective search biases for ERM, narrowing the gap between statistical and computational efficiency.

程序学习大模型泛化能力

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。