arXiv:2606.03657cs.AI2026-06

测试大模型用新API的能力,发现知识来源不同效果差异大。

Diagnosing Knowledge Gaps in LLM Tool Use: An Agentic Benchmark for Novel API Acquisition

  • 自动构建动态任务,分解API使用知识并分类错误原因
  • 使用示例是最强独立信号,组合签名与机制/示例效果最佳
  • 检索补内容,微调练流程,二者互补不可替代

大型代码生成语言模型常需使用预训练数据中不存在的API。这不仅要求记忆函数名,还需理解参数签名、模块路径、输入输出约定、语义及可执行模式。现有新API基准多为静态、依赖粗粒度通过/失败指标,或使用不反映真实库演化的合成API。我们提出NovelAPIBench,一个全自动动态基准,可为任意基础模型和目标库自动发现新API,提取分解后的知识包,生成可执行编码任务,并将失败样本归入六类诊断。在约1900个任务、四个基础模型、五个领域上,对比了通过检索注入知识与通过参数化适配内化知识的效果。结果表明,知识组件不可互换:使用示例是最强独立信号;最优双组件组合根据领域和主干模型,分别配签名为机制或示例;增加上下文(尤其是源码)反而因导入路径错误增多而损害性能。参数化适配无法替代移除外部知识后的检索;微调主要教会模型如何使用提供知识包,且该能力可迁移至未见库。结果表明,检索提供易变的API内容,而微调提升过程集成能力,二者互补。

原文摘要 · Abstract (English)

Large language models for code generation often need to use APIs that are absent from their pretraining data. This requires more than recalling a function name: models must coordinate signatures, module paths, input-output contracts, semantics, and executable usage patterns. Existing novel-API benchmarks are typically static, rely on coarse pass/fail metrics, or use synthetic APIs that may not reflect real library evolution. We introduce NovelAPIBench, a fully automated dynamic benchmark that, for any base model and target library, discovers novel APIs, extracts decomposed knowledge bundles, generates executable coding tasks, and assigns failed samples to six diagnostic categories. Across about 1.9K tasks, four base models, and five domains, we compare knowledge injected through retrieval with knowledge internalized through parametric adaptation. We find that knowledge components are not interchangeable: usage examples are the strongest standalone signal, while the best two-component setting pairs signatures with either mechanisms or examples depending on the domain and backbone. Adding more context, especially source code, can hurt by increasing import-path errors. Parametric adaptation also does not replace retrieval once external knowledge is removed; rather, fine-tuning mainly teaches models how to use provided bundles, and this ability transfers to held-out libraries. These results suggest that retrieval and tuning play complementary roles: retrieval supplies volatile API content, while tuning improves procedural integration.

大模型API使用评测基准知识融合

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