This disclosure relates generally to machine programming and, more particularly, to methods and apparatus to train models for program synthesis.
Machine programming (MP) is related to the automation of software development. For example, program synthesis is an MP technique that has gained traction in recent years. Particularly, genetic algorithms (GAs) have been increasingly implemented as a program synthesis technique to enable automated software construction. For program synthesis systems, a specification for program behavior is typically provided to a system so that a program with the specified behavior can be constructed and/or generated. Many known program synthesis systems rely on sets of input/output examples for the programmer to specify the behavior of the program that they wish the program synthesis system to create. According to some known programming synthesis systems, each element of an input/output set contains a possible input to a program, as well as a corresponding desired output that is generated by transforming the input by a synthesized program. However, efforts to synthesize the program by these techniques can be tedious and time-consuming.
In general, the same reference numbers will be used throughout the drawing(s) and accompanying written description to refer to the same or like parts. The figures are not to scale.
Unless specifically stated otherwise, descriptors such as “first,” “second,” “third,” etc., are used herein without imputing or otherwise indicating any meaning of priority, physical order, arrangement in a list, and/or ordering in any way, but are merely used as labels and/or arbitrary names to distinguish elements for ease of understanding the disclosed examples. In some examples, the descriptor “first” may be used to refer to an element in the detailed description, while the same element may be referred to in a claim with a different descriptor such as “second” or “third.” In such instances, it should be understood that such descriptors are used merely for identifying those elements distinctly that might, for example, otherwise share a same name.
As used herein “substantially real time” refers to occurrence in a near instantaneous manner recognizing there may be real world delays for computing time, transmission, etc. Thus, unless otherwise specified, “substantially real time” refers to real time+/−1 second. As used herein, the phrase “in communication,” including variations thereof, encompasses direct communication and/or indirect communication through one or more intermediary components, and does not require direct physical (e.g., wired) communication and/or constant communication, but rather additionally includes selective communication at periodic intervals, scheduled intervals, aperiodic intervals, and/or one-time events.
As used herein, “processor circuitry” is defined to include (i) one or more special purpose electrical circuits structured to perform specific operation(s) and including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors), and/or (ii) one or more general purpose semiconductor-based electrical circuits programmed with instructions to perform specific operations and including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). Examples of processor circuitry include programmed microprocessors, Field Programmable Gate Arrays (FPGAs) that may instantiate instructions, Central Processor Units (CPUs), Graphics Processor Units (GPUs), Digital Signal Processors (DSPs), XPUs, or microcontrollers and integrated circuits such as Application Specific Integrated Circuits (ASICs). For example, an XPU may be implemented by a heterogeneous computing system including multiple types of processor circuitry (e.g., one or more FPGAs, one or more CPUs, one or more GPUs, one or more DSPs, etc., and/or a combination thereof) and application programming interface(s) (API(s)) that may assign computing task(s) to whichever one(s) of the multiple types of the processing circuitry is/are best suited to execute the computing task(s).
Methods and apparatus to train models for program synthesis are disclosed. Machine programming (MP) is related to the automation of software development. For example, genetic algorithms (GAs) have been increasingly implemented as a program synthesis technique to enable automated software construction. Many known program synthesis systems rely on sets of input/output examples. However, utilizing input/output sets for program synthesis can be tedious and time consuming.
Examples disclosed herein utilize machine learning (ML) that utilizes programs in combination with natural language descriptions of program behavior and/or specifications to accurate synthesize programs in a relatively quick and time-efficient manner. In particular, some examples disclosed herein can increase a speed at which GA-based program synthesis tools are able to synthesize programs. Further, examples disclosed herein can increase a number and/or a size of programs that a system is able to access for different functions and/or specifications (e.g., program specifications). Even further, examples disclosed herein can also decrease and/or eliminate a number of input/output examples necessitated for program synthesis.
In a model training phase, examples disclosed herein sample at least one pair of programs which, in turn, include a first program having a corresponding natural language descriptions, as well as a second program, which may be randomly generated, produced in a GA and/or retrieved/accessed (e.g., an existing program that is retrieved). In turn, according to examples disclosed herein, program similarity scores are calculated for the aforementioned pair(s) of programs. Accordingly, a model is trained based on entries corresponding to the respective pairs. Ones of the entries include a natural language description (associated with one of the first programs) with a corresponding paired one of the second programs, as well as a respective program similarity score that functions as a label for the model. As a result, the model can be utilized in an inference phase to facilitate and/or enable efficient synthesis of programs, which may be accessed or generated (e.g., randomly generated, generated in a GA, etc.). Additionally or alternatively, the trained model can be utilized to adjust parameters and/or aspects of a GA. In some examples, the trained model is used to select programs with a relatively high program similarity score for use in a GA.
In some examples, ones of the pairs are filtered. For some such examples, ones of the pairs with similarity scores that are within a threshold similarity of other pairs can be deleted and/or removed from further analysis to enable a more even distribution of pairs with differing similarity scores. In some examples, the trained model is implemented (after being trained) to provide a fitness score and/or similarity score of a program (e.g., a candidate program) associated with a GA program and/or process in conjunction with a natural language description (e.g., a natural language text specification for a program). Additionally or alternatively, the trained model is utilized to adjust, refine and/or further train the GA program and/or process. The trained model can be utilized to provide programs to a GA with similarity scores to corresponding natural language text that exceeds a threshold similarity score value. In some examples, the similarity scores are calculated utilizing a code semantics similarity, such as a machine-inferred code similarity (MISIM) system or Aroma code recommendation software.
In some examples, the second programs are programs generated via a GA. In some such examples, the programs are iteratively combined and modified (e.g., cross-bred, selectively cross-bred, mutated, etc.). Accordingly, the programs can be evaluated with a score (e.g., a fitness score, a similarity score, etc.) to characterize whether the programs are improving (e.g., evolving), an effectiveness of the GA and/or an associated GA process. In some such examples, the GA and/or parameters of the GA can be adjusted based on utilizing the trained model. In particular, the GA can be adjusted based on fitness and/or similarity scores of programs evaluated by the trained model. Additionally or alternatively, programs that are provided to the GA may be based on fitness scores determined by the trained model. In particular, the GA can preferentially copy, crossbreed, or mutate higher scoring programs to be represented in the next generation programs with higher similarity scores, for example.
Artificial intelligence (AI), including machine learning (ML), deep learning (DL), and/or other artificial machine-driven logic, enables machines (e.g., computers, logic circuits, etc.) to use a model to process input data to generate an output based on patterns and/or associations previously learned by the model via a training process. For instance, the model may be trained with data to recognize patterns and/or associations and follow such patterns and/or associations when processing input data such that other input(s) result in output(s) consistent with the recognized patterns and/or associations.
Many different types of machine learning models and/or machine learning architectures exist. In examples disclosed herein, a long-short-term memory (LSTM) model is used. Using an LSTM model enables encoding of programs and natural language text for a fitness and/or similarity evaluation of a program, for example. In general, machine learning models/architectures that are suitable to use in the example approaches disclosed herein will be a recurrent neural network (RNN), a transformer machine learning model, a gated recurrent unit (GRU), or temporal convolutional network (TCN). However, other types of machine learning models could additionally or alternatively be used such as a temporal convolutional network, etc.
In general, implementing a ML/AI system involves two phases, a learning/training phase and an inference phase. In the learning/training phase, a training algorithm is used to train a model to operate in accordance with patterns and/or associations based on, for example, training data. In general, the model includes internal parameters that guide how input data is transformed into output data, such as through a series of nodes and connections within the model to transform input data into output data. Additionally, hyperparameters are used as part of the training process to control how the learning is performed (e.g., a learning rate, a number of layers to be used in the machine learning model, etc.). Hyperparameters are defined to be training parameters that are determined prior to initiating the training process.
Different types of training may be performed based on the type of ML/AI model and/or the expected output. For example, supervised training uses inputs and corresponding expected (e.g., labeled) outputs to select parameters (e.g., by iterating over combinations of select parameters) for the ML/AI model that reduce model error. As used herein, labelling refers to an expected output of the machine learning model (e.g., a classification, an expected output value, etc.). Alternatively, unsupervised training (e.g., used in deep learning, a subset of machine learning, etc.) involves inferring patterns from inputs to select parameters for the ML/AI model (e.g., without the benefit of expected (e.g., labeled) outputs).
In examples disclosed herein, ML/AI models are trained using LSTM neural networks. However, any other training algorithm may additionally or alternatively be used. In examples disclosed herein, training is performed until a trained model can output a fitness and/or similarity score of a program relative to natural language text with a relative degree of accuracy. In some examples disclosed herein, training is performed until a requisite/sufficient number of programs (e.g., all the programs for training/learning) have been utilized in training the model. Training is performed using hyperparameters that control how the learning is performed (e.g., a learning rate, a number of layers to be used in the machine learning model, etc.). In examples disclosed herein, hyperparameters that control aspects of fitness determination of programs are utilized. In some examples, re-training may be performed. Such re-training may be performed in response to an amount of data that can be utilized to train the model and/or the trained model to reach a requisite degree of accuracy in determining fitness and/or similarity scores, for example.
Training is performed using training data. In examples disclosed herein, the training data originates from natural language descriptions and/or programs. Because supervised training is used, the training data is labeled. According to examples disclosed herein, labeling is applied to the training data as a program similarity score.
Once training is complete, the model is deployed for use as an executable construct that processes an input and provides an output based on the network of nodes and connections defined in the model. The model is stored at a data storage device or data store.
Once trained, the deployed model may be operated in an inference phase to process data. In the inference phase, data to be analyzed (e.g., live data) is input to the model, and the model executes to create an output. This inference phase can be thought of as the AI “thinking” to generate the output based on what it learned from the training (e.g., by executing the model to apply the learned patterns and/or associations to the live data). In some examples, input data undergoes pre-processing before being used as an input to the machine learning model. Moreover, in some examples, the output data may undergo post-processing after it is generated by the AI model to transform the output into a useful result (e.g., a display of data, an instruction to be executed by a machine, etc.).
In some examples, output of the deployed model may be captured and provided as feedback. By analyzing the feedback, an accuracy of the deployed model can be determined. If the feedback indicates that the accuracy of the deployed model is less than a threshold or other criterion, training of an updated model can be triggered using the feedback and an updated training data set, hyperparameters, etc., to generate an updated, deployed model.
According to the illustrated example, an example computing device 111 is implemented to for an inference phase 110 corresponding to a trained model 112 that is provided from the example model analysis system 102. The trained model 112 of the illustrated example utilizes inputs 114, which may include at least one of the candidate programs 109 in combination with a corresponding natural language description, to provide output 116, which is a similarity or fitness score in this example. Additionally or alternatively, the computing device 101 is also utilized for the aforementioned inference phase 110. As can be seen in the illustrated example of
In operation, and as will be discussed in greater detail below in connection with
To train the example model 112, the model analysis system 102 samples the first programs 104 and the second programs 106 to define pairs of ones of the first programs 104 and ones of the second programs 106. In particular, similarity scores of the aforementioned pairs are calculated. In this example, a code semantics similarity score of ones of the pairs is calculated using the aforementioned MISIM or Aroma scores, for example. Accordingly, entries are utilized to train the model 112. In this example, the entries include a natural language description of a paired one of the first programs 104 with a corresponding paired one of the second programs 106, as well as corresponding similarity score of the pair, which functions as a label for training the model 112. The example second programs 106 can, in turn, include programs, which can be retrieved (e.g., from a server and/or library, randomly generated and/or generated in a GA, such as the GA process and/or system 107 of
Once the model 112 is trained, the input(s) 114 can include natural language text with a corresponding program. In turn, the model 112 can provide and/or generate the output(s) 116, which includes a similarity or fitness score. In this example, the score corresponds to a degree of relevance of the program provided as input with the corresponding natural text. In some examples, programs with scores calculated from the trained model 112 that are above a threshold are used in conjunction with the GA process and/or system 107 for further iterations and/or cross-breeding between programs to yield programs with relatively higher fitness scores. In other words, the model 112 can be trained to evaluate a synthesis process for a program and/or facilitate generation of a program that more closely matches specifications associated with the natural language text.
The computing and/or network communication implementation shown in
The example model analysis system 200 includes example sampler circuitry 202, example program generator circuitry 204, example code semantics similarity circuitry 206, example GA analyzer circuitry 208, example filter circuitry 210, example model trainer circuitry 212, example fitness analyzer circuitry 216, and example model implementer circuitry 218. In this example, the model analysis system 200 is communicatively coupled to a data storage 220.
The sampler circuitry 202 of the illustrated example samples one of the first programs 104 with natural language descriptions (e.g., as metadata or an external attachment) and ones of the second programs 106 to define pairs therebetween. In particular, ones of the pairs includes one of the first programs 104 with a corresponding natural language description and/or text, and one of the second programs 106. In this example, the sampler circuitry 202 randomly pairs ones of the first programs 104 with ones of the second programs 106 to define the pairs. In some examples, the first programs 104 and/or the second programs 106 can number in the thousands or millions. However, any appropriate number of the first programs 104 and/or the second programs 106 can be implemented instead. In some other examples, the pairs are defined based on a degree of similarity between a first one of the first programs 104 and a second one of the second programs 106. Additionally or alternatively, the sampler circuitry 202 samples and/or takes into account the input(s)/output(s) 108, which can include pairs of inputs and outputs corresponding to known and/or released programs. Additionally or alternatively, the input(s)/output(s) 108 are paired with corresponding ones of the first programs 104 and/or ones of the second programs 106. In some examples, the first programs 104, the second programs 106 and/or the input(s)/output(s) 108 of
In an example, ones of a set of sample programs, S, and the equivalent natural language description of those programs and optionally other specifications such as input/output examples can be combined by the sample circuitry 202 with ones of randomly generated programs, R, which do not have associated natural language descriptions. Accordingly, the sampler circuitry 202 can generate a significant number of pairs of programs (e.g., thousands to millions of pairs of programs, etc.), where a first program in a pair comes from S and a second program in a pair may come from either S or R.
The example program generator circuitry 204 generates (e.g., randomly generates) and/or refines (e.g., via multiple iterations) programs (e.g., candidate programs), which may encompass the second programs 106, for example. According to some examples, the candidate programs can be randomly generated and/or obtained from sources external to the model analysis system 200 (e.g., via the network 120 shown in
In this example, the code semantics similarity circuitry 206, determines similarities of the aforementioned pairs created by the example sampler circuitry 202. In particular, the example code semantics similarity circuitry 206 determines a degree of similarity (e.g., a similarity score or index) between ones (e.g., all) of the pairs generated by the example sampler circuitry 202. In some examples, the code semantics similarity circuitry 206 calculates and/or implements determination of the aforementioned MISIM or Aroma based program correctness scores to determine the degree of similarity. Additionally or alternatively, the pairs are ranked and/or sorted based on the aforementioned degree of similarity.
In some examples, the GA analyzer circuitry 208 is implemented to evaluate and/or adjust candidate programs generated by the program generator circuitry 204 and/or the GA system and/or process 107 shown in
In the illustrated example of
The model trainer circuitry 212 of the illustrated example trains, generates and/or develops a model based on entries corresponding to the pairs filtered in some examples by the filter circuitry 210. In this example, the model trainer circuitry utilizes an LSTM network (e.g., a sequential network, a bi-directional LSTM network, etc.) to train a network with the filtered pairs including ones of the first programs 104 and ones of the second programs 106. However, any appropriate type of neural network architecture can be implemented instead.
In this example, the model may be trained by the model trainer circuitry 212 with data to recognize patterns and/or associations and follow such patterns and/or associations when processing input data such that other input(s) result in output(s) consistent with the recognized patterns and/or associations. Many different types of machine learning models and/or machine learning architectures exist. In examples disclosed herein, an LSTM model is used. Using an LSTM model enables encoding of text for a fitness evaluation of a program, for example. In general, machine learning models/architectures that are suitable to use in the example approaches disclosed herein will be an RNN, a transformer machine learning model, GRU, or TCN. However, other types of machine learning models could additionally or alternatively be used such as a temporal convolutional network, etc.
In general, implementing a ML/AI system involves two phases, a learning/training phase and an inference phase. In the learning/training phase, a training algorithm is used to train a model to operate in accordance with patterns and/or associations based on, for example, training data. In general, the model includes internal parameters that guide how input data is transformed into output data, such as through a series of nodes and connections within the model to transform input data into output data. Additionally, hyperparameters are used as part of the training process to control how the learning is performed (e.g., a learning rate, a number of layers to be used in the machine learning model, etc.). Hyperparameters are defined to be training parameters that are determined prior to initiating the training process.
Different types of training may be performed based on the type of ML/AI model and/or the expected output. For example, supervised training uses inputs and corresponding expected (e.g., labeled) outputs to select parameters (e.g., by iterating over combinations of select parameters) for the ML/AI model that reduce model error. As used herein, labelling refers to an expected output of the machine learning model (e.g., a classification, an expected output value, etc.). Alternatively, unsupervised training (e.g., used in deep learning, a subset of machine learning, etc.) involves inferring patterns from inputs to select parameters for the ML/AI model (e.g., without the benefit of expected (e.g., labeled) outputs).
In examples disclosed herein, ML/AI models are trained using LSTM neural networks. However, any other training algorithm may additionally or alternatively be used. In examples disclosed herein, training is performed until a trained model can output a fitness score with a relative degree of accuracy and/or a sufficient number of programs are utilized to perform the training. Training is performed using hyperparameters that control how the learning is performed (e.g., a learning rate, a number of layers to be used in the machine learning model, etc.). In examples disclosed herein, hyperparameters that control aspects of fitness determination of programs. In some examples re-training may be performed. Such re-training may be performed in response to an amount of data that can be utilized to train the model and/or the trained model reaching a requisite degree of accuracy in determining fitness scores, for example.
Training is performed using training data. In examples disclosed herein, the training data originates from natural language descriptions and programs. Because supervised training is used, the training data is labeled. Labeling is applied to the training data as a program similarity score.
Once training is complete, the model is deployed for use as an executable construct that processes an input and provides an output based on the network of nodes and connections defined in the model. The model is stored at a data storage and/or a computing device that is utilized for training and/or implementation of the model, for example.
Once trained, the deployed model may be operated in an inference phase to process data. In the inference phase, data to be analyzed (e.g., live data) is input to the model, and the model executes to create an output. This inference phase can be thought of as the AI “thinking” to generate the output based on what it learned from the training (e.g., by executing the model to apply the learned patterns and/or associations to the live data). In some examples, input data undergoes pre-processing before being used as an input to the machine learning model. Moreover, in some examples, the output data may undergo post-processing after it is generated by the AI model to transform the output into a useful result (e.g., a display of data, an instruction to be executed by a machine, etc.).
In some examples, output of the deployed model may be captured and provided as feedback. By analyzing the feedback, an accuracy of the deployed model can be determined. If the feedback indicates that the accuracy of the deployed model is less than a threshold or other criterion, training of an updated model can be triggered using the feedback and an updated training data set, hyperparameters, etc., to generate an updated, deployed model.
The example fitness analyzer circuitry 216 can be utilized to analyze and/or determine a fitness of at least one program (e.g., from the second programs 106) from a GA, or from a repository of stored programs. Additionally or alternatively, the fitness analyzer circuitry 216 can analyze a program that is randomly generated. In particular, the example fitness analyzer circuitry 216 can be implemented to adjust a manner and/or a degree to which candidate programs are developed and/or iterated in a GA. In other words, the fitness analyzer circuitry 216 can be used to adjust a GA and/or models being developed and/or selected as inputs to the GA. In some examples, the fitness analyzer circuitry 216 is implemented to determine which programs and/or candidate programs are to be mutated, iterated and/or cross-bred in the GA (e.g., based on fitness and/or similarity scores).
The example model implementer circuitry 218 can be utilized to implement the trained model trained by the example model trainer circuitry 212. For example, the model implementer circuitry 218 can provide inputs to the trained model to determine a fitness of a program (e.g., a candidate program). According to examples disclosed herein, the inputs to the trained model can include a natural language description and the program. Accordingly, the output from the trained model can be a fitness and/or similarity score of the program. In turn, as mentioned above, the fitness analyzer circuitry 216 can adjust aspects/parameters of the GA and/or candidate models being selected for further processing by the GA.
In the illustrated example of
In the illustrated example of
In some examples, the natural language encoding 406 is provided to the neural network 416, as generally shown by an arrow 430. Additionally or alternatively, the natural language encoding 406 is provided to the neural network 420 (e.g., for when additional specifications and/or requirements are to be evaluated), as generally shown by an arrow 432. However, any appropriate network structure and/or model layering can be implemented instead.
While an example manner of implementing the example model analysis system 200 of
Flowcharts representative of example hardware logic circuitry, machine readable instructions, hardware implemented state machines, and/or any combination thereof for implementing the model analysis system 200 of
The machine readable instructions described herein may be stored in one or more of a compressed format, an encrypted format, a fragmented format, a compiled format, an executable format, a packaged format, etc. Machine readable instructions as described herein may be stored as data or a data structure (e.g., as portions of instructions, code, representations of code, etc.) that may be utilized to create, manufacture, and/or produce machine executable instructions. For example, the machine readable instructions may be fragmented and stored on one or more storage devices and/or computing devices (e.g., servers) located at the same or different locations of a network or collection of networks (e.g., in the cloud, in edge devices, etc.). The machine readable instructions may require one or more of installation, modification, adaptation, updating, combining, supplementing, configuring, decryption, decompression, unpacking, distribution, reassignment, compilation, etc., in order to make them directly readable, interpretable, and/or executable by a computing device and/or other machine. For example, the machine readable instructions may be stored in multiple parts, which are individually compressed, encrypted, and/or stored on separate computing devices, wherein the parts when decrypted, decompressed, and/or combined form a set of machine executable instructions that implement one or more operations that may together form a program such as that described herein.
In another example, the machine readable instructions may be stored in a state in which they may be read by processor circuitry, but require addition of a library (e.g., a dynamic link library (DLL)), a software development kit (SDK), an application programming interface (API), etc., in order to execute the machine readable instructions on a particular computing device or other device. In another example, the machine readable instructions may need to be configured (e.g., settings stored, data input, network addresses recorded, etc.) before the machine readable instructions and/or the corresponding program(s) can be executed in whole or in part. Thus, machine readable media, as used herein, may include machine readable instructions and/or program(s) regardless of the particular format or state of the machine readable instructions and/or program(s) when stored or otherwise at rest or in transit.
The machine readable instructions described herein can be represented by any past, present, or future instruction language, scripting language, programming language, etc. For example, the machine readable instructions may be represented using any of the following languages: C, C++, Java, C#, Perl, Python, JavaScript, HyperText Markup Language (HTML), Structured Query Language (SQL), Swift, etc.
As mentioned above, the example operations of
“Including” and “comprising” (and all forms and tenses thereof) are used herein to be open ended terms. Thus, whenever a claim employs any form of “include” or “comprise” (e.g., comprises, includes, comprising, including, having, etc.) as a preamble or within a claim recitation of any kind, it is to be understood that additional elements, terms, etc., may be present without falling outside the scope of the corresponding claim or recitation. As used herein, when the phrase “at least” is used as the transition term in, for example, a preamble of a claim, it is open-ended in the same manner as the term “comprising” and “including” are open ended. The term “and/or” when used, for example, in a form such as A, B, and/or C refers to any combination or subset of A, B, C such as (1) A alone, (2) B alone, (3) C alone, (4) A with B, (5) A with C, (6) B with C, or (7) A with B and with C. As used herein in the context of describing structures, components, items, objects and/or things, the phrase “at least one of A and B” is intended to refer to implementations including any of (1) at least one A, (2) at least one B, or (3) at least one A and at least one B. Similarly, as used herein in the context of describing structures, components, items, objects and/or things, the phrase “at least one of A or B” is intended to refer to implementations including any of (1) at least one A, (2) at least one B, or (3) at least one A and at least one B. As used herein in the context of describing the performance or execution of processes, instructions, actions, activities and/or steps, the phrase “at least one of A and B” is intended to refer to implementations including any of (1) at least one A, (2) at least one B, or (3) at least one A and at least one B. Similarly, as used herein in the context of describing the performance or execution of processes, instructions, actions, activities and/or steps, the phrase “at least one of A or B” is intended to refer to implementations including any of (1) at least one A, (2) at least one B, or (3) at least one A and at least one B.
As used herein, singular references (e.g., “a”, “an”, “first”, “second”, etc.) do not exclude a plurality. The term “a” or “an” object, as used herein, refers to one or more of that object. The terms “a” (or “an”), “one or more”, and “at least one” are used interchangeably herein. Furthermore, although individually listed, a plurality of means, elements or method actions may be implemented by, e.g., the same entity or object. Additionally, although individual features may be included in different examples or claims, these may possibly be combined, and the inclusion in different examples or claims does not imply that a combination of features is not feasible and/or advantageous.
The machine readable instructions and/or operations 500 of
At block 502, the example sampler circuitry 202 (
At block 504, in some examples, input(s) and/or output(s) are accessed and/or received by the example sampler circuitry 202. For example, multiple sets of example inputs and corresponding outputs are accessed and/or received by the sampler circuitry 202.
At block 506, pairs of programs are sampled by the example sampler circuitry 202 of the illustrated example. In this example, the first and second programs are randomly paired. In some other examples, the first and second programs are paired by the sampler circuitry 202 based on an initial and/or predicted degree of similarity.
At block 508, in the illustrated example, the code semantics similarity circuitry 206 (
At block 510, according to some examples disclosed herein, the example filter circuitry 210 (
At block 511, the example model trainer circuitry 212 (
At block 512, a model is trained (e.g., further trained, trained using supervised learning) and/or generated by the example model trainer circuitry 212. In this example, inputs to the aforementioned model include entries, each of which include the natural language description with the paired one of the second programs, along with the corresponding label including one of the program similarity scores. Additionally or alternatively, at least one of an input/output pair is included in ones of the entries. In some examples, the entry further includes a corresponding one of the first programs paired with the one of the second programs. Additionally or alternatively, the trained model is provided to the example model implementer circuitry 218 for an inference/implementation phase. In some examples, the model is trained through multiple networks (e.g., for multiple specifications), which may be in a sequential, bi-directional or non-sequential training process.
In the illustrated example, at block 514, the model implementation circuitry 218 (
In some examples, at block 516, the example fitness analyzer circuitry 216 (
At block 602, the example model implementer circuitry 218 (
At block 604, the example model implementer circuitry 218 of the illustrated example determines and/or calculates a score (e.g., a similarity score, a correctness score, a fitness score, etc.) based on providing the aforementioned inputs to the trained model.
At block 606, in some examples, the model implementer circuitry 218 and/or the fitness analyzer circuitry 216 (
At block 608, in some examples, the model implementer circuitry 218 and/or the fitness analyzer circuitry 216 select programs for which scores have been determined and/or calculated by the example model implementer circuitry 218. In some such examples, programs with scores below a threshold value can be eliminated and/or removed from consideration.
At block 610, in some examples, the fitness analyzer circuitry 216 and/or the GA analyzer circuitry 208 (
At block 612, in some examples, the model implementer circuitry 218 outputs programs deemed to match natural language description text to a requisite degree and the instructions and/or operations of
The processor platform 700 of the illustrated example includes processor circuitry 712. The processor circuitry 712 of the illustrated example is hardware. For example, the processor circuitry 712 can be implemented by one or more integrated circuits, logic circuits, FPGAs microprocessors, CPUs, GPUs, DSPs, and/or microcontrollers from any desired family or manufacturer. The processor circuitry 712 may be implemented by one or more semiconductor based (e.g., silicon based) devices. In this example, the processor circuitry 712 implements the example sampler circuitry 202, the example program generator circuitry 204, the example code semantics similarity circuitry 206, the example GA analyzer circuitry 208, the example filter circuitry 210, the example model trainer circuitry 212, the example fitness analyzer circuitry 216, and the example model implementer circuitry 218.
The processor circuitry 712 of the illustrated example includes a local memory 713 (e.g., a cache, registers, etc.). The processor circuitry 712 of the illustrated example is in communication with a main memory including a volatile memory 714 and a non-volatile memory 716 by a bus 718. The volatile memory 714 may be implemented by Synchronous Dynamic Random Access Memory (SDRAM), Dynamic Random Access Memory (DRAM), RAMBUS® Dynamic Random Access Memory (RDRAM®), and/or any other type of RAM device. The non-volatile memory 716 may be implemented by flash memory and/or any other desired type of memory device. Access to the main memory 714, 716 of the illustrated example is controlled by a memory controller 717.
The processor platform 700 of the illustrated example also includes interface circuitry 720. The interface circuitry 720 may be implemented by hardware in accordance with any type of interface standard, such as an Ethernet interface, a universal serial bus (USB) interface, a Bluetooth® interface, a near field communication (NFC) interface, a PCI interface, and/or a PCIe interface.
In the illustrated example, one or more input devices 722 are connected to the interface circuitry 720. The input device(s) 722 permit(s) a user to enter data and/or commands into the processor circuitry 712. The input device(s) 722 can be implemented by, for example, an audio sensor, a microphone, a camera (still or video), a keyboard, a button, a mouse, a touchscreen, a track-pad, a trackball, an isopoint device, and/or a voice recognition system.
One or more output devices 724 are also connected to the interface circuitry 720 of the illustrated example. The output devices 724 can be implemented, for example, by display devices (e.g., a light emitting diode (LED), an organic light emitting diode (OLED), a liquid crystal display (LCD), a cathode ray tube (CRT) display, an in-place switching (IPS) display, a touchscreen, etc.), a tactile output device, a printer, and/or speaker. The interface circuitry 720 of the illustrated example, thus, typically includes a graphics driver card, a graphics driver chip, and/or graphics processor circuitry such as a GPU.
The interface circuitry 720 of the illustrated example also includes a communication device such as a transmitter, a receiver, a transceiver, a modem, a residential gateway, a wireless access point, and/or a network interface to facilitate exchange of data with external machines (e.g., computing devices of any kind) by a network 726. The communication can be by, for example, an Ethernet connection, a digital subscriber line (DSL) connection, a telephone line connection, a coaxial cable system, a satellite system, a line-of-site wireless system, a cellular telephone system, an optical connection, etc.
The processor platform 700 of the illustrated example also includes one or more mass storage devices 728 to store software and/or data. Examples of such mass storage devices 728 include magnetic storage devices, optical storage devices, floppy disk drives, HDDs, CDs, Blu-ray disk drives, redundant array of independent disks (RAID) systems, solid state storage devices such as flash memory devices, and DVD drives.
The machine executable instructions 732, which may be implemented by the machine readable instructions of
The cores 802 may communicate by an example bus 804. In some examples, the bus_04 may implement a communication bus to effectuate communication associated with one(s) of the cores 802. For example, the bus 804 may implement at least one of an Inter-Integrated Circuit (I2C) bus, a Serial Peripheral Interface (SPI) bus, a PCI bus, or a PCIe bus. Additionally or alternatively, the bus 804 may implement any other type of computing or electrical bus. The cores 802 may obtain data, instructions, and/or signals from one or more external devices by example interface circuitry 806. The cores 802 may output data, instructions, and/or signals to the one or more external devices by the interface circuitry 806. Although the cores 802 of this example include example local memory 820 (e.g., Level 1 (L1) cache that may be split into an L1 data cache and an L1 instruction cache), the microprocessor circuitry 800 also includes example shared memory 810 that may be shared by the cores (e.g., Level 2 (L2_cache)) for high-speed access to data and/or instructions. Data and/or instructions may be transferred (e.g., shared) by writing to and/or reading from the shared memory 810. The local memory 820 of each of the cores 802 and the shared memory 810 may be part of a hierarchy of storage devices including multiple levels of cache memory and the main memory (e.g., the main memory 714, 716 of
Each core 802 may be referred to as a CPU, DSP, GPU, etc., or any other type of hardware circuitry. Each core 802 includes control unit circuitry 814, arithmetic and logic (AL) circuitry (sometimes referred to as an ALU) 816, a plurality of registers 818, the L1 cache 820, and a second example bus 822. Other structures may be present. For example, each core 802 may include vector unit circuitry, single instruction multiple data (SIMD) unit circuitry, load/store unit (LSU) circuitry, branch/jump unit circuitry, floating-point unit (FPU) circuitry, etc. The control unit circuitry 814 includes semiconductor-based circuits structured to control (e.g., coordinate) data movement within the corresponding core 802. The AL circuitry 816 includes semiconductor-based circuits structured to perform one or more mathematic and/or logic operations on the data within the corresponding core 802. The AL circuitry 816 of some examples performs integer based operations. In other examples, the AL circuitry 816 also performs floating point operations. In yet other examples, the AL circuitry 816 may include first AL circuitry that performs integer based operations and second AL circuitry that performs floating point operations. In some examples, the AL circuitry 816 may be referred to as an Arithmetic Logic Unit (ALU). The registers 818 are semiconductor-based structures to store data and/or instructions such as results of one or more of the operations performed by the AL circuitry 816 of the corresponding core 802. For example, the registers 818 may include vector register(s), SIMD register(s), general purpose register(s), flag register(s), segment register(s), machine specific register(s), instruction pointer register(s), control register(s), debug register(s), memory management register(s), machine check register(s), etc. The registers 818 may be arranged in a bank as shown in
Each core 802 and/or, more generally, the microprocessor 800 may include additional and/or alternate structures to those shown and described above. For example, one or more clock circuits, one or more power supplies, one or more power gates, one or more cache home agents (CHAs), one or more converged/common mesh stops (CMSs), one or more shifters (e.g., barrel shifter(s)) and/or other circuitry may be present. The microprocessor 800 is a semiconductor device fabricated to include many transistors interconnected to implement the structures described above in one or more integrated circuits (ICs) contained in one or more packages. The processor circuitry may include and/or cooperate with one or more accelerators. In some examples, accelerators are implemented by logic circuitry to perform certain tasks more quickly and/or efficiently than can be done by a general purpose processor. Examples of accelerators include ASICs and FPGAs such as those discussed herein. A GPU or other programmable device can also be an accelerator. Accelerators may be on-board the processor circuitry, in the same chip package as the processor circuitry and/or in one or more separate packages from the processor circuitry.
More specifically, in contrast to the microprocessor circuitry 800 of
In the example of
The interconnections 910 of the illustrated example are conductive pathways, traces, vias, or the like that may include electrically controllable switches (e.g., transistors) whose state can be changed by programming (e.g., using an HDL instruction language) to activate or deactivate one or more connections between one or more of the logic gate circuitry 908 to program desired logic circuits.
The storage circuitry 912 of the illustrated example is structured to store result(s) of the one or more of the operations performed by corresponding logic gates. The storage circuitry 912 may be implemented by registers or the like. In the illustrated example, the storage circuitry 912 is distributed amongst the logic gate circuitry 908 to facilitate access and increase execution speed.
The example FPGA circuitry 900 of
Although
In some examples, the processor circuitry 912 of
A block diagram illustrating an example software distribution platform 1005 to distribute software such as the example machine readable instructions 732 of
From the foregoing, it will be appreciated that example systems, methods, apparatus, and articles of manufacture have been disclosed that enable development of accurate trained models that can facilitate program synthesis. As a result, examples disclosed herein can improve the results (e.g., programs) generated via program synthesis. Examples disclosed herein can also facilitate improved operation of GA program generation by providing a selection of candidate programs with relatively higher fitness. The disclosed systems, methods, apparatus, and articles of manufacture improve the efficiency of using a computing device by enabling quicker and potentially processor-efficient development of trained models with a relatively high degree of accuracy by enabling more efficient determination and/or evaluation of results from program synthesis implementations. The disclosed systems, methods, apparatus, and articles of manufacture are accordingly directed to one or more improvement(s) in the operation of a machine such as a computer or other electronic and/or mechanical device.
Example methods, apparatus, systems, and articles of manufacture to train models for program synthesis are disclosed herein. Further examples and combinations thereof include the following:
Example 1 includes an apparatus comprising at least one memory, instructions, and processor circuitry to execute the instructions to sample pairs of programs, the pairs of programs including first programs and second programs, the first programs including natural language descriptions, calculate program similarity scores corresponding to the pairs of programs, and train a model based on entries corresponding to ones of the pairs of programs, at least one of the entries including a corresponding one of the natural language descriptions with a paired one of the second programs, and a corresponding one of the program similarity scores.
Example 2 includes the apparatus as defined in example 1, wherein the entries further include a corresponding one of the first programs paired with the one of the second programs.
Example 3 includes the apparatus as defined in example 1, wherein the processor circuitry is to execute the instructions to generate the second programs with a genetic algorithm.
Example 4 includes the apparatus as defined in example 1, wherein the processor circuitry is to execute the instructions to train the model further based on at least one of an input or an output associated with the input.
Example 5 includes the apparatus as defined in example 4, wherein the ones of the entries further include the input and the output, the output generated by providing the input to one of at least one of the first or second programs.
Example 6 includes the apparatus as defined in example 1, wherein the processor circuitry is to execute the instructions to filter the pairs of programs.
Example 7 includes the apparatus as defined in example 6, wherein the processor circuitry is to execute the instructions to filter the pairs of programs by removing ones of the pairs of programs that have predominant scores.
Example 8 includes the apparatus as defined in example 1, wherein the processor circuitry is to execute the instructions to calculate the program similarity scores via a code semantics similarity algorithm.
Example 9 includes the apparatus as defined in example 1, wherein the processor circuitry is to execute the instructions to train the model with a long-short-term memory (LSTM) neural network.
Example 10 includes the apparatus as defined in example 9, wherein the LSTM neural network is a bi-directional LSTM training network.
Example 11 includes a non-transitory computer readable medium comprising instructions, which when executed, cause at least one processor to sample pairs of programs, the pairs of programs including first programs and second programs, the first programs including natural language descriptions, calculate program similarity scores corresponding to the pairs of programs, and train a model based on entries corresponding to ones of the pairs of programs, at least one of the entries including a corresponding one of the natural language descriptions with a paired one of the second programs, and a corresponding one of the program similarity scores.
Example 12 includes the computer readable medium as defined in example 11, wherein ones of the entries further include a corresponding one of the first programs paired with the one of the second programs.
Example 13 includes the computer readable medium as defined in example 11, wherein the instructions cause the at least one processor to generate the second programs with a genetic algorithm.
Example 14 includes the computer readable medium as defined in example 11, wherein the instructions cause the at least one processor to train the model further based on at least one of an input or an output associated with the input.
Example 15 includes the computer readable medium as defined in example 14, wherein the ones of the entries further include the input and the output, the output generated by providing the input to one of at least one of the first or second programs.
Example 16 includes the computer readable medium as defined in example 11, wherein the instructions cause the at least one processor to filter the pairs of programs.
Example 17 includes the computer readable medium as defined in example 16, wherein the pairs of programs are filtered by removing ones of the pairs of programs that have predominant scores.
Example 18 includes the computer readable medium as defined in example 11, wherein the instructions cause the at least one processor to calculate the program similarity scores via a code semantics similarity algorithm.
Example 19 includes the computer readable medium as defined in example 11, wherein the instructions cause the at least one processor to train the model with a long-short-term memory (LSTM) neural network.
Example 20 includes the computer readable medium as defined in example 19, wherein the LSTM neural network is a bi-directional LSTM neural network.
Example 21 includes a method comprising sampling, by executing instructions with at least one processor, pairs of programs, the pairs of programs including first programs and second programs, the first programs including natural language descriptions, calculating, by executing instructions with the at least one processor, program similarity scores corresponding to the pairs of programs, and training, by executing instructions with the at least one processor, a model based on entries corresponding to ones of the pairs of programs, at least one of the entries including a corresponding one of the natural language descriptions with a paired one of the second programs, and a corresponding one of the program similarity scores.
Example 22 includes the method as defined in example 21, wherein ones of the entries further include a corresponding one of the first programs paired with the one of the second programs.
Example 23 includes the method as defined in example 21, further including generating, by executing instructions with the at least one processor, the second programs with a genetic algorithm.
Example 24 includes the method as defined in example 21, wherein the model is further trained based on at least one of an input or an output associated with the input.
Example 25 includes the method as defined in example 24, wherein the ones of the entries further include the input and the output, the output generated by providing the input to one of at least one of the first or second programs.
Example 26 includes the method as defined in example 21, further including filtering, by executing instructions with the at least one processor, the pairs of programs.
Example 27 includes the method as defined in example 26, wherein the pairs of programs are filtered by removing ones of the pairs of programs that have predominant scores.
Example 28 includes the method as defined in example 21, further including calculating, by executing instructions with the at least one processor, the program similarity scores via a code semantics similarity algorithm.
Although certain example systems, methods, apparatus, and articles of manufacture have been disclosed herein, the scope of coverage of this patent is not limited thereto. On the contrary, this patent covers all systems, methods, apparatus, and articles of manufacture fairly falling within the scope of the claims of this patent.
The following claims are hereby incorporated into this Detailed Description by this reference, with each claim standing on its own as a separate embodiment of the present disclosure.