Electronic device and control method thereof
Patent Information
- Application Number
- PCT/KR2024/012011
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-07
- Filing Date
- 2024-08-12
- Publication Date
- 2025-03-13
Smart Images

Figure KR2024012011_13032025_PF_FP_ABST
Abstract
Description
Electronic device and method of controlling the same
[0001] The present disclosure relates to an electronic device and a control method thereof, and more particularly, to an electronic device that generates code according to a user command and a control method thereof.
[0002] Code generation models exist that generate code in a specific computer language based on user commands. These models can automatically generate the code requested by the user using a user-specified or preset computer language.
[0003] The code-generating model can be an artificial intelligence model, and the final code-generating model can be determined through a learning process. Training data may be required during the AI model's learning process.
[0004] The higher the quality of the training data, the more accurate the AI model being trained. Training a code generation model requires access to error-free code data, but collecting a diverse range of error-free code data presents a challenge.
[0005] In order to generate standardized code, training data must be standardized, but there is a problem that it is difficult to standardize various code data.
[0006] The present disclosure is designed to improve the above-described problem, and the purpose of the present disclosure is to provide an electronic device and a control method thereof that utilize preprocessed learning data in the learning process of a code generation model.
[0007] According to an embodiment, an electronic device including a code generation model includes a memory storing at least one instruction, and at least one processor connected to the memory and controlling the electronic device, wherein the at least one processor obtains a user command for learning the code generation model, obtains a source code corresponding to the code learning command, divides the source code into preset units to obtain a first code block and a second code block, obtains first error message information including at least one detailed error message related to the first code block and second error message information including at least one detailed error message related to the second code block, obtains a first test score corresponding to the first error message information and a second test score corresponding to the second error message information, determines a sampling block among the first code block and the second code block based on the first test score and the second test score, and learns the code generation model using the sampling block.
[0008] The at least one processor obtains the first code block and the second code block by accumulating the source code in the preset units, and the size of the first code block may be smaller than the size of the second code block.
[0009] The above preset unit may be a function unit declared in the above source code.
[0010] The at least one processor can identify a message type of each of the at least one detailed error message included in the first error message information and the second error message information, and obtain the first inspection score and the second inspection score based on a reference score corresponding to the identified message type.
[0011] The at least one processor can identify the message type of each of the at least one detailed error message included in the first error message information and the second error message information, and obtain the first inspection score and the second inspection score based on the message type-specific ratio information and the message type-specific weight information.
[0012] The at least one processor may determine a code block corresponding to a test score greater than or equal to a threshold value among the first test score and the second test score as the sampling block.
[0013] The at least one processor may obtain a first token number corresponding to the first code block, obtain a second token number corresponding to the second code block, and if the first token number is less than a threshold number and the second token number is less than the threshold number, determine the first code block and the second code block as the sampling block, and if the first token number is less than the threshold number and the second token number is not less than the threshold number, determine the first code block as the sampling block.
[0014] The at least one processor can obtain preprocessed code information including the sampling block, and obtain result code information by inputting the preprocessed code information as input data into the code generation model.
[0015] The above-described preset unit is a first unit, and the at least one processor can obtain a third code block and a fourth code block by accumulating the result code information as a second unit, obtain a third test score corresponding to the third code block and a fourth test score corresponding to the fourth code block, and obtain an average test score of the third test score and the fourth test score.
[0016] The at least one processor may change parameters of the code generation model by performing a reinforcement learning function based on the average test score, and update the code generation model based on the changed parameters.
[0017] According to one embodiment, a method for controlling an electronic device including a code generation model includes the steps of: obtaining a user command for learning the code generation model; obtaining a source code corresponding to the code learning command; dividing the source code into preset units to obtain a first code block and a second code block; obtaining first error message information including at least one detailed error message related to the first code block and second error message information including at least one detailed error message related to the second code block; obtaining a first test score corresponding to the first error message information and a second test score corresponding to the second error message information; determining a sampling block among the first code block and the second code block based on the first test score and the second test score; and learning the code generation model using the sampling block.
[0018] The step of obtaining the first code block and the second code block may obtain the first code block and the second code block by accumulating the source code in the preset units, and the size of the first code block may be smaller than the size of the second code block.
[0019] The above preset unit may be a function unit declared in the above source code.
[0020] The step of obtaining the first test score and the second test score may include identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, and obtaining the first test score and the second test score based on a reference score corresponding to the identified message type.
[0021] The step of obtaining the first test score and the second test score may include identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, and obtaining the first test score and the second test score based on the message type-specific ratio information and the message type-specific weight information.
[0022] The step of determining the sampling block may determine a code block corresponding to a test score greater than or equal to a threshold value among the first test score and the second test score as the sampling block.
[0023] The step of determining the sampling block may include obtaining a first token number corresponding to the first code block, obtaining a second token number corresponding to the second code block, and if the first token number is less than a threshold number and the second token number is less than the threshold number, determining the first code block and the second code block as the sampling block, and if the first token number is less than the threshold number and the second token number is not less than the threshold number, determining the first code block as the sampling block.
[0024] The step of learning the above code generation model can obtain preprocessed code information including the sampling block, and obtain result code information by inputting the preprocessed code information as input data into the code generation model.
[0025] The above-described preset unit is a first unit, and the step of learning the code generation model may obtain a third code block and a fourth code block by accumulating the result code information as a second unit, obtain a third test score corresponding to the third code block and a fourth test score corresponding to the fourth code block, and obtain an average test score of the third test score and the fourth test score.
[0026] The step of learning the above code generation model may change the parameters of the code generation model by performing a reinforcement learning function based on the average test score, and update the code generation model based on the changed parameters.
[0027] FIG. 1 is a diagram for explaining a code generation model according to one embodiment.
[0028] FIG. 2 is a block diagram illustrating an electronic device according to one embodiment.
[0029] FIG. 3 is a diagram illustrating an operation of learning a code generation model according to one embodiment.
[0030] FIG. 4 is a diagram for explaining an operation of preprocessing learning data according to one embodiment.
[0031] FIG. 5 is a diagram illustrating an operation for obtaining a test score according to one embodiment.
[0032] FIG. 6 is a diagram for explaining an operation of obtaining a code block according to one embodiment.
[0033] FIG. 7 is a diagram for explaining an operation of calculating a test score for each code block, according to one embodiment.
[0034] FIG. 8 is a diagram for explaining an operation of calculating a test score for each code block, according to one embodiment.
[0035] FIG. 9 is a diagram illustrating a table showing scores corresponding to message types, according to one embodiment.
[0036] FIG. 10 is a diagram for explaining an operation of calculating an inspection score based on a score corresponding to a message type, according to one embodiment.
[0037] FIG. 11 is a diagram illustrating an operation of obtaining a test score using ratio information according to one embodiment.
[0038] FIG. 12 is a diagram for explaining an operation of obtaining a test score using ratio information according to one embodiment.
[0039] FIG. 13 is a diagram for explaining a sampling operation using a test score according to one embodiment.
[0040] FIG. 14 is a diagram for explaining a sampling operation using the number of tokens according to one embodiment.
[0041] FIG. 15 is a diagram illustrating an operation of learning a code generation model according to one embodiment.
[0042] FIG. 16 is a diagram for explaining an error message according to one embodiment.
[0043] FIG. 17 is a diagram for explaining result code information according to one embodiment.
[0044] FIG. 18 is a diagram illustrating an operation of obtaining result code information using a prompt, according to one embodiment.
[0045] FIG. 19 is a diagram for explaining an operation of setting code blocks line by line according to one embodiment.
[0046] FIG. 20 is a drawing for explaining a control method of an electronic device according to an embodiment of the present invention.
[0047] Hereinafter, the present disclosure will be described in detail with reference to the attached drawings.
[0048] The terms used in the embodiments of this disclosure have been selected from widely used, current terms, taking into account the functions of this disclosure. However, these terms may vary depending on the intentions of those skilled in the art, precedents, the emergence of new technologies, etc. Furthermore, in certain cases, terms may be arbitrarily selected by the applicant, and in such cases, their meanings will be described in detail in the description of the relevant disclosure. Therefore, the terms used in this disclosure should not be defined simply as names of terms, but rather based on the meanings of the terms and the overall content of this disclosure.
[0049] In this specification, expressions such as “has,” “can have,” “includes,” or “may include” indicate the presence of a feature (e.g., a number, function, operation, or component such as a part), and do not exclude the presence of additional features.
[0050] The expression "at least one of A and / or B" should be understood to mean either "A" or "B" or "A and B".
[0051] As used herein, the expressions “first,” “second,” “first,” or “second,” etc., may describe various components, regardless of order and / or importance, and are only used to distinguish one component from another, but do not limit the components.
[0052] When it is said that a component (e.g., a first component) is “(operatively or communicatively) coupled with / to” or “connected to” another component (e.g., a second component), it should be understood that the component may be directly coupled to the other component, or may be connected through another component (e.g., a third component).
[0053] Singular expressions include plural expressions unless the context clearly dictates otherwise. In this application, terms such as "comprise" or "consist of" are intended to indicate the presence of a feature, number, step, operation, component, part, or combination thereof described in the specification, but should be understood not to preclude the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.
[0054] In the present disclosure, a "module" or "part" performs at least one function or operation and may be implemented as hardware or software, or as a combination of hardware and software. Furthermore, multiple "modules" or multiple "parts" may be integrated into at least one module and implemented as at least one processor (not shown), excluding any "modules" or "parts" that need to be implemented as specific hardware.
[0055] In this specification, the term user may refer to a person using an electronic device or a device using an electronic device (e.g., an artificial intelligence electronic device).
[0056] An embodiment of the present disclosure will be described in more detail with reference to the attached drawings below.
[0057] In the present disclosure, learning an artificial intelligence model means that a basic artificial intelligence model (e.g., an artificial intelligence model including any random parameters) is learned using a plurality of training data by a learning algorithm, thereby creating a predefined operation rule or artificial intelligence model set to perform a desired characteristic (or purpose). Such learning may be performed through a separate server and / or system, but is not limited thereto, and may also be performed in the electronic device (100). Examples of learning algorithms include, but are not limited to, supervised learning, unsupervised learning, semi-supervised learning, transfer learning, or reinforcement learning.
[0058] Here, each artificial intelligence model can be implemented as, for example, a Convolutional Neural Network (CNN), a Recurrent Neural Network (RNN), a Restricted Boltzmann Machine (RBM), a Deep Belief Network (DBN), a Bidirectional Recurrent Deep Neural Network (BRDNN), or a Deep Q-Network, but is not limited thereto.
[0059] At least one processor (120) for executing an artificial intelligence model according to an embodiment of the present disclosure may be implemented through a combination of software and a general-purpose processor such as a CPU, an AP, a DSP (Digital Signal Processor), a graphics-only processor such as a GPU, a VPU (Vision Processing Unit), or an artificial intelligence-only processor such as an NPU. The at least one processor (120) may be controlled to process input data according to predefined operation rules or an artificial intelligence model stored in the memory (110). Alternatively, if the at least one processor (120) is a dedicated processor (or an artificial intelligence-only processor), it may be designed as a hardware structure specialized for processing a specific artificial intelligence model. For example, hardware specialized for processing a specific artificial intelligence model may be designed as a hardware chip such as an ASIC or an FPGA. If the at least one processor (120) is implemented as a dedicated processor, it may be implemented to include a memory for implementing an embodiment of the present disclosure, or it may be implemented to include a memory processing function for utilizing an external memory.
[0060] In another example, the memory (110) may store information regarding an artificial intelligence model including a plurality of layers. Here, storing information regarding the artificial intelligence model may mean storing various information related to the operation of the artificial intelligence model, such as information regarding the plurality of layers included in the artificial intelligence model, information regarding parameters (e.g., filter coefficients, biases, etc.) used in each of the plurality of layers, etc.
[0061] FIG. 1 is a diagram for explaining a code generation model according to one embodiment.
[0062] The electronic device (100) may include a code generation model (150). The code generation model (150) may include a model that generates supplemented code based on input data. The code generation model (150) may include a model that analyzes code information contained in the input data to generate error-free code. The code generation model (150) may include a model that generates code that implements the input data.
[0063] The code generation model (150) may include an artificial intelligence model that generates code. The code generation model (150) may include a model that generates code information using a programming language based on information included in input data.
[0064] For example, a programming language may include one of Python, JavaScript, Java, C++, or C#.
[0065] For example, the code generation model (150) can generate code information using a programming language included in the input data. The user can determine which programming language to use to generate the code information. For example, assume that at least one processor (120) has received input data containing a user input indicating “Generate code for performing arithmetic operations using Python.” At least one processor (120) can identify whether the input data includes a programming language. At least one processor (120) can identify a programming language in the input data and generate code information using the identified programming language.
[0066] For example, the code generation model (150) can generate code information in a preset language. The preset language may be a language set by the user. The code generation model (150) may have a unique programming language set. The code generation model (150) can generate code information corresponding to input data using the preset language. The preset language may be changed according to the user's settings. The preset language may be different for each code generation model (150). For example, the first code generation model may be a model using the first language, and the second code generation model may be a model using the second language.
[0067] Referring to the embodiment (10) of FIG. 1, the code generation model (150) assumes a learned model without using standardized learning data. The electronic device (100) can input input data (11) into the code generation model (150). The code generation model (150) can obtain output data (12) corresponding to the input data (11). The input data (11) may include an incomplete code that obtains a key value from a database (DB). The output data (12) may include a completed code (or a supplemented code) that obtains a key value from the database (DB).
[0068] Referring to the embodiment (10) of FIG. 1, the code generation model (150) assumes a model trained using standardized learning data. The electronic device (100) can input input data (21) into the code generation model (150). The code generation model (150) can obtain output data (22) corresponding to the input data (21). The input data (21) can include incomplete code that obtains a key value from a database (DB). The output data (22) can include complete code (or supplemented code) that obtains a key value from the database (DB).
[0069] The output data (22) may include codes (“except Exception as e:”, “print("Error", e)”) that are not included in the output data (12). Using standardized training data may increase the likelihood of generating supplemented codes that cause minimal errors.
[0070] FIG. 2 is a block diagram illustrating an electronic device according to one embodiment.
[0071] Referring to FIG. 2, the electronic device (100) may include a memory (110) and at least one processor (120).
[0072] The memory (110) may be implemented as an internal memory such as a ROM (e.g., an electrically erasable programmable read-only memory (EEPROM)) or a RAM included in at least one processor (120), or may be implemented as a separate memory from at least one processor (120). In this case, the memory (110) may be implemented as a memory embedded in the electronic device (100) or as a memory detachable from the electronic device (100) depending on the purpose of data storage. For example, data for driving the electronic device (100) may be stored in a memory embedded in the electronic device (100), and data for expanding functions of the electronic device (100) may be stored in a memory detachable from the electronic device (100).
[0073] The memory (110) can store at least one instruction. The memory (110) can store the message type table (910) of FIG. 9. The memory (110) can store a code generation model (150).
[0074] At least one processor (120) can be connected to a memory (110) to control the electronic device (100).
[0075] At least one processor (120) can perform overall control operations of the electronic device (100). Specifically, at least one processor (120) has a function of controlling overall operations of the electronic device (100).
[0076] At least one processor (120) may be implemented as a digital signal processor (DSP), a microprocessor, or a time controller (TCON) that processes digital signals. However, the present invention is not limited thereto, and may include one or more of a central processing unit (CPU), a micro controller unit (MCU), a micro processing unit (MPU), a controller, an application processor (AP), a graphics-processing unit (GPU), a communication processor (CP), or an advanced reduced instruction set computer (RISC) machines (ARM) processor, or may be defined by the relevant terms. In addition, at least one processor (120) may be implemented as a system on chip (SoC) having a built-in processing algorithm, a large scale integration (LSI), or may be implemented in the form of a field programmable gate array (FPGA). In addition, at least one processor (120) may perform various functions by executing computer executable instructions stored in a memory.
[0077] At least one processor (120) obtains a user command for learning a code generation model (150), obtains a source code corresponding to the code learning command, divides the source code into preset units to obtain a first code block and a second code block, obtains first error message information including at least one detailed error message related to the first code block and second error message information including at least one detailed error message related to the second code block, obtains a first test score corresponding to the first error message information and a second test score corresponding to the second error message information, determines a sampling block among the first code block and the second code block based on the first test score and the second test score, and learns the code generation model (150) using the sampling block.
[0078] At least one processor (120) may acquire (or receive) a user command for training a code generation model (150). The user command may include a user input for training the code generation model (150).
[0079] When a code learning command is obtained, at least one processor (120) can obtain source code corresponding to the code learning command.
[0080] For example, at least one processor (120) can obtain source code including various candidate learning data according to a code learning instruction.
[0081] For example, at least one processor (120) may obtain source code corresponding to a code learning command according to the code learning command. The code learning command may include information related to learning. For example, the information related to learning may include a learning direction or learning category.
[0082] At least one processor (120) can obtain source code using a source code database (140). At least one processor (120) can request the source code from the source code database (140) according to a code learning command. The source code database (140) can transmit the source code to the electronic device (100) in response to the request. At least one processor (120) can receive the source code from the source code database (140).
[0083] The source code may include code information to be used as training data. The source code may include raw data. At least one processor (120) may train a code generation model (150) using multiple source codes.
[0084] At least one processor (120) may utilize multiple source codes to perform the learning function.
[0085] At least one processor (120) can divide (or segment) the source code into preset units. At least one processor (120) can perform a preprocessing function on the source code to utilize standardized training data. The preprocessing function may include an operation to reduce the size of the source code. Reducing the size of the source code can enable it to be used as efficient training data.
[0086] At least one processor (120) can divide the source code into a plurality of code blocks based on preset units.
[0087] According to one embodiment, the preset unit may be a function unit declared in the source code. The source code may include multiple functions. At least one processor (120) may divide the source code into function units. A description related to this is described in FIG. 6. The function unit may be described as the first unit.
[0088] At least one processor (120) can divide the source code into multiple code blocks based on the line (or location) where a function is declared in the source code.
[0089] According to one embodiment, the preset unit may be a line (line) of source code. At least one processor (120) may divide the source code based on the line of source code. A description related to this is described in FIG. 19. The line unit may be described as a second unit.
[0090] At least one processor (120) may divide the source code into a first code block and a second code block based on preset units. At least one processor (120) may first obtain the first code block in chronological order, and then obtain the second code block.
[0091] At least one processor (120) can perform a division operation cumulatively. At least one processor (120) can divide source code and accumulate the code to obtain a code block.
[0092] At least one processor (120) acquires a first code block and a second code block by accumulating source codes in preset units, and the size of the first code block may be smaller than the size of the second code block.
[0093] Assume that at least one processor (120) divides a source code including 48 lines. At least one processor (120) can divide the code of lines 1-19 into a first code block. At least one processor (120) can divide the code of lines 1-25 into a second code block. The second code block can include the code included in the first code block. At least one processor (120) can divide the source code such that the previously divided code is included.
[0094] At least one processor (120) can analyze the first code block to obtain at least one detailed error message. At least one processor (120) can analyze the second code block to obtain at least one detailed error message.
[0095] At least one processor (120) can compile (or inspect) a code block to obtain a detailed error message. The detailed error message may be described as detailed error information.
[0096] A detailed error message may be a message indicating the result of checking for errors in a code block. At least one processor (120) may analyze whether a code block contains an error. At least one processor (120) may perform error checking only on the code included in the code block, not the entire source code. At least one processor (120) may generate an error message through error checking. At least one processor (120) may perform error checking on each code block to obtain an error message. One obtained error message may be described as a detailed error message. At least one processor (120) may obtain multiple detailed error messages from one code block.
[0097] At least one processor (120) may obtain first error message information including at least one detailed error message obtained from the first code block. The first error message information may include at least one detailed error message corresponding to the first code block.
[0098] At least one processor (120) may obtain second error message information including at least one detailed error message obtained from the second code block. The second error message information may include at least one detailed error message corresponding to the second code block.
[0099] At least one processor (120) can obtain (or calculate) a first test score corresponding to the first error message information. At least one processor (120) can obtain (or calculate) a second test score corresponding to the second error message information.
[0100] At least one processor (120) may obtain a test score using a preset method. The test score may be a score indicating the likelihood of an error in a code block. A higher test score may be judged to lower the likelihood of an error.
[0101] The preset method may include at least one of a method of obtaining a test score using a basic score corresponding to a message type (first method) or a method of obtaining a test score using ratio information (second method).
[0102] At least one processor (120) may calculate a first test score based on at least one detailed error message included in the first error message information. At least one processor (120) may calculate a second test score based on at least one detailed error message included in the second error message information.
[0103] At least one processor (120) can identify the message type of each of at least one detailed error message included in the first error message information and the second error message information, and obtain a first test score and a second test score based on a reference score corresponding to the identified message type. A detailed description thereof is provided in FIGS. 9 and 10 .
[0104] At least one processor (120) can identify a message type corresponding to each of at least one detailed error message included in the first error message information. For example, it is assumed that the first error message information includes a first detailed error message and a second detailed error message. At least one processor (120) can identify a message type of the first detailed error message and a message type of the second detailed error message. At least one processor (120) can obtain a basic score (first score) corresponding to the message type of the first detailed error message and a basic score (second score) corresponding to the message type of the second detailed error message using the message type table (910) of FIG. 9. At least one processor (120) can obtain a first test score of the first error message information based on an average of the first score and the second score. The method of obtaining the second test score may also be the same.
[0105] At least one processor (120) can identify the message type of each of at least one detailed error message included in the first error message information and the second error message information, and obtain a first inspection score and a second inspection score based on the message type-specific ratio information and the message type-specific weight information. A detailed description thereof is provided in FIG. 13.
[0106] At least one processor (120) can determine a code block corresponding to an inspection score greater than or equal to a threshold value among the first inspection score and the second inspection score as a sampling block.
[0107] At least one processor (120) may determine (or acquire or identify) a sampling block based on a test score. The sampling block may refer to selective learning data used in the learning process of the code generation model (150). At least one processor (120) may selectively determine a sampling block from among a plurality of segmented code blocks. The sampling block may include at least one block from among the plurality of segmented code blocks.
[0108] A sampling block can be described as a filtering block, a learning block, a preprocessing block, etc.
[0109] For example, at least one processor (120) can determine all code blocks among the divided plurality of code blocks as sampling blocks.
[0110] For example, at least one processor (120) may determine only some of the divided code blocks as sampling blocks.
[0111] For example, at least one processor (120) may not determine any block among the multiple divided code blocks as a sampling block. At least one processor (120) may not use the entire source code in the learning process of the code generation model (150).
[0112] At least one processor (120) may obtain a first token count corresponding to a first code block, obtain a second token count corresponding to a second code block, and if the first token count is less than a threshold count and the second token count is less than a threshold count, determine the first code block and the second code block as sampling blocks, and if the first token count is less than a threshold count and the second token count is not less than a threshold count, determine the first code block as a sampling block. A specific description related thereto is described in FIG. 14.
[0113] At least one processor (120) can obtain preprocessed code information including a sampling block and input the preprocessed code information as input data into a code generation model (150) to obtain result code information.
[0114] Preprocessed code information may include sampling blocks. At least one processor (120) may perform a preprocessing function to obtain preprocessed code information. At least one processor (120) may change the data format to use the determined sampling block in the learning process of the code generation model (150). At least one processor (120) may obtain preprocessed code information by converting (or processing) the sampling block based on a preset format.
[0115] According to various implementation examples, at least one processor (120) can use the sampling block itself in the learning process of the code generation model (150) without changing the data format.
[0116] At least one processor (120) can input preprocessed code information into a code generation model (150). At least one processor (120) can obtain result code information corresponding to the preprocessed code information through the code generation model (150).
[0117] The resulting code information may include supplementary code generated by the code generation model (150).
[0118] The supplementary code may include at least one of code for correcting errors present in the preprocessed code information, code for reducing the possibility of errors present in the preprocessed code information, and code for increasing efficiency in the preprocessed code information.
[0119] Supplementary code may be described as correction code, additional code, generation code, change code, enhancement code, or strengthened code.
[0120] Descriptions related to the result code information including the supplementary code are described in FIGS. 15 and 17.
[0121] At least one processor (120) can divide the source code into a plurality of code blocks based on a preset unit (first unit).
[0122] At least one processor (120) can obtain a third code block and a fourth code block by accumulating result code information in a second unit rather than a first unit, obtain a third test score corresponding to the third code block and a fourth test score corresponding to the fourth code block, and obtain an average test score of the third test score and the fourth test score.
[0123] The first unit may be a function unit and the second unit may be a line unit. A description thereof is provided in Fig. 19.
[0124] At least one processor (120) can change parameters of a code generation model (150) by performing a reinforcement learning function based on an average test score, and update the code generation model (150) based on the changed parameters.
[0125] The reinforcement learning function may include an action of repeatedly updating parameters associated with the code generation model (150). A description thereof is provided in FIGS. 3 and 15 .
[0126] FIG. 3 is a diagram illustrating an operation of learning a code generation model according to one embodiment.
[0127] Referring to FIG. 3, the electronic device (100) can learn a code generation model (150) through a code generation network (300). The code generation network (300) can include at least one of a preprocessing module (130), a source code database (140), a code generation model (150), a source code database (140), and a reinforcement learning module (170).
[0128] The electronic device (100) can obtain a learning command. The learning command can be included in a user input.
[0129] The preprocessing module (130) may include a module that divides source code and converts it into standardized training data. The standardized training data may include data from which unnecessary portions of the source code have been removed. The preprocessing module (130) may obtain training commands. Based on the training commands, the preprocessing module (130) may request the source code from the source code database (140).
[0130] The source code database (140) may include a plurality of source codes. The source code database (140) may include a plurality of source codes classified according to a specific category. The source code database (140) may provide source code corresponding to the request using information included in a source code request. The source code may include at least one of complete code, incomplete code, or code containing errors. The source code database (140) may receive a source code request from the preprocessing module (130). The source code request may include information indicating a learning command. The source code database (140) may identify a source code corresponding to the source code request. The source code database (140) may transmit the identified source code to the preprocessing module (130).
[0131] The preprocessing module (130) can receive source code from the source code database (140). The preprocessing module (130) can obtain preprocessed code information based on the source code. The preprocessing module (130) can perform a preprocessing function to divide the source code into a plurality of code blocks. The preprocessing module (130) can obtain preprocessed code information using only sampled code blocks among the plurality of code blocks. The preprocessing module (130) can transmit the preprocessed code information to the code generation model (150).
[0132] The code generation model (150) may be a model that provides completed (or supplemented) code corresponding to input data. The input data may include at least one of incomplete code or information indicating incomplete code. The code generation model (150) may receive preprocessed code information from the preprocessing module (130). The code generation model (150) may generate result code information using the preprocessed code information. The code generation model (150) may use the preprocessed code information as input data to obtain result code information as output data. The result code information may include a code that supplements the preprocessed code information. The code generation model (150) may transmit the result code information to the code analysis module (160).
[0133] The code analysis module (160) may include a module that analyzes and scores code. The scoring operation may include an operation of calculating a score indicating the likelihood of an error occurring. The code analysis module (160) may receive result code information from the code generation model (150). The code analysis module (160) may obtain an inspection score of the result code information. The code analysis module (160) may transmit the inspection score of the result code information to the reinforcement learning module (170).
[0134] The reinforcement learning module (170) may include a module for changing parameters to repeatedly perform learning operations related to the code generation model (150). The reinforcement learning module (170) may receive an inspection score of the result code information from the code analysis module (160). The reinforcement learning module (170) may determine whether to change at least one parameter included in the code generation model (150) based on the inspection score. The reinforcement learning module (170) may change at least one parameter based on the inspection score and transmit the changed parameter to the code generation model (150).
[0135] The code generation model (150) can receive changed parameters from the reinforcement learning module (170). The code generation model (150) can be updated using the changed parameters. The code generation model (150) can regenerate result code information corresponding to the preprocessed code information based on the changed parameters. Thereafter, the electronic device (100) can repeat the update process using the code analysis module (160) and the reinforcement learning module (170).
[0136] FIG. 4 is a diagram for explaining an operation of preprocessing learning data according to one embodiment.
[0137] Referring to FIG. 4, the preprocessing module (130) may include at least one of a source code acquisition module (131), a code segmentation module (132), an error message extraction module (133), an error message scoring module (134), a sampling module (135), and a learning data acquisition module (136).
[0138] The source code acquisition module (131) may include a module for acquiring source code from a source code database (140). The source code acquisition module (131) may transmit a source code request to the source code database (140) based on a received learning command. The source code acquisition module (131) may receive source code corresponding to the request from the source code database (140). The source code acquisition module (131) may transmit the received source code to the code division module (132).
[0139] The code splitting module (132) may include a module that splits the source code according to preset criteria. The preset criteria may be either function units or line units. The code splitting module (132) may split the source code into multiple code blocks according to the preset criteria. The code splitting module (132) may split the code blocks by accumulating them. A description thereof is provided in FIG. 6. The code splitting module (132) may transmit the split code blocks to the error message extraction module (133).
[0140] The error message extraction module (133) may include a module that generates error message information indicating an error that may occur in a code block. The error message extraction module (133) may receive segmented code blocks from the code segmentation module (132). The error message extraction module (133) may obtain error message information corresponding to each segmented code block. The error message information may include at least one detailed error message. The detailed error message may include a message indicating an error that occurs in the segmented code block. The error message extraction module (133) may transmit the error message information corresponding to each segmented code block to the error message scoring module (134). The error message extraction module (133) may be described as a first static analysis module.
[0141] The error message scoring module (134) may include a module for calculating a score associated with an error message. The error message scoring module (134) may receive error message information from the error message extraction module (133). The error message scoring module (134) may obtain an inspection score corresponding to each segmented code block. The inspection score may include a score indicating the likelihood of an error occurring. A higher inspection score may indicate a lower likelihood of an error occurring. The error message scoring module (134) may transmit the inspection score corresponding to each segmented code block to the sampling module (135). The error message scoring module (134) may be described as a second static analysis module.
[0142] The sampling module (135) may include a module for selecting some of the plurality of code blocks based on the test scores. The sampling module (135) may sample some of the plurality of code blocks using the test scores. The sampling module (135) may transmit the sampled code blocks to the learning data acquisition module (136). The sampling module (135) may be described as a filtering module.
[0143] The learning data acquisition module (136) may be a module that acquires (or generates) standardized learning data. The learning data acquisition module (136) may acquire code information that includes only sampled code blocks. The code information generated by the learning data acquisition module (136) may be described as preprocessed code information. The learning data acquisition module (136) may transmit the preprocessed code information to the code generation model (150).
[0144] The size of the preprocessed code information acquired by the learning data acquisition module (136) may be smaller than the size of the source code acquired by the source code acquisition module (131). This is because the preprocessed code information only includes sampled code information. The size of the learning data can be reduced through the sampling operation. The error rate of the learning data can be reduced through the sampling operation.
[0145] FIG. 5 is a diagram illustrating an operation for obtaining a test score according to one embodiment.
[0146] Referring to FIG. 5, the electronic device (100) can obtain a learning command (S505). The electronic device (100) can obtain a source code corresponding to the learning command (S510). The electronic device (100) can cumulatively divide the source code into preset units to obtain a first code block and a second code block. The second code block may include the first code block. The preset units may include a criterion for distinguishing codes. The preset units may include at least one of a function unit and a line unit.
[0147] The electronic device (100) can obtain first error message information corresponding to the first code block (S520). The electronic device (100) can obtain a first test score corresponding to the first error message information based on a message type table (S525). The message type table is described in FIG. 9.
[0148] The electronic device (100) can obtain second error message information corresponding to the second code block (S530). The electronic device (100) can obtain a second inspection score corresponding to the second error message information based on the message type table (S535).
[0149] FIG. 6 is a diagram for explaining an operation of obtaining a code block according to one embodiment.
[0150] Referring to FIG. 6, the electronic device (100) can obtain source code. The source code consists of 48 lines of code, and it is assumed that the preset unit is a function unit. The electronic device (100) can accumulate and divide the source code into function units.
[0151] An electronic device (100) can obtain multiple code blocks in function units. The multiple code blocks can include accumulated code blocks.
[0152] The electronic device (100) can obtain a first code block (610) that includes only a first function (flatten). The first code block (610) can include the code of lines 1-19.
[0153] The electronic device (100) may obtain a second code block (620) including a first function (flatten) and a second function (chunks). The second code block (620) may include codes of lines 1-25.
[0154] The electronic device (100) may obtain a third code block (630) including a first function (flatten), a second function (chunks), and a third function (remap_nwo). The third code block (630) may include codes of lines 1-35.
[0155] The electronic device (100) may obtain a fourth code block (640) including a first function (flatten), a second function (chunks), a third function (remap_nwo), and a fourth function (get_sha). The fourth code block (640) may include codes of lines 1-44.
[0156] The electronic device (100) may obtain a fifth code block (650) including a first function (flatten), a second function (chunks), a third function (remap_nwo), a fourth function (get_sha), and a fifth function (download). The fifth code block (650) may include codes of lines 1-48.
[0157] The fifth code block (650) may be identical to the source code. One of the code blocks acquired by the electronic device (100) may be identical to the source code. This is because code blocks are acquired through accumulation.
[0158] FIG. 7 is a diagram for explaining an operation of calculating a test score for each code block, according to one embodiment.
[0159] The first code block (710) of FIG. 7 may correspond to the first code block (610) of FIG. 6. The electronic device (100) may obtain first error message information (720) corresponding to the first code block (710). The electronic device (100) may obtain first error message information (720) corresponding to the first code block (710) using the error message extraction module (133).
[0160] The electronic device (100) can obtain a first test score (730) based on the first error message information (720). The electronic device (100) can obtain a first test score (730) corresponding to the first error message information (720) using the error message scoring module (134).
[0161] FIG. 8 is a diagram for explaining an operation of calculating a test score for each code block, according to one embodiment.
[0162] FIG. 8 is a diagram for explaining an operation of calculating a test score for each code block, according to one embodiment.
[0163] The second code block (810) of FIG. 8 may correspond to the second code block (620) of FIG. 6. The electronic device (100) may obtain second error message information (820) corresponding to the second code block (810). The electronic device (100) may obtain second error message information (820) corresponding to the second code block (810) using the error message extraction module (133).
[0164] The electronic device (100) can obtain a second test score (830) based on the second error message information (820). The electronic device (100) can obtain a second test score (830) corresponding to the second error message information (820) using the error message scoring module (134).
[0165] The second test score (830) may have a higher score than the first test score (730) of FIG. 7. A higher test score may indicate a lower likelihood of errors. The second code block (810) includes the first code block (710). Therefore, errors that occurred in the first code block (710) may not occur in the second code block (810).
[0166] FIG. 9 is a diagram illustrating a table showing scores corresponding to message types, according to one embodiment.
[0167] The message type table (910) of FIG. 9 may include a reference score corresponding to a message type. The message type may include an error message type. The message type may be classified according to user settings. The message type may include at least one of the first type (fatal), the second type (error), the third type (warning), the fourth type (refactor), and the fifth type (convention).
[0168] Type 1 (fatal) may include types that are not statically analyzable. The score corresponding to Type 1 may be 1.
[0169] The second type (error) may include types that contain bugs. The score corresponding to the second type may be 2.
[0170] Type 3 (warning) may include types that contain syntax errors in the programming language. The corresponding score for Type 3 may be 3.
[0171] Type 4 (refactor) may contain types that have compatibility errors. The score corresponding to Type 4 may be 4.
[0172] Type 5 (convention) may include types that contain programming language convention errors. The score corresponding to Type 5 may be 5.
[0173] In Figure 9, it is classified into five types, but it is not necessarily limited to these.
[0174] FIG. 10 is a diagram for explaining an operation of calculating an inspection score based on a score corresponding to a message type, according to one embodiment.
[0175] Referring to FIG. 10, the electronic device (100) can obtain first error message information corresponding to the first code block (S1005). The electronic device (100) can obtain multiple detailed error messages included in the first error message information (S1010).
[0176] The electronic device (100) can identify a message type corresponding to each of a plurality of detailed error messages (S1015). The electronic device (100) can obtain a first inspection score of the first error message information based on a reference score corresponding to the message type (S1020).
[0177] The electronic device (100) can obtain a message type corresponding to each of a plurality of detailed error messages. The electronic device (100) can obtain a score corresponding to each of a plurality of detailed error messages using the message type table (910) of FIG. 9.
[0178] The operation of Fig. 10 can be equally applied to obtain a second test score corresponding to a second code block.
[0179] FIG. 11 is a diagram illustrating an operation of obtaining a test score using ratio information according to one embodiment.
[0180] Table (1110) of FIG. 11 may include information on the number of types of error messages of a specific code block and the ratio by type.
[0181] Assume that there are n1 detailed error messages of the first type, n2 detailed error messages of the second type, n3 detailed error messages of the third type, n4 detailed error messages of the fourth type, and n5 detailed error messages of the fifth type for a specific code block.
[0182] The electronic device (100) can obtain information on the ratio of the number of detailed error messages of each type to the total number of detailed error messages (n_total). n_total may be n1+n2+n3+n4+n5.
[0183] The first type of first ratio information (R1) may be n1 / n_total.
[0184] The second type of second ratio information (R2) may be n2 / n_total.
[0185] The third type of third ratio information (R3) may be n3 / n_total.
[0186] The fourth type of fourth ratio information (R4) may be n4 / n_total.
[0187] The fifth ratio information (R5) of the fifth type may be n5 / n_total.
[0188] The sum of the first ratio information (R1), the second ratio information (R2), the third ratio information (R3), the fourth ratio information (R4), and the fifth ratio information (R5) may be 1.
[0189] Example (1120) may include a formula for obtaining a test score using ratio information. The test score may be obtained by subtracting the overall ratio information (R_total) from 1.
[0190] The comprehensive ratio information (R_total) may be a sum of a first value (R2*w1) obtained by multiplying the second ratio information (R2) and the first weight (w1), a second value (R3*w2) obtained by multiplying the third ratio information (R3) and the second weight (w2), a third value (R4*w3) obtained by multiplying the fourth ratio information (R4) and the third weight (w3), and a fourth value (R5*w4) obtained by multiplying the fifth ratio information (R5) and the fourth weight (w4).
[0191] The first weight (w1) may be a weight corresponding to the second type.
[0192] The second weight (w2) may be a weight corresponding to the third type.
[0193] The third weight (w3) may be a weight corresponding to the fourth type.
[0194] The fourth weight (w4) may be a weight corresponding to the fifth type.
[0195] Example (1130) may represent a condition related to Example (1120). The first weight (w1) may be greater than the second weight (w2), the second weight (w2) may be greater than the third weight (w3), and the third weight (w3) may be greater than the fourth weight (w4).
[0196] The sum of the first weight (w1), the second weight (w2), the third weight (w3), and the fourth weight (w4) can be 1.
[0197] The weight corresponding to Type 1 may not be considered. The electronic device (100) may calculate the test score as 0 because Type 1 contains a fatal error. A description related to this is provided in FIG. 12.
[0198] FIG. 12 is a diagram for explaining an operation of obtaining a test score using ratio information according to one embodiment.
[0199] Referring to FIG. 12, the electronic device (100) can obtain first error message information corresponding to the first code block (S1205). The electronic device (100) can obtain a plurality of detailed error messages included in the first error message information (S1210). The electronic device (100) can identify a message type corresponding to each of the plurality of detailed error messages (S1215).
[0200] The electronic device (100) can determine whether at least one identified message type includes a first type (fatal) detailed error message (S1220).
[0201] If at least one identified message type includes a first type (fatal) detailed error message (S1220-Y), the electronic device (100) may exclude the first code block from the sampling target (S1225). The electronic device (100) may determine that the first type detailed error message is a fatal error message and therefore is not a standardized code. The electronic device (100) may not use the first code block as training data.
[0202] If at least one identified message type does not include a first type (fatal) detailed error message (S1220-N), the electronic device (100) can obtain type-specific ratio information (S1230). The type-specific ratio information can include the first ratio information (R1), the second ratio information (R2), the third ratio information (R3), the fourth ratio information (R4), and the fifth ratio information (R5) of FIG. 11.
[0203] The electronic device (100) can obtain an inspection score based on type-specific ratio information and type-specific weight information (S1235). The type-specific weight information can include a first weight (w1), a second weight (w2), a third weight (w3), and a fourth weight (w4).
[0204] FIG. 13 is a diagram for explaining a sampling operation using a test score according to one embodiment.
[0205] Referring to FIG. 13, the electronic device (100) can obtain a first test score corresponding to a first code block (S1305). The electronic device (100) can obtain a second test score corresponding to a second code block (S1310).
[0206] The electronic device (100) can determine whether the first test score is greater than or equal to the threshold value (S1315). If the first test score is greater than or equal to the threshold value (S1315-Y), the electronic device (100) can determine whether the second test score is greater than or equal to the threshold value (S1320).
[0207] If the second test score is greater than or equal to the threshold (S1320-Y), the electronic device (100) can sample both the first code block and the second code block (S1325). The electronic device (100) can use both the first code block and the second code block as learning data.
[0208] If the second test score is not greater than the threshold value (S1320-N), the electronic device (100) can sample the first code block (S1330). The electronic device (100) can use the first code block as learning data.
[0209] If the first test score is not greater than the threshold value (S1315-N), the electronic device (100) can determine whether the second test score is greater than the threshold value (S1335).
[0210] If the second test score is greater than or equal to the threshold value (S1335-Y), the electronic device (100) can sample the second code block (S1340). The electronic device (100) can use the second code block as learning data.
[0211] If the second test score is not greater than the threshold (S1335-N), the electronic device (100) may determine that there is no sampling data.
[0212] The electronic device (100) can obtain a test score corresponding to each of a plurality of code blocks and sample only code blocks whose test scores are greater than or equal to a threshold value. The electronic device (100) can determine that a code block corresponding to a test score less than the threshold value is not a standardized code.
[0213] Depending on the various embodiments, the first threshold value compared to the first test score and the second threshold value compared to the second test score may be different.
[0214] FIG. 14 is a diagram for explaining a sampling operation using the number of tokens according to one embodiment.
[0215] Referring to FIG. 14, the electronic device (100) can obtain a first number of tokens corresponding to a first code block (S1405). The electronic device (100) can obtain a second number of tokens corresponding to a second code block (S1410).
[0216] A token may include a preset unit that constitutes code. A token may include the smallest element in a programming language or script. A token may include the smallest unit of interpretation. A token may include at least one of an identifier, a keyword, an operator, a punctuation mark, a comment, a space, or a character. The electronic device (100) may calculate (or obtain) the number of tokens corresponding to each code block.
[0217] The electronic device (100) can determine whether the number of first tokens is less than the threshold number (S1415). If the number of first tokens is less than the threshold number (S1415-Y), the electronic device (100) can determine whether the number of second tokens is less than the threshold number (S1420).
[0218] If the number of second tokens is less than the threshold number (S1420-Y), the electronic device (100) can sample both the first code block and the second code block (S1425). The electronic device (100) can use both the first code block and the second code block as learning data.
[0219] If the number of second tokens is not less than the threshold number (S1420-N), the electronic device (100) can sample the first code block (S1430). The electronic device (100) can use the first code block as learning data.
[0220] If the number of first tokens is not less than the threshold number (S1415-N), the electronic device (100) may determine that there is no sampling data (S1445). The first code block may be smaller than the second code block. If the number of first tokens of the first code block is already greater than or equal to the threshold number, the electronic device (100) may determine that the number of second tokens of the second code block is also necessarily greater than or equal to the threshold number. The electronic device (100) may exclude both the first code block and the second code block from the sampling target.
[0221] The electronic device (100) can obtain the number of tokens corresponding to each of a plurality of code blocks and sample only code blocks having a number of tokens less than a threshold number. The electronic device (100) can determine that a code block corresponding to a number of tokens less than the threshold number is not a standardized code.
[0222] Depending on the various embodiments, the order of steps S1410 and S1415 may be changed. Step S1415 may be performed first, and then step S1410 may be performed.
[0223] FIG. 15 is a diagram illustrating an operation of learning a code generation model according to one embodiment.
[0224] Referring to FIG. 15, the electronic device (100) can obtain preprocessed code information including at least one sampled code block (S1505).
[0225] The electronic device (100) can input preprocessed code information as input data into a code generation model (150) to obtain result code information (S1510).
[0226] The electronic device (100) can obtain an inspection score based on the result code information (S1515).
[0227] The electronic device (100) can change the parameters of the code generation model (150) by performing reinforcement learning based on the test score (S1520).
[0228] The electronic device (100) can update the code generation model (150) based on the changed parameters. The electronic device (100) can repeat the update operation until a preset event is identified.
[0229] The pre-configured event may include at least one of an event in which the inspection score is greater than or equal to a threshold, an event in which the number of update repetitions is greater than or equal to a threshold, and an event in which preprocessed code information is no longer acquired.
[0230] FIG. 16 is a diagram for explaining an error message according to one embodiment.
[0231] Embodiment 1610 of FIG. 16 may include detailed error messages. Assume that five detailed error messages are identified in embodiment 1610.
[0232] The first detailed error message (1611) may be a message indicating that a specific variable (foo) has been defined but not used. The first detailed error message (1611) may be of the second type.
[0233] The second detailed error message (1612) may be a message indicating that a specific string (use strict) uses a single quote. Single quotes may not be used in certain programming languages. The second detailed error message (1612) may be of the second type.
[0234] The third detailed error message (1613) may be a message indicating that a specific function (fn) is not defined. The third detailed error message (1613) may be of the second type.
[0235] The fourth detailed error message (1614) may be a message indicating that an error occurred in an asynchronous callback function was not handled. The fourth detailed error message (1614) may be of the third type.
[0236] The fifth detailed error message (1615) may be a message indicating that a specific variable (err) has been defined but not used. The fifth detailed error message (1615) may be of the first type.
[0237] FIG. 17 is a diagram for explaining result code information according to one embodiment.
[0238] Referring to FIG. 17, the electronic device (100) can input input data (1710) into a code generation model (150) to obtain output data (1720). The input data (1710) may be a code corresponding to a user input.
[0239] For example, the input data (1710) may be a code directly entered by the user.
[0240] For example, input data (1710) may be source code obtained based on user input. The electronic device (100) may obtain source code corresponding to the user input from a source code database (140) containing multiple source codes. The user input may include text (or audio) information such as “Create a code that receives two numbers, stores initial values, and performs addition.”
[0241] The electronic device (100) can generate output data (1720) including a supplemented code using a code generation model (150).
[0242] The supplemented code may include “try”, “except ValueError:”, and “print(“Please enter a valid number format.”)”. When the supplemented code is added, an error message may be displayed if the user does not enter a number. In calculation operations that require only numbers, the user may incorrectly enter characters. The electronic device (100) may generate output data (1720) by adding supplemented code that guides the user to enter numbers instead of characters.
[0243] The electronic device (100) can obtain output data (1720) with a higher degree of completion than input data (1710) without manual operation by the user. The code generation model (150) may be a model learned based on standardized learning data.
[0244] FIG. 18 is a diagram illustrating an operation of obtaining result code information using a prompt, according to one embodiment.
[0245] Referring to FIG. 18, the electronic device (100) can input input data (1810) into a code generation model (150) to obtain output data (1820).
[0246] The input data (1810) may include prompt code information. The prompt code information may include a preset code format. The prompt code information may not be complete code, but may include a code format or code style. The prompt code information may include code that only defines a function name.
[0247] The electronic device (100) can generate detailed information corresponding to the prompt code information using the code generation model (150). The electronic device (100) can obtain output data (1820) including the completed code using the code format included in the prompt code information.
[0248] For example, input data (1810) may only include the contents of the first function (flattern(I)) and the second function (chunks(I: List.n: int). Using the code generation model (150), output data (1820) including specific detailed code for the first function (flattern(I)) and specific detailed code for the second function (chunks(I: List.n: int)) may be generated.
[0249] FIG. 19 is a diagram for explaining an operation of setting code blocks line by line according to one embodiment.
[0250] Referring to FIG. 19, the electronic device (100) can divide multiple code blocks into lines. Assume there are 17 lines of source code. The electronic device (100) can divide the code into lines to create 17 code blocks. The code blocks can be accumulated.
[0251] The first code block may include code corresponding to line 1. The score corresponding to the first code block may be s1.
[0252] The second code block may contain code corresponding to lines 1-2. The score corresponding to the second code block may be s2.
[0253] The 17th code block may contain codes corresponding to lines 1-17. The score corresponding to the 17th code block may be s17.
[0254] According to various embodiments, when calculating a test score, the electronic device (100) may exclude “0”. The electronic device (100) may obtain an average value of values excluding “0” among the acquired multiple test scores as the test score.
[0255] The electronic device (100) can obtain an inspection score corresponding to each of a plurality of code blocks divided by line.
[0256] FIG. 20 is a drawing for explaining a control method of an electronic device according to an embodiment of the present invention.
Claims
1. In an electronic device including a code generation model, Memory that stores at least one instruction; At least one processor connected to said memory and controlling said electronic device; At least one processor of the above, Obtain user commands to train the above code generation model, Obtain the source code corresponding to the above code learning command, Divide the above source code into preset units to obtain a first code block and a second code block, Obtaining first error message information including at least one detailed error message related to the first code block and second error message information including at least one detailed error message related to the second code block, Obtain a first test score corresponding to the first error message information and a second test score corresponding to the second error message information, Determine a sampling block among the first code block and the second code block based on the first test score and the second test score, An electronic device that trains the code generation model using the sampling block.
2. In paragraph 1, At least one processor of the above, By accumulating the above source codes in the above preset units, the first code block and the second code block are obtained, An electronic device wherein the size of the first code block is smaller than the size of the second code block.
3. In paragraph 2, The above preset units are: An electronic device, which is a function unit declared in the above source code.
4. In paragraph 1, At least one processor of the above, Identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, An electronic device that obtains the first test score and the second test score based on a reference score corresponding to the identified message type.
5. In paragraph 1, At least one processor of the above, Identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, An electronic device that obtains the first inspection score and the second inspection score based on the message type-specific ratio information and the message type-specific weight information.
6. In paragraph 1, At least one processor of the above, An electronic device that determines a code block corresponding to a test score greater than or equal to a threshold value among the first test score and the second test score as the sampling block.
7. In paragraph 1, At least one processor of the above, Obtain the number of first tokens corresponding to the first code block, Obtain the number of second tokens corresponding to the second code block, If the number of the first tokens is less than the threshold number and the number of the second tokens is less than the threshold number, the first code block and the second code block are determined as the sampling blocks, An electronic device, wherein if the number of the first tokens is less than the threshold number and the number of the second tokens is not less than the threshold number, the device determines the first code block as the sampling block.
8. In paragraph 1, At least one processor of the above, Obtain preprocessed code information including the above sampling block, An electronic device that obtains result code information by inputting the above preprocessed code information as input data into the above code generation model.
9. In paragraph 8, The above preset unit is the first unit, At least one processor of the above, By accumulating the above result code information into a second unit, a third code block and a fourth code block are obtained, Obtain a third test score corresponding to the third code block and a fourth test score corresponding to the fourth code block, An electronic device that obtains an average test score of the third test score and the fourth test score.
10. In paragraph 9, At least one processor of the above, By performing a reinforcement learning function based on the above average test score, the parameters of the code generation model are changed, An electronic device that updates the code generation model based on the changed parameters.
11. A method for controlling an electronic device including a code generation model, A step of obtaining user commands for learning the above code generation model; A step of obtaining source code corresponding to the above code learning command; A step of dividing the above source code into preset units to obtain a first code block and a second code block; A step of obtaining first error message information including at least one detailed error message related to the first code block and second error message information including at least one detailed error message related to the second code block; A step of obtaining a first test score corresponding to the first error message information and a second test score corresponding to the second error message information; A step of determining a sampling block among the first code block and the second code block based on the first test score and the second test score; and A control method, comprising: a step of learning the code generation model using the sampling block.
12. In paragraph 11, The step of obtaining the first code block and the second code block comprises: By accumulating the above source codes in the above preset units, the first code block and the second code block are obtained, A control method, wherein the size of the first code block is smaller than the size of the second code block.
13. In paragraph 12, The above preset units are: A control method, which is a function unit declared in the above source code.
14. In paragraph 11, The step of obtaining the first test score and the second test score comprises: Identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, A control method for obtaining the first inspection score and the second inspection score based on a reference score corresponding to the identified message type.
15. In paragraph 11, The step of obtaining the first test score and the second test score comprises: Identifying the message type of each of at least one detailed error message included in the first error message information and the second error message information, A control method for obtaining the first inspection score and the second inspection score based on the ratio information for each message type and the weight information for each message type.
Citation Information
Patent Citations
Video signal encoding method and apparatus and video decoding method and apparatus
KR1020200124077A
Anti spycas9 antibody and use thereof
KR1020210154422A
Apparatus for endpoint security tailored to the point of work based on artificial neural network and method therefor
KR1020220039905A
Integrated control apparatus for autonomous driving vehicle
KR1020220131416A
Apparatus for refining clean labeled data for artificial intelligence training
KR102387887B1