Detection of runtime errors using machine learning
AssigneeMicrosoft Technology Licensing, LLC
InventorsShaun Miller, Kalpathy Sitaraman Sivaraman, Neelakantan Sundaresan, Yijin Wei, Roshanak Zilouchian Moghaddam
Life of this patent
Estimating the term…
Abstract
Runtime errors in a source code program are detected in advance of execution by machine learning models. Features representing a context of a runtime error are extracted from source code programs to train a machine learning model, such as a random forest classifier, to predict the likelihood that a code snippet has a particular type of runtime error. The features are extracted from a syntax-type tree representation of each method in a program. A model is generated for distinct runtime errors, such as arithmetic overflow, and conditionally uninitialized variables.
Claims15
A computer-implemented method, comprising:
- collecting a first plurality of source code snippets having an arithmetic expression corrected to fix an arithmetic overflow error;
- extracting a plurality of first features from each of the first plurality of source code snippets;
- transforming the plurality of first features into a first training dataset;
- training a machine learning model to identify the arithmetic overflow error using the first training dataset;
- collecting a second plurality of source code snippets having an arithmetic expression not having been fixed to correct the arithmetic overflow error;
- extracting a plurality of second features from each of the second plurality of source code snippets;
- transforming the plurality of second features into a second training dataset;
- and
- training the machine learning model to identify the arithmetic overflow error using the second training dataset.
A computer-implemented method, comprising:
- obtaining a first training dataset of first features extracted from source code methods having experienced a runtime error and source code methods without having experienced the runtime error;
- training a first machine learning model using the first training dataset to learn to predict a first probability of the runtime error based on the first features;
- obtaining a second training dataset of second features extracted from the source code methods having experienced the runtime error and source code methods without having experienced the runtime error;
- training a second machine learning model with the second training dataset to learn to predict a second probability of the runtime error based on the second features;
- and
- training a fourth machine learning model with the output from the first machine learning model and the output from the second machine learning model to infer the runtime error.
Dependencies are inferred from the claim text.