To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation
Yitong Zhang, Chengze Li, Ruize Chen, Guowei Yang, Xiaoran Jia, Yijie Ren, Jia Li
Key points
From the paper's conclusion- 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.
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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- LLM See, LLM Do: Enhancing Repository-Aware Code Generation in LLMs Through Logical Context and Usage KnowledgeACM Transactions on Software Engineering and Methodology · 2026
- Library-Oriented Code Generation Method Combining Execution-Feedback Re-Retrieval and Repair MechanismsApplied Sciences · 2026
- Self-Spec Verifiable Code GenerationarXiv · 2026
- UltraData-Code: From Raw Repositories to Algorithmically Dense and Task-Oriented Code DataarXiv · 2026
- PrismaCoder: Pushing the Boundaries of Open Multimodal Code Intelligence through Decomposed Rubric SynthesisarXiv · 2026
- LIBRA: Programmatic Induction of Executable Tool LibrariesarXiv · 2026