Skip to main content
QUICK REVIEW

[Paper Review] To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation

Yitong Zhang, Chengze Li|arXiv (Cornell University)|Mar 16, 2026
Software Engineering ResearchComputer Science0 citations
TL;DR

PriCoder teaches LLMs to invoke private-library APIs by automatically synthesizing high-quality training data through a graph-based data-generation process, significantly improving private-library-oriented code generation with minimal impact on general code tasks.

ABSTRACT

Large Language Models (LLMs) have shown strong potential for code generation, yet they remain limited in private-library-oriented code generation, where the goal is to generate code using APIs from private libraries. Existing approaches mainly rely on retrieving private-library API documentation and injecting relevant knowledge into the context at inference time. However, our study shows that this is insufficient: even given accurate required knowledge, LLMs still struggle to invoke private-library APIs effectively. To address this limitation, we propose PriCoder, an approach that teaches LLMs to invoke private-library APIs through automatically synthesized data. Specifically, PriCoder models private-library data synthesis as the construction of a graph, and alternates between two graph operators: (1) Progressive Graph Evolution, which improves data diversity by progressively synthesizing more diverse training samples from basic ones, and (2) Multidimensional Graph Pruning, which improves data quality through a rigorous filtering pipeline. To support rigorous evaluation, we construct two new benchmarks based on recently released libraries that are unfamiliar to the tested models. Experiments on three mainstream LLMs show that PriCoder substantially improves private-library-oriented code generation, yielding gains of over 20% in pass@1 in many settings, while causing negligible impact on general code generation capability. Our code and benchmarks are publicly available at https://github.com/eniacode/PriCoder.

Motivation & Objective

  • Demonstrate that providing API knowledge alone is insufficient for effective private-library API invocation by LLMs under code generation tasks.
  • Introduce PriCoder, a graph-based data synthesis framework to train LLMs to invoke private libraries.
  • Show that PriCoder improves private-library-oriented code generation on unseen libraries with negligible impact on general code tasks.
  • Provide rigorous benchmarks with libraries unfamiliar to evaluated models to assess private-library capabilities.

Proposed method

  • Model private-library data synthesis as graph construction with API and sample nodes.
  • Use Progressive Graph Evolution to expand the graph and generate diverse training samples.
  • Apply Multidimensional Graph Pruning to remove low-quality samples via syntactic, execution, and functionality checks.
  • Fine-tune LLMs on the synthetic dataset with maximum-likelihood training objective.
  • Possibly combine PriCoder with Retrieval-Augmented Generation by augmenting prompts with retrieved API knowledge.

Experimental results

Research questions

  • RQ1RQ1: How does PriCoder perform in private-library-oriented code generation compared to baselines?
  • RQ2RQ2: Does PriCoder degrade general code generation capability on public benchmarks?
  • RQ3RQ3: What is the contribution of each PriCoder component (Progressive Graph Evolution and Multidimensional Graph Pruning)?
  • RQ4RQ4: How do data synthesis scale and choice of LLM affect PriCoder’s effectiveness?

Key findings

  • PriCoder substantially improves private-library-oriented code generation, with gains of over 20% in pass@1 in many settings across three mainstream LLMs.
  • Gains of more than 30% in pass@k are observed in many settings on the new benchmarks NdonnxEval and NumbaEval.
  • The improvements come with negligible impact on general code generation capability (as shown by public benchmarks).
  • Ablation studies confirm that both Progressive Graph Evolution and Multidimensional Graph Pruning are essential for effectiveness.
  • Two new private-library benchmarks, NdonnxEval and NumbaEval, show models are still challenged by API invocation without PriCoder, highlighting the value of the approach.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.