Pre-training Model Using Dependency Embeddings for Code Commenting

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing auto-commenting models for code snippets require extensive tailored training, are often specific to a programming language, organization, or team, limiting generalization and accuracy, and struggle with insufficient training data, leading to prediction errors and resource-intensive training processes.

Innovation Solution

A computer-implemented method using a pre-training model trained with dependency data, including frameworks, libraries, and APIs, to create a subsequent auto-commenting model that reduces the need for extensive training sets by leveraging dependency embeddings and transfer learning, allowing for more efficient and accurate code comment generation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If existing auto-commenting models are trained with extensive tailored training data for specific programming languages, organizations, or teams, then the model accuracy for those specific contexts is improved, but the training time and computational resources required increase significantly

Engineering Contradiction:
Improvemodel accuracyVSAvoidtraining time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent applies preliminary action by pre-training the model on extensive dependency data and code-comment pairs from multiple programming languages and projects before deployment. This pre-training establishes a robust foundation of learned parameters and embeddings that can be directly utilized or fine-tuned for specific applications, eliminating the need for extensive training from scratch for each new context.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements universality by creating a multi-lingual model that can process and generate comments for multiple programming languages (Java, C++, Python, etc.) using a single trained model. The model learns from diverse codebases and dependency data across different languages, enabling it to generalize across language-specific syntax and conventions without requiring separate training for each language.

Inventive Principle:
Principle #6Universality (Multi-functionality)

2Measurement precision

If existing auto-commenting models are trained with extensive tailored training data, then the model accuracy is improved, but the computational resources and storage requirements increase

Engineering Contradiction:
Improvemodel accuracyVSAvoidtraining data volume
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent applies extraction by isolating and utilizing only the essential training components - specifically pre-trained model parameters, dependency embeddings, and code-comment pairs - that are necessary for accurate auto-commenting. Rather than storing and processing all raw training data, the system extracts the learned representations and parameters that capture the essential patterns, significantly reducing storage requirements while maintaining accuracy.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent implements parameter changes by transforming the training process from using raw code and comments to using learned embeddings and parameters. The model converts unstructured code data into structured dependency graphs and embeddings, then trains on these compressed representations. This parameter transformation reduces the effective training data volume while preserving the essential information needed for accurate comment generation.

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If auto-commenting models are trained to be specific to a programming language or organization, then the specialization accuracy is improved, but the generalizability to other languages and projects decreases

Engineering Contradiction:
Improvespecialization accuracyVSAvoidgeneralizability
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent implements universality by creating a multi-lingual model that can process and generate comments for multiple programming languages (Java, C++, Python, etc.) using a single trained model. The model learns from diverse codebases and dependency data across different languages, enabling it to generalize across language-specific syntax and conventions without requiring separate training for each language.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent applies preliminary action by pre-training the model on extensive dependency data and code-comment pairs from multiple programming languages and projects before deployment. This pre-training establishes a robust foundation of learned parameters and embeddings that can be directly utilized or fine-tuned for specific applications, eliminating the need for extensive training from scratch for each new context.

Inventive Principle:
Principle #10Preliminary action

4Measurement precision

If extensive tailored training is performed for each specific application, then the model accuracy for that application is improved, but the deployment complexity and cost increase

Engineering Contradiction:
Improveapplication-specific accuracyVSAvoiddeployment complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by pre-training the model on extensive dependency data and code-comment pairs from multiple programming languages and projects before deployment. This pre-training establishes a robust foundation of learned parameters and embeddings that can be directly utilized or fine-tuned for specific applications, eliminating the need for extensive training from scratch for each new context.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements copying by creating reusable pre-trained model checkpoints and dependency embeddings that can be copied and deployed across multiple applications and projects. Instead of training separate models for each application, the system copies the pre-trained parameters and embeddings, requiring only minimal adaptation for new contexts, thereby simplifying deployment and reducing complexity.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11262985B2Pretraining utilizing software dependencies
Publication Date: 2022.03.01 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11262985B2 patent drawing
  • US11262985B2 patent drawing
  • US11262985B2 patent drawing

AI summary

In an approach to creating code snippet auto-commenting models utilizing a pre-training model leveraging dependency data, one or more computer processors create a generalized pre-training model trained with one or more dependencies and one or more associated dependency embeddings, wherein dependencies include frameworks, imported libraries, header files, and application programming interfaces associated with a software project. The one or more computer processors create a subsequent model with a model architecture identical to the created pre-training model. The one or more computer processors computationally reduce a training of the created subsequent model utilizing one or more trained parameters, activations, memory cells, and context vectors contained in the created pre-training model. The one or more computer processors create deploy the subsequent model to one to more production environments.