AI Model Training Using Code Complexity Ranking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing artificial intelligence models for source code understanding tasks face challenges in learning task-relevant aspects due to variations in code complexity, leading to incorrect predictions and inefficiencies in training.
Innovation Solution
Incorporating code complexity awareness by ranking source code samples based on metrics such as cyclomatic complexity and Halstead complexity, and progressively training AI models on increasingly complex samples to improve learning efficiency and accuracy.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If AI models are trained on source code samples with varying complexity using traditional methods, then training coverage is comprehensive, but learning efficiency decreases and prediction accuracy deteriorates
Solution Approach 1:
The patent applies preliminary action by pre-ranking source code samples based on complexity metrics (cyclomatic complexity, Halstead complexity, etc.) before the training process begins. This preprocessing step organizes training data in advance from simple to complex, allowing the model to progressively build understanding without wasting training time on inefficient sample selection during the training process itself.
Solution Approach 2:
The patent changes the parameter of training sample selection by introducing complexity-based ranking as a new organizational parameter. Instead of using traditional random or uniform sampling, the system transforms the training data organization by sorting samples according to multiple complexity parameters, thereby improving both learning efficiency and prediction accuracy.
2Reliability
If AI models are trained on complex source code samples, then understanding capability improves, but training time and computational resources increase
Solution Approach 1:
By pre-ranking samples according to complexity before training begins, the system prepares an optimized training sequence in advance. This preliminary organization ensures that the model encounters samples in the optimal order (from simple to complex), maximizing learning efficiency while minimizing the time spent on each training iteration.
Solution Approach 2:
The patent introduces dynamic sample selection based on the model's progressive learning state. As training progresses, the system dynamically adjusts which complexity-level samples are presented, allowing the model to adaptively advance through complexity levels rather than being constrained by static training datasets.
3Productivity
If AI models are trained on simple source code samples, then training speed increases, but prediction accuracy on complex code deteriorates
Solution Approach 1:
The system performs preliminary ranking of all training samples by complexity before training starts, creating a structured progression path. This advance preparation ensures that simple samples are encountered first for rapid initial learning, followed systematically by increasingly complex samples that build upon earlier foundations, thereby maintaining both training speed and eventual accuracy on complex code.
Solution Approach 2:
The patent transforms the training approach by changing the organizational parameter of training data from random or uniform distribution to complexity-based sequencing. This parameter change enables the model to progress systematically through complexity levels, ensuring that training speed is optimized in early stages while prediction accuracy on complex code is preserved through structured exposure to challenging samples.
Data Source
AI summary
Techniques regarding training one or more AI models for a source code understanding task are provided. For example, one or more embodiments described herein can comprise a system, which can comprise a memory that can store computer executable components. The system can also comprise a processor, operably coupled to the memory, and that can execute the computer executable components stored in the memory. The computer executable components can comprise a training component that can train an artificial intelligence model on source code samples for a source code understanding task. The source code samples can be ranked based on code complexity.


