[Paper Review] SE Factual Knowledge in Frozen Giant Code Model: A Study on FQN and its Retrieval
This paper proposes a lightweight in-context learning method to retrieve API Fully Qualified Names (FQNs) from GitHub Copilot, a frozen giant code model, without fine-tuning or code compilation. It demonstrates that Copilot stores substantial factual FQN knowledge, achieving high inference accuracy with minimal few-shot examples, enabling practical, deployment-ready FQN prediction for code analysis and reuse tasks.
Pre-trained giant code models (PCMs) start coming into the developers' daily practices. Understanding what types of and how much software knowledge is packed into PCMs is the foundation for incorporating PCMs into software engineering (SE) tasks and fully releasing their potential. In this work, we conduct the first systematic study on the SE factual knowledge in the state-of-the-art PCM CoPilot, focusing on APIs' Fully Qualified Names (FQNs), the fundamental knowledge for effective code analysis, search and reuse. Driven by FQNs' data distribution properties, we design a novel lightweight in-context learning on Copilot for FQN inference, which does not require code compilation as traditional methods or gradient update by recent FQN prompt-tuning. We systematically experiment with five in-context-learning design factors to identify the best in-context learning configuration that developers can adopt in practice. With this best configuration, we investigate the effects of amount of example prompts and FQN data properties on Copilot's FQN inference capability. Our results confirm that Copilot stores diverse FQN knowledge and can be applied for the FQN inference due to its high inference accuracy and non-reliance on code analysis. Based on our experience interacting with Copilot, we discuss various opportunities to improve human-CoPilot interaction in the FQN inference task.
Motivation & Objective
- To investigate the extent and characteristics of factual software engineering knowledge—specifically API Fully Qualified Names (FQNs)—stored in frozen giant code models like GitHub Copilot.
- To evaluate whether in-context learning can effectively retrieve FQN knowledge from Copilot without model fine-tuning or code analysis.
- To identify optimal prompt design configurations for FQN inference in partial code, minimizing reliance on external symbolic knowledge bases.
- To explore practical human-AI collaboration patterns for FQN inference using frozen PCMs in real-world software engineering workflows.
Proposed method
- Design a novel in-context learning framework for FQN inference using only prompt demonstrations, without gradient updates or code compilation.
- Leverage the data distribution properties of FQNs—temporally bursty, Zipfian distribution, and dynamic meaning—to guide prompt design.
- Systematically evaluate five in-context learning design factors (e.g., few-shot example quantity, prompt format, example order) to identify the optimal configuration.
- Use a curated dataset of FQNs from six major libraries (Android SDK, JDK, Hibernate, etc.) to assess Copilot’s FQN inference performance.
- Apply zero-shot and few-shot prompting to infer FQNs in partial code snippets, measuring accuracy and robustness across varying data properties.
- Analyze the impact of FQN frequency, length, and usage patterns on inference performance to understand model generalization.
Experimental results
Research questions
- RQ1To what extent does GitHub Copilot store factual FQN knowledge as a neural knowledge base?
- RQ2What in-context learning prompt design yields the highest FQN inference accuracy in Copilot without fine-tuning?
- RQ3How do the quantity of few-shot examples and FQN data properties (e.g., frequency, length) affect inference performance?
- RQ4Can in-context learning on frozen Copilot outperform traditional symbolic or compiled analysis methods for FQN inference?
- RQ5What are the practical implications and opportunities for human-CoPilot collaboration in FQN inference tasks?
Key findings
- Copilot stores a large and diverse amount of factual FQN knowledge, enabling accurate inference without model fine-tuning or code compilation.
- The best-performing in-context learning configuration achieves high FQN inference accuracy using only a few few-shot examples, with performance stable across different FQN frequency levels.
- FQN data exhibits Zipfian distribution, with 12% of FQNs used over 10,000 times, and the model generalizes well even to rare or out-of-vocabulary FQNs.
- In-context learning on Copilot is technically feasible and deployable at scale, as it requires no model updates or parsing, only prompt engineering.
- The model’s performance is robust to variations in prompt design, but optimal configuration significantly improves accuracy, especially for ambiguous or polysemous simple names.
- Human-CoPilot interaction for FQN inference can be enhanced through structured prompt design and AI chain paradigms, enabling more reliable and reusable code analysis workflows.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.