To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation

Large Language Models (LLMs) have shown strong potential for code generation, yet they remain limited in private-library-oriented code generation, where models are expected to generate code that correctly invokes APIs from private libraries. Existing approaches primarily rely on retrieving private-library API documentation and injecting the retrieved knowledge into the context at inference time. However, our study shows that this strategy is insufficient: even when provided with accurate required API knowledge, LLMs still struggle to invoke private-library APIs effectively . To address this limitation, we propose PriCoder, an approach that improves LLMs’ ability to invoke private-library APIs through automatically synthesized training data. Specifically, PriCoder uses a synthesis graph to organize private-library data synthesis and applies two complementary operations: ❶ Progressive Graph Evolution , which improves data diversity by progressively synthesizing more complex and diverse training samples from basic ones, and ❷ Multidimensional Graph Pruning , which improves data quality through an automatic filtering pipeline. To support rigorous evaluation, we construct two new benchmarks based on recently released libraries that are unfamiliar to the evaluated models. Across the two private-library benchmarks and all evaluated models, PriCoder improves over Vanilla by 13.53–31.66 percentage points in pass@k . On HumanEval and MBPP, PriCoder generally achieves higher performance than RAG-based baselines.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-11-07
DOI
https://doi.org/10.1145/3862481
Citations
4
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
14.84
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation

Xiaoran Jia, Chengze Li, Guowei Yang, Yitong Zhang et al.
4 citations
ACM Transactions on Software Engineering and Methodology
Software Engineering Research
14.84
article

To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation

Xiaoran Jia, Chengze Li, Guowei Yang, Yitong Zhang, Jia Li, Ruize Chen, Yijie Ren
article en
4 citations

Abstract

Large Language Models (LLMs) have shown strong potential for code generation, yet they remain limited in private-library-oriented code generation, where models are expected to generate code that correctly invokes APIs from private libraries. Existing approaches primarily rely on retrieving private-library API documentation and injecting the retrieved knowledge into the context at inference time. However, our study shows that this strategy is insufficient: even when provided with accurate required API knowledge, LLMs still struggle to invoke private-library APIs effectively . To address this limitation, we propose PriCoder, an approach that improves LLMs’ ability to invoke private-library APIs through automatically synthesized training data. Specifically, PriCoder uses a synthesis graph to organize private-library data synthesis and applies two complementary operations: ❶ Progressive Graph Evolution , which improves data diversity by progressively synthesizing more complex and diverse training samples from basic ones, and ❷ Multidimensional Graph Pruning , which improves data quality through an automatic filtering pipeline. To support rigorous evaluation, we construct two new benchmarks based on recently released libraries that are unfamiliar to the evaluated models. Across the two private-library benchmarks and all evaluated models, PriCoder improves over Vanilla by 13.53–31.66 percentage points in pass@k . On HumanEval and MBPP, PriCoder generally achieves higher performance than RAG-based baselines.

ACM Transactions on Software Engineering and Methodology
Beijing Institute of Technology (CN), Beihang University (CN), Nanjing University (CN), Tsinghua University (CN)
Openalex Percentile: Top 1%
Software Engineering Research
14.84
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon