Automated method to improve a language model using entropy-based efficiency metrics
The method addresses language model issues by using entropy-based metrics to evaluate and enhance performance, resulting in faster, more accurate, and efficient language model responses.
Patent Information
- Application Number
- US19/553136
- Authority / Receiving Office
- US · United States
- Patent Type
- Patents(United States)
- Current Assignee / Owner
- Filing Date
- 2026-02-27
- Publication Date
- 2026-12-01
- Estimated Expiration
- 2046-02-27
AI Technical Summary
Language models suffer from hallucinations, performance degradation over time, and verbosity, necessitating an automated method to evaluate and improve their performance quantitatively.
An automated method using entropy-based efficiency metrics, involving a sim model and a test model, simulates conversations to determine information gain metrics, which are used to improve the test model's performance by retraining or selecting models that generate correct answers quickly and succinctly.
The improved test models reduce latency, save processor cycles, and enhance user satisfaction by generating fewer turns and more accurate responses.
Smart Images

Figure US12818134-D00000_ABST
Abstract
Description
BACKGROUND
[0001] Language models, such as large language models (e.g., CHATGPT® by Open AI, LLC) are a type of artificial intelligence (i.e., a machine learning model) designed to understand, generate, and manipulate human language. Language models may be, for example, transformer artificial neural networks. In any case, language models analyze patterns in massive amounts of text data (e.g., terabytes or more) and learn how words, phrases, and sentences relate to one another. Language models then are able predict an answer to a prompt by predicting, token by token, a sequence of tokens that forms the answer to the prompt. A token is a word, number, etc. Language models are increasingly used for a variety of computing tasks due to their versatility.
[0002] However, language models are subject to technical difficulties. For example, a language model may hallucinate. In the context of language models, the term “hallucinate” means that the language model generates an incorrect answer, an answer that does not make sense to a human, or an answer that is misleading. Additionally, language model performance (i.e., the quality of language model output, as evaluated by a human) may degrade over time. Furthermore, language models may be excessively verbose, that is generate answers that are unnecessarily long relative to the number of words that could have answered the input prompt.
[0003] Thus, a technical problem is presented. The technical problem is how to automatically evaluate the performance of a language model, and then improve the language model according to a metric that represents a quantitative assessment of the performance of the language model.SUMMARY
[0004] One or more embodiments provide for a method. The method includes processing a sim model to output a sim prompt. The sim model includes a first language model. The sim prompt includes a request to perform a natural language task. The method includes processing a test model on the sim prompt to output at least one test output. Each at least one test output includes a corresponding token. The method includes determining an information gain metric of the at least one test output. The information gain metric is based on an entropy metric determined from execution information generated by the test model while processing the test model on the sim prompt. The method includes improving, according to the information gain metric, the test model.
[0005] One or more embodiments include a system. The system includes a computer processor. The system includes a data repository in communication with the computer processor and storing. The data repository stores a sim prompt including a request to perform a natural language task. The data repository stores at least one test output. Each test output includes a corresponding token. The data repository stores an information gain metric of the at least one test output. The data repository stores an entropy metric of the at least one test output. The system includes a sim model executable by the computer processor to generate the sim prompt. The system includes a test model executable by the computer processor on the at least one test output to output the corresponding token. The test model generates execution information while processing the sim prompt. The system includes a server controller executable by the computer processor to command processing, by the computer processor, of the sim model and of the test model. The server controller is executable by the computer processor to determine an information gain metric of the at least one test output. The information gain metric is based on an entropy metric determined from the execution information. The server controller is executable by the computer processor to improve, according to the information gain metric, the test model.
[0006] One or more embodiments include a method. The method includes processing a sim model and a test model such that the sim model and the test model simulate a conversation. Processing the sim model and the test model includes initiating, by the sim model, the conversation by providing, as input, a sim prompt to the test model. The sim prompt includes a request to perform a natural language task. Processing the sim model and the test model also includes generating, by the test model, a question to the sim model to provide additional information in order to perform the natural language task. Processing the sim model and the test model also includes generating, by the sim model, an answer to the question. Processing the sim model and the test model also includes generating, by the test model using the sim prompt and the answer, an output including the natural language task. The method includes determining a number of entropy metrics from execution information generated by the test model while the test model generates the question and the output. The method includes determining an information gain metric of the conversation from the number of entropy metrics. The method includes improving, according to the information gain metric, the test model.
[0007] Other aspects of one or more embodiments will be apparent from the following description and the appended claims.BRIEF DESCRIPTION OF DRAWINGS
[0008] FIG. 1 shows a computing system for an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments.
[0009] FIG. 2 and FIG. 3 show a flowchart of a method for an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments.
[0010] FIG. 4, FIG. 5, FIG. 6, and FIG. 7 show an example of an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments.
[0011] FIG. 8A and FIG. 8B show a computing system and network environment, in accordance with one or more embodiments.
[0012] Like elements in the various figures are denoted by like reference numerals for consistency.DETAILED DESCRIPTION
[0013] One or more embodiments are directed to an automated method to improve a language model using entropy-based efficiency metrics. The method of one or more embodiments represents a technical solution to the technical problem of how to automatically evaluate the performance of a language model, and then improve the language model according to a metric that represents a quantitative assessment of the performance of the language model.
[0014] The method involves using two language models, a sim model and a test model. The test model is a model programmed to perform a natural language task, such as to answer user questions in a particular domain of knowledge, to analyze an image and describe the image, to summarize a body of text, etc. The test model is the model that is being tested and which, depending on a determination of an information gain metric as described below, may be improved to increase model performance in terms of succinctness, accuracy, etc.
[0015] In turn, the sim model is a language model that generates a simulated user prompt (i.e., a “sim prompt”) that simulates the kind of question that the test model is programmed to answer correctly. The sim model is also programmed to answer requests posed by the test model. For example, if the test model asks one or more questions that request additional information from the sim model in order to process the original sim prompt, then the sim model may generate the answers to the questions and provide the answers as additional input to the test prompt. Examples of such a simulated conversation is shown in FIG. 4 and FIG. 5.
[0016] While the test model generates the answer to the sim prompt, execution information is read from the internal intervening calculations that the test model processes as part of generating one or more tokens that constitute one or more of the questions or the answer to the sim prompt. The execution information is described below with respect to FIG. 1.
[0017] The execution information is used to determine entropy metrics of the test model. The entropy metrics represent measures of uncertainty in a conditional probabilities that the sim prompt, or the answers provided by the sim prompt, have sufficient information such that the test prompt may correctly answer the original sim prompt. Stated differently, the entropy metrics are a measure of uncertainty of the conditional probability that the test model has sufficient information in order to complete the natural language task stated in the sim prompt. A formal definition of the entropy metrics is presented below.
[0018] Each turn of the simulated conversation generates two entropy metrics. A turn is a question and a response. Thus, for example, when the test model starts processing the sim prompt a first entropy metric is generated, and when the test model starts processing a first question in response to the sim prompt, then a second entropy metric is generated.
[0019] Then, an information gain metric is determined from any two entropy metrics at each turn of the simulated conversation. The information gain metric represents a reduction in the system entropy. In other words, the information gain metric represents a quantitative degree in the improvement of the information available to the test model. Stated still differently, the information gain metric represents how much closer the test model is to having sufficient information to answer the original sim prompt. A formal definition of the information gain metric is provided below.
[0020] However, for ease of understanding, the higher the information gain metric, the more quickly the test model will generate a correct answer to the sim prompt. If the speed at which the test model generates the correct answer is not satisfactory (e.g., the information gain metric fails to satisfy a threshold), then the test model may be improved. For example, the test model may be retrained using a reward training process that rewards arriving at answers more quickly and penalizes arriving at answers more slowly. In another example, a variety of models may be tested, and the model that generates correct answers with the fewest number of turns may be selected. Other examples of improvement to the test model are described below.
[0021] Thus, one or more embodiments may be used to train, or select, test models that arrive at correct answers more quickly and more succinctly. The improved test models effectively increase the computational speed at which future user prompts are processed. The improved test models also save processor cycles, thereby reducing latency and saving electricity used to power the computer processors. The improved test models also generate fewer turns, thereby pestering users with fewer questions while answering future user prompts and increasing user satisfaction. Thus, as indicated above, one or more embodiments represents a technical solution to the technical problem of how to automatically evaluate the performance of a language model, and then improve the language model according to a metric that represents a quantitative assessment of the performance of the language model.
[0022] Attention is now turned to the figures. FIG. 1 shows a computing system for an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments. The system shown in FIG. 1 includes a data repository (100). The data repository (100) is a type of storage unit or device (e.g., a file system, database, data structure, or any other storage mechanism) for storing data. The data repository (100) may include multiple different, potentially heterogeneous, storage units and / or devices.
[0023] The data repository (100) may store a sim prompt (102). The sim prompt (102) is a prompt, generated by the sim model (114) (defined below) for input to another language model (i.e., the test model (116), defined below). In general, a prompt, including the sim prompt (102), is a command to a language model to perform a language-related task (summarize text, generate a letter, generate an invoice, critique a body of text, etc.). In the case of a multi-modal model the sim prompt (102) may also include an instruction to manipulate or generate an image. What distinguishes the sim prompt (102) from some other language model prompt is the source of the prompt (i.e., the sim prompt (102) is generated automatically by the sim model (114), defined below).
[0024] The data repository (100) also stores a test output (104). The test output (104) is the output of the test model (116) in response to executing the sim prompt (102). Because the test model (116) is a language model, or a multimodal, the test output (104) includes text, an image, or a combination thereof. In addition, the test output (104) may include intervening queries. For example, the sim model (114) and the test model (116) may carry on a simulated conversation in which the test model (116) submits a query for additional information to the sim model (114). In turn, the sim model (114) generates an answer, which the test model (116) considers before generating a next query or before generating the test output (104). In any case, intervening queries or statements of the test model (116) to the sim model (114) also may be deemed part of the test output (104) in one or more embodiments.
[0025] The data repository (100) also stores a entropy metric (106). The entropy metric (106) is a proxy measure of uncertainty based on the conditional probability of a sequence of tokens being generated by the test model (116). A formal representation, and determination of, the entropy metric (106) is presented with respect to FIG. 2.
[0026] The data repository (100) also stores an information gain metric (108). The information gain metric (108) is the determined reduction in system entropy been a first conversation turn and a final conversation turn, considering intervening conversation turns. A conversation turn is the sim prompt (102) or an answer generated by the sim model (114), plus the answer or test output (104) generated by the test model (116). The “system entropy” is the measured entropy for the conversation between the sim model (114) and the test model (116). Again, a formal determination of the entropy metric (106), determined for each conversation turn, is presented with respect to FIG. 2. Likewise, a formal definition of, and determination of, the information gain metric (108) is presented with respect to FIG. 2.
[0027] The system shown in FIG. 1 may include other components. For example, the system shown in FIG. 1 also may include a server (110). The server (110) is one or more computer processors, data repositories, communication devices, and supporting hardware and software. The server (110) may be in a distributed computing environment. The server (110) is configured to execute one or more applications, such as the sim model (114), the test model (116), or the server controller (118). An example of a computer system and network that may form the server (110) is described with respect to FIG. 8A and FIG. 8B.
[0028] The server (110) includes a computer processor (112). The computer processor (112) is one or more hardware or virtual processors which may execute computer readable program code that defines one or more applications, such as the sim model (114), the test model (116), and the server controller (118). An example of the computer processor (112) is described with respect to the computer processor(s) (802) of FIG. 8A.
[0029] The server (110) also includes a number of language models, including sim model (114) and test model (116). A language model is a natural language processing machine learning model. An example of a language model may be a large language model, such as CHATGPT®. However, different language models may be used. The use and evaluation of language models, with respect to one or more embodiments, is described with respect to FIG. 2 through FIG. 7.
[0030] In more detail, the sim model (114), or “simulated user model,” is a language model that simulates a user interacting with the test model (116). The sim model (114) therefore generates the sim prompt (102), as well as any simulated answers generated during a simulated conversation between the sim model (114) and the test model (116).
[0031] The test model (116), in turn, is a language model that is the model under test. The test model (116) is programmed to perform natural language tasks, perhaps in a specific context (e.g., to perform functions or to answer questions in a particular software or enterprise environment). The test model (116) therefore generates the test output (104), as well as any simulated queries that may be submitted to the sim model (114) during the simulated conversation between the sim model (114) and the test model (116).
[0032] Use of the sim model (114) and the test model (116) is described with respect to FIG. 2 and FIG. 3. An example of a simulated conversation between the sim model (114) and the test model (116) is shown in FIG. 5 and in FIG. 6.
[0033] The server (110) also may include a server controller (118). The server controller (118) is software or application specific hardware which, when executed by the computer processor (112), controls and coordinates operation of the software or application specific hardware described herein. Thus, the server controller (118) may control and coordinate execution of the sim model (114) and the test model (116).
[0034] The system shown in FIG. 1 also may include one or more user devices (120). The user devices (120) are computing systems (e.g., the computing system (800) shown in FIG. 8A) that communicate with the server (110).
[0035] The user devices (120) may be considered remote or local. A remote user device is a device operated by a third-party (e.g., an end user of a chatbot) that does not control or operate the system of FIG. 1. Similarly, the organization that controls the other elements of the system of FIG. 1 may not control or operate the remote user device. Thus, a remote user device may not be considered part of the system of FIG. 1.
[0036] In contrast, a local user device is a device operated under the control of the organization that controls the other components of the system of FIG. 1. Thus, a local user device may be considered part of the system of FIG. 1.
[0037] While FIG. 1 shows a configuration of components, other configurations may be used without departing from the scope of one or more embodiments. For example, various components may be combined to create a single component. As another example, the functionality performed by a single component may be performed by two or more components.
[0038] FIG. 2 and FIG. 3 show flowcharts of a method for an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments. The methods of FIG. 2 or FIG. 3 may be implemented using the system of FIG. 1 and one or more of the steps may be performed on or received at one or more computer processors.
[0039] Step 200 includes processing a sim model to output a sim prompt. The sim model includes a first language model. The sim prompt includes a request to perform a natural language task.
[0040] The sim model may be processed by inputting an initiation prompt to the sim model. The initiation prompt commands the sim model to generate a command for the test model to perform a language task. The initiation prompt may be received from an automated process or from a user. The initiation prompt may be selected from a set number of questions, or a third model (or even the sim model itself) may automatically generate the initiation prompt. In any case, the initiation prompt is provided as input to the sim model, which in turn outputs the sim prompt.
[0041] Step 202 includes processing a test model on the sim prompt to output at least one test output. Each at least one test output includes a corresponding token. The test model executes on the sim prompt and outputs, accordingly, at least one token that represents the test output, or an intervening conversation step as part of generating the test output. For example, the at least one test output may include one or more tokens that form a question directed as input to the sim model. The at least one test output may include one or more tokens that form the final output to the sim prompt. An example of processing the test model on the sim prompt is shown in FIG. 5.
[0042] Step 204 includes determining an information gain metric of the at least one test output. The information gain metric is based on an entropy metric determined from execution information generated by the test model while processing the test model on the sim prompt. The execution information is taken from the probabilities that the language model generates for each token output by the language model.
[0043] In general, the language model may generate a number of potential tokens to output for each token that the language model actually outputs. For example, the language model may output the phrase “Spot runs.” For the tokens “Spot” the language model generates a number of other tokens that could have potentially been the output instead of “Spot.” For example, potential other tokens could have been “Fido” or “Doggo.” Each of Spot, Fido, and Doggo had a probability, as determined by the language model as being the next token output by the language model. However, the token “Spot” had the highest probability and thus was the token selected. The same procedure takes place with respect to generating the token “runs.” Thus, each token output by the language model includes a probability that the token would be output. The probability, or probabilities, are the execution information read from the model during one or more embodiments.
[0044] The information gain metric using the execution information may be determined according to the formal procedure described below. The determination of the information gain network includes a determination of an entropy metric at each turn of the conversation, as described below. Stated differently, one or more embodiments provide for the determination of system entropy and information fain by leveraging the internal probabilistic outputs of a language model, such as a large language model.
[0045] Attention is turned to a number of formal definitions.
[0046] Let Et=(appt-1, usert) be a tuple of the app turn at time t−1 and the user response at time t. Let the conversation history Ht be defined as:
[0047] Ht={E0,… Et}
[0048] The information that a model collects in order to complete a task defined in a prompt is defined as infot:
[0049] infot=G(infot-1,Ht),t=1,2,…info0=G(H0)=G(E0) …
[0050] where G(⋅) is a generation function that may or may not be known. The probability of a infot is conditioned on infot-1 and the conversation history: Ht.
[0051] Let infot be a sequence of tokens:
[0052] infot={w1,w2,… wn}
[0053] Next, the probability of infot may be determined by chaining the conditional probabilities of each token, given the previous infot-1, the conversation history Ht and all preceding tokens in the sequence.
[0054] The probability of infot may be defined formally as:
[0055] P(infot❘infot-1,Ht)=P(w1,w2,… wn❘infot-1,Ht)(1)
[0056] By the chain rule of probability, equation 1 above expands to:
[0057] P(infot❘infot-1,Ht)=∏ i=1 nP(wi❘infot-1,Ht,w1,… wi-1)(2)
[0058] Next, the system entropy is determined. The system entropy, H (infot), is defined as a proxy measure of uncertainty. The uncertainty is determined as the negative logarithm of the conditional probability of infot. The uncertainty is also known as the negative log-likelihood or “surprisal.” More formally, the system entropy may be defined as:
[0059] H(infot)=-log P (infot❘infot-1,Ht)(3)
[0060] By applying the logarithm to the product, the product may be converted into a sum, which is computationally practical (i.e., uses fewer computational physical or logical resources than a predetermined amount of computational physical or logical resources. As a result, the system entropy may be expressed as:
[0061] H(infot)=-log(∏ i=1 nP(wi❘infot-1,Ht,w<i))(4)
[0062] Equation 4 may be rewritten as:
[0063] H(infot)=-∑ i-1 nlog P(wi❘infot-1,Ht,w<i)(5)
[0064] In equations 4 and 5 w<i represents the sequence of tokens {w1, . . . , wi-1}.
[0065] Attention is now turned to a formal definition of the information gain. The information gain, IG(Et), from a step (event) Et, is the reduction in system entropy after the event has been incorporated into the context. The context is the ongoing sequence of tokens.
[0066] The entropy before the event is determined using the history Ht-1 as follows:
[0067] H(infot-1)=-∑ i-1 nlog P(wi❘infot-2,Ht-1,w<j)(6)
[0068] After the event Et, the new history Ht=Ht-1∪{Et} may be used to determine the new system entropy as follows:
[0069] H(infot)=-∑ i-1 nlog P(wi❘infot-1,Ht,w<i)(7)
[0070] The information gain, then, is the difference between these two entropy values, as defined by equation 8 below:
[0071] IG(Et)=H(infot-1)-H(infot).(8)
[0072] Thus, the information gain may be determined, as defined above, for the test output. The information gain may be determined for each token output (i.e., the test output above.
[0073] Stated differently, the entropy metric is determined according to a conditional probability of a sequence of tokens generated by the test model while processing on the sim prompt. The sequence of tokens represents a net information that the test model will use to process the sim prompt.
[0074] Theoretically, the language model may generate a single token as the overall total output. In this case, the information gain is at a maximum. However, in most real instances, multiple or many tokens are output. Thus, the overall information gain may be determined for the test model according to the number of conversation turns between the test model and the sim model.
[0075] The information gain metric may be considered a measure of the efficiency of the test model. Thus, the information gain metric, or an average of information gain metrics, may also be characterized as a score assigned to the test model.
[0076] Step 206 includes improving, according to the information gain metric, the test model. The test model may be improved according to a number of different techniques.
[0077] In one example, improving the test model may include determining that the average information gain metric fails to satisfy a gain threshold. Then, improving the test model includes generating, using the average information gain metric, a loss function to maximize the information gain metric. In particular, the average information gain metric may be inserted into a function that defines a reward function or some other function that, when used in a loss function, will change the parameters of the test model to generate an answer using fewer tokens.
[0078] In particular, a loss function is a computer executable code which implements a mathematical function to output a loss. The loss, in turn, is used to change one or more parameters that define the values assigned to different connections between nodes in the neural network that forms part of the test model. In other words, changing the relationships among the nodes in the neural network changes the language model itself. As a result, the language model will behave differently. The process of determining the loss function and applying the loss is known as training. Thus, improving the test model includes retraining the test model using the loss function. In particular, the training procedure may be a reward training procedure that penalizes longer outputs and rewards shorter outputs.
[0079] Because the parameters are changed accordingly, the test model is more likely to generate fewer tokens when responding to a prompt. Therefore, the system entropy in the test model will be reduced and, as a result, the information gain in each turn of conversation between the test model and the sim model is more likely to increase. In this matter, the test model is improved and exhibits more of the desired behaviors.
[0080] The process of training may be repeated. For example, when tested again, if the next average information gain still falls before the threshold, then the process may be repeated automatically. The process of training may be repeated until the information gain satisfies the threshold. The point at which the information gain threshold is satisfied may be referred to as convergence.
[0081] Another technique for improving the test model is now described. In particular, one or more embodiments contemplate that multiple test models may be available. The method of FIG. 2 may be applied to each of the test models, resulting in multiple information gain determinations, one set for each test model.
[0082] Processing the test model includes processing a number of test models, including the test model, on the sim prompt to output a number of test outputs. Then, a number of information gain metrics are determined for each of the test outputs of the number of test models, including the information gain metric for the above mentioned test model.
[0083] Improving the test model then includes determining that the test model has a highest average information gain metric in the number of information gain metrics. In other words, the test model mentioned above in FIG. 2 is the test model that had the highest average information gain metric among the models tested. However, in other embodiments, one of the other test models could have been selected as the test model having the highest information gain metric.
[0084] Then, improving the test model includes selecting the test model from among the number of test models. In other words, the other test models are not selected for use. Then, improving the test model includes deploying the selected test model in an enterprise environment. Note that the test model that is actually deployed is still improved in the context of the enterprise environment, because the selected test model was shown to perform better than the other test models. Stated differently, the enterprise environment is improved because a better test model was deployed.
[0085] In the above example, processing the number of test models may include generating a number of conversations between the sim model and the number of test models. Each conversation in the number of conversations includes a corresponding number of turns until a corresponding final answer is achieved. Each corresponding number of turns represents a number of questions generated by the test model and a number of answers generated by the sim model. In this case, the selected test model minimizes the corresponding number of turns for the test model.
[0086] A third technique for improving the test model is now provided. In the example, the method further includes receiving a user prompt. The user prompt is a prompt received from a user, though the user prompt may be received from the sim model. In any case, the user prompt is to be processed using a best available test model.
[0087] Thus, processing the test model includes processing a number of test models, including the test model, on the user prompt to output a number of test outputs. Then, a number of average information gain metrics are determined, including the average information gain metric, for the number of test models.
[0088] Then, improving the test model includes determining that the test model has a highest information gain metric in the number of information gain metrics. Improving the test model also includes selecting the test model from among the number of test models.
[0089] Improving the test model includes routing the user prompt to the test model. The test model selected accordingly is the test model that will generate the output for the user. In other words, in the example, multiple test models may be maintained and executed when a user prompt is received, and the test model that exhibits the best information gain for that particular user prompt is the test model that will process that particular user prompt.
[0090] Attention is now turned to other embodiments. The following may be alternate descriptions of the steps of FIG. 2, above.
[0091] In an example, the sim model may include a first chatbot and the test model may include a second chatbot. In this case, processing the sim model and processing the test model, together, includes simulating a conversation between the first chatbot and the second chatbot.
[0092] Continuing the above example, the sim prompt further may include a number of answers to questions returned by the test model. The test model then generates the number of questions as part of processing on the sim prompt.
[0093] Continuing the above example, the entropy metric may include both a first entropy metric of a first answer of the number of answers and a second entropy metric of a second answer of the number of answers. Then, the information gain metric for the turn may include a difference between the first entropy metric and the second entropy metric.
[0094] In another embodiment, the sim model includes a first chatbot and the test model includes a second chatbot. In this case, processing the sim model and processing the test model, together, includes simulating a conversation between the first chatbot and the second chatbot. The sim model generates, during the conversation, a number of answers to questions returned by the test model. The test model generates the number of questions as part of processing on the sim prompt.
[0095] In the example, determining the information gain metric further includes generating a first entropy metric of a first answer of the number of answers. Determining the information gain metric further includes generating a second entropy metric of a second answer of the number of answers. Determining the information gain metric further includes generating the information gain metric by determining a difference between the first entropy metric and the second entropy metric.
[0096] The method shown in the flowchart of FIG. 3 is a variation of the method shown in the flowchart of FIG. 2. Thus, the method of FIG. 3 may be performed using the system of FIG. 1.
[0097] Step 300 includes processing a sim model and a test model such that the sim model and the test model simulate a conversation. For example, the sim model may initiate the conversation by providing, as input, a sim prompt to the test model. The sim prompt includes a request to perform a natural language task. Processing the sim model and the test model also includes generating, by the test model, a question to the sim model to provide additional information in order to perform the natural language task. Processing the sim model and the test model also includes generating, by the sim model, an answer to the question. Processing the sim model and the test model also includes generating, by the test model using the sim prompt and the answer, an output including the natural language task. Examples of Step 300 are shown in FIG. 4 and FIG. 5.
[0098] Step 302 includes determining a number of entropy metrics from execution information generated by the test model while the test model generates the question and the output. The entropy metrics may be determined as described with respect to step 204 of FIG. 2.
[0099] Step 304 includes determining an information gain metric of the conversation from the number of entropy metrics. The information gain metric may be determined as described with respect to step 204 of FIG. 2.
[0100] Step 306 includes improving, according to the information gain metric, the test model. The test model may be improved as described with respect to step 206 of FIG. 2.
[0101] While the various steps in the flowcharts of FIG. 2 and FIG. 3 are presented and described sequentially, at least some of the steps may be executed in different orders, may be combined or omitted, and at least some of the steps may be executed in parallel. Furthermore, the steps may be performed actively or passively.
[0102] FIG. 4, FIG. 5, FIG. 6, and FIG. 7 show an example of an automated method to improve a language model using entropy-based efficiency metrics, in accordance with one or more embodiments. The following example is for explanatory purposes only and not intended to limit the scope of one or more embodiments. The example of FIG. 4 through FIG. 7 may be performed using the system of FIG. 1. The example of FIG. 4 through FIG. 7 may be performed according to the methods of FIG. 2 or FIG. 3.
[0103] FIG. 4, in particular, shows a first simulated conversation between a sim model and a first test model. The simulated conversation (400) includes a sim prompt (402) and sim answers, including sim answer (406) and sim answer (410), generated by the sim model. The simulated conversation (400) also includes test queries (including test question (404) and test question (408)) directed by the first test model to the sim model, as well as a test answer (412) representing the output requested by the sim prompt. The various outputs of the sim model are represented by, from the perspective of FIG. 4, left-oriented quote tags, including sim prompt (402), sim answer (406), and sim answer (410). The various outputs of the first test model are represented by, from the perspective of FIG. 4, right-oriented tags, including test question (404), test question (408), and test answer (412).
[0104] In the example of FIG. 4, the simulated conversation (400) is initiated by the sim model which generates the sim prompt (402). The sim prompt (402) requests the first test model to generate an invoice to John. In the example, the first test model does not understand, or cannot reference, certain information that the first test model will use to answer the sim prompt (402). The missing information is the last name of the customer (i.e., John's last name), and the user's account number with the service which is programmed to automatically generate invoices.
[0105] Thus, the first test model, in test question (404), asks the sim model what John's last name is. The sim model, in sim answer (406), replies “Smith.” Then, the first test model, in test question (408), asks “what is your account number.” In response, the sim model responds, in sim answer (410), “123456789.”
[0106] The first test model decides that the first test model now has enough information to answer the sim prompt (402). The first test model generates the invoice accordingly and then submits, in test answer (412), the response “Sure! Here is your required invoice.” The test answer (412) also includes a hyperlink which, if actuated (e.g., clicked on), downloads and displays the requested invoice for $100 to John Smith.
[0107] During execution of the first test model, execution information is observed. As shown later in FIG. 6 and FIG. 7, the execution information is used to generate, at each turn in the simulated conversation (400), first information gain metrics for the first test model.
[0108] FIG. 5 shows a second simulated conversation between a sim model and a second test model. The simulated conversation (500) includes a sim prompt (502) generated by the sim model and a test answer (512) output by the requested by the sim prompt. The output of the sim model is represented by, from the perspective of FIG. 5, a left-oriented quote tag, namely sim prompt (502). The output of the second test model is represented by, from the perspective of FIG. 5, a right-oriented tag, namely test answer (504).
[0109] In the example of FIG. 5, like the example of FIG. 4, the simulated conversation (500) is initiated by the sim model, which generates the sim prompt (502). The sim prompt (502) requests the second test model to generate an invoice to John. In the example, the second test model understands the context of the conversation and thus retrieves information from the simulated user account belonging to the simulated user which initiated the sim prompt (502). Thus, in the example of FIG. 5, the second test model is able to retrieve the last name of John and the simulated user's account number from a simulated data account belonging to the simulated user.
[0110] Accordingly, without asking intervening questions of the sim model, the second test model generates the invoice accordingly and then submits, in test answer (504), the response “Sure! Here is your required invoice.” The test answer (504) also includes a hyperlink which, if actuated (e.g., clicked on), downloads and displays the requested invoice for $100 to John Smith.
[0111] In the examples of FIG. 4 and FIG. 5, both the first test model and the second test model generated the same correct answer to the sim input. Thus, for example, a judge large language model used to evaluate the first test model and the second test model would conclude that both test models are equally accurate.
[0112] However, the second test model is clearly better than the first test model, because the second test model generates the correct answer more quickly, without generating intervening questions. Thus, in real use, the second test model is more likely to answer real user prompts in fewer turns. Accordingly, the second test model should be deployed into an enterprise environment, because the second test model reduces latency, is more computationally efficient, and requires less input from a real user (and hence will lead to greater user satisfaction and less user frustration).
[0113] The technical problem, in the example, is how to automatically make the determination that the second test model is better (i.e., will require fewer conversation turns) than the first test model. Thus, the method of FIG. 2 or the method of FIG. 3 may be executed on the first test model and the second test model, and the test model with the better information gain metric may be selected as the improved test model. Alternatively, or in addition, the first test model may be retrained and thereby improved to have an increased information gain metric.
[0114] Attention is now turned to FIG. 6, and FIG. 7. FIG. 6 and FIG. 7 refer to common objects as those described in FIG. 4 and FIG. 5, and therefore use common reference numerals referring to common objects.
[0115] FIG. 6 includes a simulated conversation (600). The simulated conversation (600) is similar to simulated conversation (400) that took place in FIG. 4. Thus, conversation (400) includes sim prompt (402), test question (404), sim answer (406), test question (408), sim answer (410), and test answer (412). However, the simulated conversation (600) also includes a number of additional conversation turns, and thus also includes a number of additional test queries and sim answers, including test queries (602) and sim answers (604). Additionally, the sim model provides a sim conclusion (606), which is an output that informs the test model that the test answer (412) satisfactorily answers the sim prompt (402).
[0116] Referring to the mathematical formulations described with respect to FIG. 2, the simulated conversation (600) at any point may be represented by E. Thus, for example E_0 (608) is the list of information (618) that the test model will use in order to answer the sim prompt (402). At each turn of the simulated conversation (600), the test prompt requests, and receives, another item of information in the list of information (618). The information that will be used changes each turn of the conversation, because at E_1 (610), the first revised list (620) removes the entry for “John's last name,” because that information has been provided by the test question (404). Thus, at each turn of the conversation, the value of “E” reduces. The process therefore continues at E_2 (612) and so forth until E_{t−1} (614), which is the penultimate information that will be used to answer the sim prompt (402). The final E(t) (616) represents the fact that the information that will be used to answer the sim prompt (402) has now been received in full.
[0117] At each turn of the conversation, the value of “info,” as defined in the equations described in FIG. 2, changes. Thus, at sim prompt (402), the “info” is info_0 (622), and then proceeds to info_1 (624), info_2 (626), info_{t−1} (628), and info_{t} (630).
[0118] At each turn of the conversation, then, the values of “info” may be used to determine the conditional probabilities of each info as described in equations (1) and (2) as described in FIG. 2. From the conditional probability, the system entropy values, at each conversation turn, may be determined using equations (3), (4), and (5) as described in FIG. 2. From the system entropy values, at each conversation turn, the information gains at each conversation turn may be determined using equations (6), (7), and (8) as described in FIG. 2.
[0119] FIG. 8 shows graph charts showing the information gains for the two test models. Specifically, FIG. 8 shows an information gain chart for the first test model (700) and an information gain chart for the second test model (702). The information gain chart for the first test model (700) may be generated from the information gain determined at each turn in the conversation (400), as described in more detail in FIG. 6. The information gain chart for the second test model (702) may be generated from the information gain determined by the single turn in the conversation (500), as shown in FIG. 5.
[0120] As can be seen by comparing the two information gain charts in FIG. 8, the first test model has a lower information gain than the second test model. The difference information gain is shown by the taller bars in the information gain chart for the second test model (702), relative to the bars in the information gain chart for the first test model (700).
[0121] Thus, a model system may be improved by selecting the second test model for deployment in an enterprise system. Alternatively, the second test model may be retrained using a reward-based loss function that rewards fewer turns and penalizes more turns. In either case, the model itself or the model system may be improved, thereby accomplishing the technical solution to the technical problem of how to automatically evaluate the performance of a language model, and then improve the language model according to a metric that represents a quantitative assessment of the performance of the language model.
[0122] One or more embodiments may be implemented on a computing system specifically designed to achieve an improved technological result. When implemented in a computing system, the features and elements of the disclosure provide a significant technological advancement over computing systems that do not implement the features and elements of the disclosure. Any combination of mobile, desktop, server, router, switch, embedded device, or other types of hardware may be improved by including the features and elements described in the disclosure.
[0123] For example, as shown in FIG. 8A, the computing system (800) may include one or more computer processor(s) (802), non-persistent storage device(s) (804), persistent storage device(s) (806), a communication interface (808) (e.g., Bluetooth interface, infrared interface, network interface, optical interface, etc.), and numerous other elements and functionalities that implement the features and elements of the disclosure. The computer processor(s) (802) may be an integrated circuit for processing instructions. The computer processor(s) (802) may be one or more cores, or micro-cores, of a processor. The computer processor(s) (802) includes one or more processors. The computer processor(s) (802) may include a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), combinations thereof, etc.
[0124] The input device(s) (810) may include a touchscreen, keyboard, mouse, microphone, touchpad, electronic pen, or any other type of input device. The input device(s) (810) may receive inputs from a user that are responsive to data and messages presented by the output device(s) (812). The inputs may include text input, audio input, video input, etc., which may be processed and transmitted by the computing system (800) in accordance with one or more embodiments. The communication interface (808) may include an integrated circuit for connecting the computing system (800) to a network (not shown) (e.g., a local area network (LAN), a wide area network (WAN) such as the Internet, mobile network, or any other type of network) or to another device, such as another computing device, and combinations thereof.
[0125] Further, the output device(s) (812) may include a display device, a printer, external storage, or any other output device. One or more of the output device(s) (812) may be the same or different from the input device(s) (810). The input device(s) (810) and output device(s) (812) may be locally or remotely connected to the computer processor(s) (802). Many different types of computing systems exist, and the aforementioned input device(s) (810) and output device(s) (812) may take other forms. The output device(s) (812) may display data and messages that are transmitted and received by the computing system (800). The data and messages may include text, audio, video, etc., and include the data and messages described above in the other figures of the disclosure.
[0126] Software instructions in the form of computer readable program code to perform embodiments may be stored, in whole or in part, temporarily or permanently, on a non-transitory computer readable medium such as a solid state drive (SSD), compact disk (CD), digital video disk (DVD), storage device, a diskette, a tape, flash memory, physical memory, or any other computer readable storage medium. Specifically, the software instructions may correspond to computer readable program code that, when executed by the computer processor(s) (802), is configured to perform one or more embodiments, which may include transmitting, receiving, presenting, and displaying data and messages described in the other figures of the disclosure.
[0127] The computing system (800) in FIG. 8A may be connected to, or be a part of, a network. For example, as shown in FIG. 8B, the network (820) may include multiple nodes (e.g., node X (822) and node Y (824), as well as extant intervening nodes between node X (822) and node Y (824)). Each node may correspond to a computing system, such as the computing system shown in FIG. 8A, or a group of nodes combined may correspond to the computing system shown in FIG. 8A. By way of an example, embodiments may be implemented on a node of a distributed system that is connected to other nodes. By way of another example, embodiments may be implemented on a distributed computing system having multiple nodes, where each portion may be located on a different node within the distributed computing system. Further, one or more elements of the aforementioned computing system (800) may be located at a remote location and connected to the other elements over a network.
[0128] The nodes (e.g., node X (822) and node Y (824)) in the network (820) may be configured to provide services for a client device (826). The services may include receiving requests and transmitting responses to the client device (826). For example, the nodes may be part of a cloud computing system. The client device (826) may be a computing system, such as the computing system shown in FIG. 8A. Further, the client device (826) may include or perform all or a portion of one or more embodiments.
[0129] The computing system of FIG. 8A may include functionality to present data (including raw data, processed data, and combinations thereof) such as results of comparisons and other processing. For example, presenting data may be accomplished through various presenting methods. Specifically, data may be presented by being displayed in a user interface, transmitted to a different computing system, and stored. The user interface may include a graphical user interface (GUI) that displays information on a display device. The GUI may include various GUI widgets that organize what data is shown, as well as how data is presented to a user. Furthermore, the GUI may present data directly to the user, e.g., data presented as actual data values through text, or rendered by the computing device into a visual representation of the data, such as through visualizing a data model.
[0130] As used herein, the term “connected to” contemplates multiple meanings. A connection may be direct or indirect (e.g., through another component or network). A connection may be wired or wireless. A connection may be a temporary, permanent, or a semi-permanent communication channel between two entities.
[0131] The various descriptions of the figures may be combined and may include, or be included within, the features described in the other figures of the application. The various elements, systems, components, and steps shown in the figures may be omitted, repeated, combined, or altered as shown in the figures. Accordingly, the scope of the present disclosure should not be considered limited to the specific arrangements shown in the figures.
[0132] In the application, ordinal numbers (e.g., first, second, third, etc.) may be used as an adjective for an element (i.e., any noun in the application). The use of ordinal numbers is not to imply or create any particular ordering of the elements, nor to limit any element to being only a single element unless expressly disclosed, such as by the use of the terms “before,”“after,”“single,” and other such terminology. Rather, ordinal numbers distinguish between the elements. By way of an example, a first element is distinct from a second element, and the first element may encompass more than one element and succeed (or precede) the second element in an ordering of elements.
[0133] Further, unless expressly stated otherwise, the conjunction “or” is an inclusive “or” and, as such, automatically includes the conjunction “and,” unless expressly stated otherwise. Further, items joined by the conjunction “or” may include any combination of the items with any number of each item, unless expressly stated otherwise.
[0134] In the above description, numerous specific details are set forth in order to provide a more thorough understanding of the disclosure. However, it will be apparent to one of ordinary skill in the art that the technology may be practiced without these specific details. In other instances, well-known features have not been described in detail to avoid unnecessarily complicating the description. Further, other embodiments not explicitly described above can be devised which do not depart from the scope of the claims as disclosed herein. Accordingly, the scope should be limited only by the attached claims.
Claims
1. A method comprising:processing a sim model to output a sim prompt, wherein:the sim model comprises a first language model,the sim prompt comprises a request to perform a natural language task, andthe sim model comprises a first chatbot and the test model comprises a second chatbot;processing a test model on the sim prompt to output at least one test output,wherein:each at least one test output comprises a corresponding token, and processing the sim model and processing the test model, together,comprises simulating a conversation between the first chatbot and the second chatbot;determining an information gain metric of the at least one test output,wherein the information gain metric is based on an entropy metric determined from execution information generated by the test model while processing the test model on the sim prompt; andimproving, according to the information gain metric, the test model.
2. The method of claim 1, wherein:the sim prompt further comprises a plurality of answers to questions returned by the test model,the test model generates the plurality of questions as part of processing on the sim prompt.
3. The method of claim 2, wherein:the entropy metric comprises both a first entropy metric of a first answer of the plurality of answers and a second entropy metric of a second answer of the plurality of answers, andthe information gain metric comprises a difference between the first entropy metric and the second entropy metric.
4. The method of claim 1,wherein the entropy metric is determined according to a conditional probability of a sequence of tokens generated by the test model while processing on the sim prompt, andwherein the sequence of tokens represents a net information that the test model will use to process the sim prompt.
5. The method of claim 1, wherein:the sim model comprises a first chatbot and the test model comprises a second chatbot,processing the sim model and processing the test model, together, comprises simulating a conversation between the first chatbot and the second chatbot,the sim model generates, during the conversation, a plurality of answers to questions returned by the test model,the test model generates the plurality of questions as part of processing on the sim prompt, andthe determining the information gain metric further comprises:generating a first entropy metric of a first answer of the plurality of answers,generating a second entropy metric of a second answer of the plurality of answers, andgenerating the information gain metric by determining a difference between the first entropy metric and the second entropy metric.
6. The method of claim 1, wherein improving the test model comprises:determining that the information gain metric fails to satisfy a gain threshold;generating, using the information gain metric, a loss function to maximize the information gain metric; andretraining the test model using the loss function.
7. The method of claim 1, wherein:processing the test model comprises processing a plurality of test models, including the test model, on the sim prompt to output a plurality of test outputs,determining a plurality of information gain metrics, including the information gain metric, for the plurality of test models, andimproving the test model comprises:determining that the test model has a highest information gain metric in the plurality of information gain metrics;selecting the test model from among the plurality of test models; anddeploying the test model in an enterprise environment.
8. The method of claim 7, wherein:processing the plurality of test models includes generating a plurality of conversations between the sim model and the plurality of test models, andeach conversation in the plurality of conversations comprises a corresponding number of turns until a corresponding final answer is achieved,each corresponding number of turns represents a number of questions generated by the test model and a number of answers generated by the sim model, andthe test model minimizes the corresponding number of turns for the test model.
9. The method of claim 1, wherein the method further comprises:receiving a user prompt, wherein:processing the test model comprises processing a plurality of test models, including the test model, on the user prompt to output a plurality of test outputs, and wherein the sim prompt is generated based on the user prompt,determining a plurality of information gain metrics, including the information gain metric, for the plurality of test models, andimproving the test model comprises:determining that the test model has a highest information gain metric in the plurality of information gain metrics;selecting the test model from among the plurality of test models; androuting the user prompt to the test model.
10. A system comprising:a computer processor;a data repository in communication with the computer processor and storing:a sim prompt comprising a request to perform a natural language task, at least one test output, wherein each at least one test output comprises a corresponding token,an information gain metric of the at least one test output, andan entropy metric of the at least one test output;a sim model executable by the computer processor to generate the sim prompt,wherein the sim model comprises a first chatbot;a test model executable by the computer processor on the at least one test output to output the corresponding token, wherein the test model generates execution information while processing the sim prompt, and wherein the test model comprises a second chatbot;a server controller executable by the computer processor to:command processing, by the computer processor, of the sim model and of the test model, wherein processing of the sim model and of the test model, together, comprises simulating a conversation between the first chatbot and the second chatbot,determine an information gain metric of the at least one test output, wherein the information gain metric is based on an entropy metric determined from the execution information, andimprove, according to the information gain metric, the test model.
11. The system of claim 10, wherein:the sim prompt further comprises a plurality of answers to questions returned by the test model, andthe test model generates the plurality of questions as part of processing on the sim prompt.
12. The system of claim 11, wherein:the entropy metric comprises both a first entropy metric of a first answer of the plurality of answers and a second entropy metric of a second answer of the plurality of answers,the information gain metric comprises a difference between the first entropy metric and the second entropy metric, andthe entropy metric is determined according to a conditional probability of a sequence of tokens generated by the test model while processing on the sim prompt, and wherein the sequence of tokens represents a net information that the test model will use to process the sim prompt.
13. The system of claim 10, wherein:the sim model comprises a first chatbot and the test model comprises a second chatbot,processing the sim model and processing the test model, together, comprises simulating a conversation between the first chatbot and the second chatbot,the sim model generates, during the conversation, a plurality of answers to questions returned by the test model,the test model generates the plurality of questions as part of processing on the sim prompt, andthe determining the information gain metric further comprises:generating a first entropy metric of a first answer of the plurality of answers,generating a second entropy metric of a second answer of the plurality of answers, andgenerating the information gain metric by determining a difference between the first entropy metric and the second entropy metric.
14. The system of claim 10, wherein improving the test model comprises:determining that the information gain metric fails to satisfy a gain threshold,generating, using the information gain metric, a loss function to maximize the information gain metric, andretraining the test model using the loss function.
15. The system of claim 10, wherein:processing the test model comprises processing a plurality of test models, including the test model, on the sim prompt to output a plurality of test outputs,determining a plurality of information gain metrics, including the information gain metric, for the plurality of test models, andimproving the test model comprises:determining that the test model has a highest information gain metric in the plurality of information gain metrics,selecting the test model from among the plurality of test models, anddeploying the test model in an enterprise environment.
16. The system of claim 15, wherein:processing the plurality of test models includes generating a plurality of conversations between the sim model and the plurality of test models,each conversation in the plurality of conversations comprises a corresponding number of turns until a corresponding final answer is achieved,each corresponding number of turns represents a number of questions generated by the test model and a number of answers generated by the sim model, andthe test model minimizes the corresponding number of turns for the test model.
17. The system of claim 10, wherein the server computer is further executable by the computer processor to:receive a user prompt, wherein:processing the test model comprises processing a plurality of test models, including the test model, on the user prompt to output a plurality of test outputs, and wherein the sim prompt is generated based on the user prompt,determining a plurality of information gain metrics, including the information gain metric, for the plurality of test models, andimproving the test model comprises:determining that the test model has a highest information gain metric in the plurality of information gain metrics,selecting the test model from among the plurality of test models, and routing the user prompt to the test model.
18. A method comprising:processing a sim model and a test model such that the sim model and the test model simulate a conversation, wherein processing the sim model and the test model comprises:initiating, by the sim model, the conversation by providing, as input, a sim prompt to the test model, wherein the sim prompt comprises a request to perform a natural language task,generating, by the test model, a question to the sim model to provide additional information in order to perform the natural language task,generating, by the sim model, an answer to the question,generating, by the test model using the sim prompt and the answer, an output comprising the natural language task;determining a plurality of entropy metrics from execution information generated by the test model while the test model generates the question and the output;determining an information gain metric of the conversation from the plurality of entropy metrics; andimproving, according to the information gain metric, the test model.
Citation Information
Patent Citations
Resource-level classification using language models
US12277504B1
Language model improvement through automated prompt engineering
US12481651B1
Saving production runs of a function as unit test and automatic output regeneration
US20240403634A1
Controlling uncertain output by large language models
US20250021468A1
System and method for large language model based automated test input generation for web applications
US20250045150A1
