LLM Prompting With Release Notes for Deprecated API Migration
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Modern software development faces challenges in updating code that uses deprecated APIs due to outdated library versions and biased training in language-model based developer tools, leading to inefficiencies and potential code obsolescence.
Innovation Solution
A method involving a large language model (LLM) is used to update deprecated code by accessing a corpus of library release notes, storing them in a vector database, identifying relevant notes, and building prompts to rewrite the code based on these notes, optionally providing rationale and confidence metrics.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If language-model based developer tools are used to suggest code, then code generation efficiency is improved, but the suggestions are biased towards outdated idioms and deprecated APIs due to heavily biased training corpus towards older library versions
Solution Approach 1:
The system performs preliminary action by retrieving relevant release notes and API migration information from the vector database before generating code suggestions. This ensures that the LLM has access to current library version information and deprecated API warnings, allowing it to generate up-to-date code while maintaining generation efficiency.
Solution Approach 2:
The system introduces an intermediary mechanism (release note retrieval and processing layer) between the LLM and the code generation process. This intermediary retrieves current library documentation and deprecated API information, transforming it into context that guides the LLM to produce suggestions aligned with current library versions rather than relying solely on its biased training corpus.
2Adaptability or versatility
If existing users are encouraged to update to the latest version, then access to new features and performance improvements is gained, but the update process becomes challenging due to lack of example code and tutorials for newer versions
Solution Approach 1:
The system enables self-service by automatically retrieving relevant release notes and migration guides from the vector database based on the code being analyzed. Instead of requiring users to manually search for update information, the system autonomously fetches and applies relevant migration instructions, making the update process seamless and reducing the barrier to adopting newer library versions.
3Stability of the object's composition
If deprecated APIs are used in code, then compatibility with older library versions is maintained, but the code becomes obsolete and requires manual updating later
Solution Approach 1:
The system implements feedback by analyzing code against the vector database of release notes to identify deprecated API usage. When deprecated APIs are detected, the system provides feedback through rewritten code suggestions that replace deprecated calls with current alternatives, preventing future obsolescence while maintaining functionality. This proactive feedback loop eliminates the need for future manual updates.
Data Source
AI summary
Techniques for intelligently prompting an LLM to fix code are disclosed. A corpus of release notes for a set of libraries is accessed. The release notes include information describing deprecated or removed APIs associated with the libraries. The corpus is stored in a vector database. A code snippet is accessed. This snippet is identified as potentially using a deprecated API. The code snippet is used to identify a set of release notes from the vector database. These release notes are determined to satisfy a threshold level of similarity with the code snippet. An LLM prompt is built and is fed to the LLM. The LLM prompt instructs the LLM to update the code snippet based on the identified set of release notes. Output of the LLM is displayed. This output includes a proposed rewritten version of the code snippet.


