Systems and methods for improving prompt engineering

The system addresses prompt crafting challenges by using machine learning models to enhance AI response accuracy and consistency through improved prompt generation and evaluation.

US20260377690A1Pending Publication Date: 2026-11-26FMR CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/215649
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Crafting prompts for generative AI models is challenging due to their sensitivity to wording, lack of understanding of human intent, and limited context retention, leading to hallucinations and misinformation.

Method used

A system using two machine learning models to generate and evaluate candidate prompts and responses, determining an improved prompt with higher similarity scores and performing chain-of-thought reasoning to enhance accuracy and clarity.

Benefits of technology

The system generates prompts that reduce hallucinations, improving the accuracy and consistency of AI responses by identifying optimal wordings and logical steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260377690A1-D00000_ABST
    Figure US20260377690A1-D00000_ABST
Patent Text Reader

Abstract

Systems and methods are described for improving prompt engineering. More specifically, a system may receive at least one of a user prompt, testing data, and a reference answer. The system may generate (by using a first machine learning model) candidate prompts based on at least one of the user prompt, the testing data, and the reference answer. The system may then generate (by using a second machine learning model) candidate responses based on the candidate prompts. The system may then determine (by using the first machine learning model) candidate scores for the candidate responses. The candidate score for each candidate response may be determined based on how similar the candidate response is with respect to the reference answer. The system determines the improved prompt based on the candidate prompt that is associated with the candidate response having the highest candidate score.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] This application relates generally to systems and methods, including computer program products, for improving prompt engineering.BACKGROUND

[0002] Crafting a prompt is extremely important in the field of generative artificial intelligence (AI) or large language models (LLM). This is because carelessly crafting a prompt can lead to hallucinations in the LLM (e.g., the LLM generates responses that are factually inconsistent and misleading, and include fabricated information). As is evident, this is a problem, since hallucinated responses can lead to spread of misinformation, thereby leading to possibly harmful consequences.

[0003] Nevertheless, it is often extremely difficult to craft a prompt that leads to reduced or no hallucinations. One main reason for this difficulty is it is not possible for a human to understand the specific impact a prompt has on generating a response because the processing performed in the human mind is not the same as the processing performed in a machine learning model (e.g., the human brain vs. a neural network). More specifically, LLMs are very sensitive to wording. Even slight changes in word choice, phrasing, or sentence structure can result in different responses.

[0004] Further, LLMs do not understand “intent” in the same way as humans do. Instead, LLMs generate a response based on patterns in data on which they have been trained. For example, if the prompt is vague (e.g., ambiguous), the LLM might be unable to determine what is required in the response. In addition, LLMs heavily rely on context that is provided in the prompt. This may pose a problem because the LLM may have been designed to hold a limited amount of information before forgetting it (e.g., memory). Therefore, if the prompt is too long, the LLM may lose focus. Likewise, if the prompt is too short, the LLM may not completely understand the objective. As such, there remains a need to craft prompts that cause a generative AI or an LLM to provide answers without any hallucinations.SUMMARY

[0005] The present disclosure, in one aspect, a computing system for improving prompt engineering, the system comprising a server computing system having memory for storing computer-executable instructions and a processor that executes the computer-executable instructions to: receive a prompt, testing data that includes information that provides an answer to the prompt, and a reference answer that provides a correct answer to the prompt; generate an improved prompt that is configured to cause a machine learning model to generate a more accurate response than using the prompt, wherein the improved prompt is generated by: generating, via a first machine learning model, one or more candidate prompts based on the prompt, the testing data, and the reference answer, wherein each of the one or more candidate prompts are different variations of the prompt: generating, via a second machine learning model, one or more candidate responses corresponding to each of the one or more candidate prompts, wherein each candidate response is generated based on the corresponding candidate prompt, the testing data, and the reference answer, and wherein the first machine learning model is trained on larger amounts of data than the second machine learning model; and determining, via the first machine learning model, one or more candidate scores based on a similarity between the reference answer and each of the one or more candidate responses, wherein the candidate prompt associated with a highest candidate score of the one or more candidate scores is determined to be the improved prompt; and display the improved prompt on a user interface.

[0006] The first machine learning model continuously generates a candidate response based on the prompt, the testing data, and the reference answer, until it is determined that a candidate score, corresponding to a candidate prompt generated based on the candidate prompt, begins to decrease or until it is determined that a candidate prompt has generated a candidate response that is associated with a maximum candidate score. The computer-executable instructions cause the processor to perform further operations to: generate, via the first machine learning model, one or more difference scores for the improved prompt by determining differences between the improved prompt and the prompt based on at least one of grammar, punctuation, context, clarity, and specificity. The computer-executable instructions cause the processor to perform further operations to: generate, via the first machine learning model, a similarity score based on the one or more difference scores; and display the similarity score on the user interface.

[0007] The computer-executable instructions cause the processor to perform further operations to: generate a consistency score for the prompt by: generating, via the second machine learning model, two or more consistency responses based on the prompt; and determining the consistency score based on the number of consistency responses that are similar to each other; and display the consistency score on the user interface. The computer-executable instructions cause the processor to perform further operations to: generate a correction score by: generating, via the first machine learning model, a correction response, based on the prompt, the testing data, and the reference answer; and determining, via the first machine learning model, the correction score based on the similarity between the correction response and the reference answer.

[0008] The correction score is associated with a numerical value, in which a higher numerical value indicates that the correction response is more similar to the reference answer and a lower numerical value indicates that the correction response is less similar to the reference answer. The first machine learning model is instructed to perform chain-of-thought reasoning when determining the correction score, and wherein the chain-of-thought reasoning performed by the first machine learning model indicates one or more logical steps that the second machine learning model has made in determining the correction score. The chain-of-thought reasoning is displayed on the user interface along with the correction score.

[0009] The computer-executable instructions cause the processor to perform further operations to: generate, via the second machine learning model, a test response based on one or more outliers and the improved prompt, wherein the one or more outliers are generated by: generating one or more embeddings, in which each embedding corresponds to a sentence in the testing data; and performing a clustering algorithm on the one or more embeddings to determine one or more clusters and one or more centroids with respect to the one or more clusters, wherein the one or more outliers are determined to be the embeddings that have distances from the one or more centroids that are greater than or equal to a predetermine threshold. The computer-executable instructions cause the processor to perform further operations to: generate a test score by: determining, via the second machine learning model, the test score based on the similarity between the test response and the reference answer. The clustering algorithm is at least one of HDBScan (Hierarchical Density-Based Spatial Clustering of Applications with Noise) or k-means clustering.

[0010] The present disclosure, in another aspect, features a computerized method for improving prompt engineering, the method comprising: receiving, by server computing device, a prompt, testing data that includes information that provides an answer to the prompt, and a reference answer that provides a correct answer to the prompt; generating, by the server computing device, an improved prompt that is configured to cause a machine learning model to generate a more accurate response than using the prompt, wherein the improved prompt is generated by: generating, by the server computing device using a first machine learning model, one or more candidate prompts based on the prompt, the testing data, and the reference answer, wherein each of the one or more candidate prompts are different variations of the prompt: generating, by the server computing device using a second machine learning model, one or more candidate responses corresponding to each of the one or more candidate prompts, wherein each candidate response is generated based on the corresponding candidate prompt, the testing data, and the reference answer, and wherein the first machine learning model is trained on larger amounts of data than the second machine learning model; and determining, by the server computing device using the first machine learning model, one or more candidate scores based on a similarity between the reference answer and each of the one or more candidate responses, wherein the candidate prompt associated with a highest candidate score of the one or more candidate scores is determined to be the improved prompt; and displaying, by the server computing device, the improved prompt on a user interface.

[0011] The first machine learning model continuously generates a candidate response based on the prompt, the testing data, and the reference answer, until it is determined that a candidate score, corresponding to a candidate prompt generated based on the candidate prompt, begins to decrease or until it is determined that a candidate prompt has generated a candidate response that is associated with a maximum candidate score. The computerized method, further comprising: generating, by the server computing device using the first machine learning model, one or more difference scores for the improved prompt by determining differences between the improved prompt and the prompt based on at least one of grammar, punctuation, context, clarity, and specificity. The computerized method, further comprising: generating, by the server computing device using the first machine learning model, a similarity score based on the one or more difference scores; and displaying, by the server computing device, the similarity score on the user interface.

[0012] The computerized method, further comprising: generating, by the server computing device, a consistency score for the prompt by: generating, by the server computing device using the second machine learning model, two or more consistency responses based on the prompt; and determining, by the server computing device , the consistency score based on the number of consistency responses that are similar to each other; and displaying, by the server computing device, the consistency score on the user interface. The computerized method, further comprising: generating, by the server computing device, a correction score by: generating, by the server computing device using the first machine learning model, a correction response, based on the prompt, the testing data, and the reference answer; and determining, by the server computing device using the first machine learning model, the correction score based on the similarity between the correction response and the reference answer.

[0013] The correction score is associated with a numerical value, in which a higher numerical value indicates that the correction response is more similar to the reference answer and a lower numerical value indicates that the correction response is less similar to the reference answer. The first machine learning model is instructed to perform chain-of-thought reasoning when determining the correction score, and wherein the chain-of-thought reasoning performed by the first machine learning model indicates one or more logical steps that the first machine learning model has made in determining the correction score. The chain-of-thought reasoning is displayed on the user interface along with the correction score.

[0014] The computerized method, further comprising: generating, by the server computing device using the second machine learning model, a test response based on one or more outliers and the improved prompt, wherein the one or more outliers are generated by: generating, by the server computing device, one or more embeddings, in which each embedding corresponds to a sentence in the prompt, the testing data, and the reference answer; and performing, by the server computing device, a clustering algorithm on the one or more embeddings to determine one or more clusters and one or more centroids with respect to the one or more clusters, wherein the one or more outliers are determined to be the embeddings that have distances from the one or more centroids that are greater than or equal to a predetermine threshold. The computerized method, further comprising: generating, by the server computing device, a test score by: determining, by the server computing device using the second machine learning model, the test score based on the similarity between the test response and the reference answer. The clustering algorithm is at least one of HDBScan (Hierarchical Density-Based Spatial Clustering of Applications with Noise) or k-means clustering.BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The advantages of the invention described above, together with further advantages, may be better understood by referring to the following description taken in conjunction with the accompanying drawings. The drawings are not necessarily to scale, emphasis instead generally being placed upon illustrating the principles of the invention.

[0016] FIG. 1 is a block diagram of a system for improving prompt engineering.

[0017] FIG. 2 is a flow diagram of a computerized method for generating improved prompt.

[0018] FIG. 3A shows an example diagram of a user prompt.

[0019] FIG. 3B shows an example diagram of a testing data item that is included in a testing data.

[0020] FIG. 3C shows an example diagram of a reference answer, which provides the correct response to the user prompt shown in FIG. 3A.

[0021] FIG. 3D shows an example diagram of a table illustrating multiple candidate prompts, their corresponding candidate responses (that is generated by a machine learning model based on the corresponding candidate prompt), their corresponding candidate scores, and their corresponding composite scores.

[0022] FIG. 4 shows an example diagram of a table illustrating the comparisons between an improved (or candidate) prompt and the user prompt.

[0023] FIG. 5 is a flow diagram of a computerized method for generating consistency score.

[0024] FIG. 6A shows an example diagram of a table illustrating multiple responses generated by a machine learning model based on the user prompt and the corresponding user prompt consistency score.

[0025] FIG. 6B shows an example diagram of a table illustrating multiple responses generated by a machine learning model based on the improved prompt and the corresponding improved prompt consistency score.

[0026] FIG. 7 is a flow diagram of a computerized method for generating correction score.

[0027] FIG. 8 shows an example diagram of a table illustrating a response generated by a machine learning model based on the user prompt and the corresponding correction score.

[0028] FIG. 9 is a flow diagram of a computerized method for generating stress test score.

[0029] FIG. 10 is an example diagram of a chart showing the clustering of embeddings generated from testing data.

[0030] FIG. 11 is a flow diagram of a computerized method for analyzing user prompt.

[0031] FIG. 12 is a diagram of an illustrative computing system.DETAILED DESCRIPTION

[0032] In describing preferred embodiments illustrated in the drawings, specific terminology is employed herein for the sake of clarity. However, this disclosure is not intended to be limited to the specific terminology so selected and it is to be understood that each specific element includes all technical equivalents that operate in a similar manner. In addition, a detailed description of known functions and configurations is omitted from this specification when it may obscure the inventive aspects described herein.

[0033] Various tools are discussed herein to facilitate the invention(s) disclosed herein. It should be appreciated by those skilled in the art that any one or more of such tools may be embedded in the application and / or in any of various other ways, and thus while various examples are discussed herein, the inventive aspects of this disclosure are not limited to such examples described herein.

[0034] FIG. 1 is a block diagram of a system for 100, which includes a client computing device 102, a server computing device 106, and a testing database 110, all of which are capable of communicating with each other via a communication network 104.

[0035] The client computing device 102 can be coupled to a display device (not shown), such as a monitor, display panel, or screen. For example, client computing device 102 can provide a graphical user interface (GUI) via the display device to a user of corresponding device that presents output resulting from the methods and systems described herein and receives input from the user for further processing. Further, the client computing device 102, may include one or more applications that provide additional functionality to the client computing device 102. For example, the client computing device 102 may include a browser application that allows access to the services provided by devices on system 100, via a website, which can be reached by entering a uniform resource locator (URL). Exemplary client computing device 102 include but is not limited to desktop computers, laptop computers, tablets, mobile devices, smartphones, smart watches, Internet-of-Things (IoT) devices, and internet appliances. It should be appreciated that other types of client computing devices that are capable of connecting to components of the system 100 can be used without departing from the scope of invention. Although FIG. 1 depicts a single client computing device 102, it should be appreciated that system 100 can include any number of client computing devices 102.

[0036] The communication network 104 can be a local area network, a wide area network, a cellular network, or any type of network such as an intranet, an extranet (for example, to provide controlled access to external users, for example through the Internet), a private or public cloud network, the Internet, etc., or a combination thereof. In addition, the communication network 104 preferably uses TCP / IP (Transmission Control Protocol / Internet Protocol), but other protocols such as SNMP (Simple Network Management Protocol) and HTTP (Hypertext Transfer Protocol) can also be used. In some embodiments, the communication network 104 is comprised of several discrete networks and / or sub-networks (e.g., cellular to Internet).

[0037] The server computing device 106 is a device including specialized hardware and / or software modules that execute on a processor and interact with memory modules of the server computing device 106, to transmit data to other components of the system 106, and to receive data from other components of the system 100, as described herein. The server computing device 106 includes several systems, frameworks, stores, and computing modules that execute on one or more processors of the server computing device 106. For example, the server computing device 106 includes a user interface module 106a, a prompt improvement module 106b, a prompt consistency module 106c, a prompt correction module 106d, a prompt stress testing module 106e, a prompt analysis module 106f, and a machine learning store 108 (which can store all types of machine learning models, such as classification type machine learning model(s), regression type machine learning model(s), support vector machines (SVM) machine learning model(s), ensemble method machine learning model(s), neural network model(s), recurrent neural networks (e.g., long short term memory), deep learning model(s), or (large) language model(s)) and a code executer store 110 (which can store all types of code compilers or code interpreters). In some embodiments, the user interface module 106a, the prompt improvement module 106b, the prompt consistency module 106c, the prompt correction module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108 are specialized sets of computer software instructions programmed onto one or more dedicated processors in server computing device 106 and can include specifically-designated memory locations and / or registers for executing the specialized computer software instructions.

[0038] Although the user interface module 106a, the prompt improvement module 106b, the prompt consistency module 106c, the prompt correction module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108 are shown in FIG. 1 as executing within the same server computing device 106, in some embodiments the functionality of the user interface module 106a, the prompt improvement module 106b, the prompt consistency module 106c, the prompt correction module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108 can be distributed among a plurality of server computing devices. As shown in FIG. 1, the server computing device 106 allows the user interface module 106a, the prompt improvement module 106b, the prompt consistency module 106c, the prompt correction module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108, to communicate with each other in order to exchange data for the purpose of performing the described functions.

[0039] It should be appreciated that any number of computing devices, arranged in a variety of architectures, resources, and configurations (e.g., cluster computing, visual computing, cloud computing) can be used without departing from the scope of the invention. Exemplary functionality of the user interface module 106a, the prompt improvement module 106b, the prompt consistency module 106c, the prompt correction module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108 are described in detail below.

[0040] The testing data database 110 is a computing device (or, in some embodiments, may be a set of computing devices) that is configured to provide, receive and store various types of testing data items. A testing data item may include information (e.g., in electronic format) that can be presented for viewing and / or listening by a user. For example, the testing data item may be in the format of text, images, audio, video, or a combination thereof. In some embodiments, one or more of the testing data items may be directed to the same field or subject matter (e.g., science, entertainment, medical, law, business, etc.) or the same topic (e.g., top movies of the year, best cities to live in, descriptions of birds in North America, etc.). It should be noted that, in some embodiments, the testing data items may be used to test or determine the quality of a user prompt.Example Routine for Generating an Improved Prompt

[0041] When a routine described herein (i.e., 200, 500, 700, 900, and 1100) is initiated, as set of executable program instructions stored on one or more non-transitory computer-readable media (e.g., hard drive, flash memory, removable media, etc.) may be loaded into memory (e.g., random access memory or RAM) of a computing device, such as the computing device 1200 shown in FIG. 12, and executed by one or more processors. In some embodiments, the routine 200, 500, 700, 900, and 1100 or portions thereof may be implemented on multiple processors, serially or in parallel.

[0042] FIG. 2 illustrates example routine 200 (beginning at block 202) for generating an improved prompt, that is performed, for example, by the server computing device 106. At block 202, the user interface module 106a receives instructions, a user prompt, testing data, and a reference answer from, for example, a user using a client computing device (e.g., client computing device 102). In some embodiments, at least one of the user prompt, the testing data, and the reference answer are disposed in files from which the user uploads to the server computing device 106 via the user interface module 106a. In some embodiments, the user interface module 106a provides one or more fields for the user to input (e.g., type in) the user prompt, the testing data, and the reference answer. In some embodiments, the user interface module 106a may provide a field for the user to specify where the server computing device 106 can obtain the specific testing data (e.g., via a uniform resource locator (URL) associated with the testing data database 110).

[0043] The instructions may cause the server computing device 106 to generate an improved prompt based on the user prompt, the testing data, and the reference answer. More specifically, after the user interface module 106a receives the instruction, the user interface 106a may determine from the content of the instruction that the instruction corresponds to generating an improved prompt using the provided user prompt, the testing data, and the reference answer. In some embodiments, the instruction may simply be generated by activating an icon (e.g., button) on the user interface module 106a that corresponds to a predetermined instruction for generating the improved prompt. In some embodiments activating the icon causes the user prompt, the testing data, and the reference answer to be transmitted to the prompt improvement module 106b.

[0044] It should be noted that the user prompt may not necessarily be the most optimal prompt (e.g., have the best quality) that causes a machine learning model to generate an accurate response. For example, the user prompt may be confusing in how it is written (e.g., confusing from the perspective of a human and / or machine learning model). In another example, the user prompt may include one or more unnecessary words, phrases, and / or sentences that can be removed without affecting the quality of the prompt. In yet another example, the manner in which the user prompt is written or generated does not effectively guide the machine learning model to generate the correct response. It should be further noted that it is not possible for a human to gauge the quality of the user prompt because the processing performed in the human mind is not the same as the processing performed in a machine learning model (e.g., the human brain vs. a neural network). Therefore, the process exemplified by routine 200 of FIG. 2 allows an improved prompt to be generated based on the user prompt. In other words, the improved prompt may be capable of allowing the machine learning model to generate a better or more correct response than by using the user prompt.

[0045] The user prompt may be a prompt, which is an input (e.g., includes one or more text, documents, files, images, video, etc.), that guides a model to generate a specific output or perform a particular task. An example of the user prompt 302 is shown in FIG. 3A. In some embodiments, the user prompt may be in a natural language format. In some embodiments, the user prompt may include one or more words, phrases, and / or sentences. In some embodiments, at least one word, phrase, and / or sentence in the user prompt may correspond to an imperative mood (e.g., “Summarize the news article into a caption.”). In some embodiments, at least one word, phrase, and / or sentence in the user prompt may correspond to an interrogative mood (e.g., “To whom did the Virgin Mary allegedly appear in 1858 in Lourdes, France?”). In some embodiments, at least one word, phrase, and / or sentence in the user prompt may correspond to a declarative mood, which may assist in providing additional information (e.g., background information) to assist in generating a correct response to the user prompt. In some embodiments, at least one word, phrase, and / or sentence in the user prompt may correspond to an exclamatory mood to bring attention to an important word, phrase, and / or sentence.

[0046] The testing data may include one or more testing data items that may correspond to information utilized to generate a response based on the user prompt. An example of a testing data item 304 that corresponds to the user prompt 302 is shown in FIG. 3B. More specifically, the testing data may include information (e.g., in electronic format) that can be presented for viewing and / or listening by a user. For example, the content items may be in the format of text, images, audio (or audio files), video, or a combination thereof. In some embodiments, one or more of the content items may be directed to the same field or subject matter (e.g., science, entertainment, medical, law, business, etc.) or the same topic (e.g., top movies of the year, best cities to live in, descriptions of birds in North America, etc.). As discussed previously, the testing data (e.g., being associated with one or more testing data items) may be stored in the testing data database 110. Further, one or more modules disposed within the server computing device 106 (e.g., the user interface module 106a, the prompt improvement module 106b, the prompt correction module 106c, the prompt consistency module 106d, the prompt stress testing module 106e, the prompt analysis module 106f, and the machine learning store 108) may have access to the testing data database 110.

[0047] The reference answer may be a predetermined correct answer (e.g., as determined by a human) to a query that is included in at least one of the user prompt or the testing data (e.g., query: “What are the colors that make up the American flag?”; reference answer: “The colors that make up the American flag are red, white, and blue.”). An example of a reference answer 306, which provides the correct response to the user prompt 302 in view of the testing data item 304, is shown in FIG. 3C. In some embodiments, the reference answer may be in a natural language format. In some embodiments, the reference answer may be generated by a user (e.g., using the client computing device 102) based on, for example, a testing data item in the testing data. In some embodiments, the reference answer may already be included in a testing data item. More specifically, the testing data item may include content (e.g., context), a query regarding the content (e.g., question), and a reference answer that provides the correct answer to the query. In such case, the user prompt may instruct a machine learning model to respond to the query in the testing data item (e.g., “Given the context and question, extract the answer from context).

[0048] At block 206, an first machine learning model generates one or more candidate prompts. More specifically, after receiving the user prompt, the testing data (or the one or more testing data items), and the reference answer from the user interface module 106b, the prompt improvement module 106b may retrieve the first machine learning model from, for example, the machine learning store 108. The first machine learning model may generate one or more candidate prompts based on the user prompt, the testing data (or the one or more testing data items), and the reference answer. Each of the candidate prompts are unique variations of the user prompt. For example, each of the candidate prompts may include different words, phrases, sentences. In another example, each of the candidate prompts may be different in terms of at least one of grammar, punctuation, context, clarity, and / or specificity.

[0049] It should be noted that determining (and generating) the candidate prompts may be performed by the first machine learning model based on its training. In other words, the first machine learning model may be instructed to use its own judgment (e.g., based on previous training) to determine how to generate a variation of the user prompt. In some embodiments, the first machine learning model continuously generates a candidate response based on the user prompt, the testing data, and the reference answer, until the first machine learning model has exhausted generating each possible variation of the user prompt. In some embodiments, the first machine learning model continuously generates a candidate response based on the user prompt, the testing data, and the reference answer, until the improvement of the candidate scores diminishes or declines (e.g., as discussed infra). In some embodiments, the first machine learning model continuously generates a candidate response based on the user prompt, the testing data, and the reference answer, until the highest possible or maximum candidate score is reached. In other words, when the candidate prompt results in a candidate response with the highest candidate score, the first machine learning model ceases (or stops) generating candidate prompts. An example of candidate prompts 1, 2, and 3, which is generated by the first machine learning model based on user prompt 302, testing data item 304, and reference answer 306, is shown in table 308 of FIG. 3D. As shown in table 308, each of the candidate prompts 1, 2, and 3 are different from the user prompt 302, but provide similar kinds of guidance or instruction (e.g., to generate a news headline).

[0050] At block 208, an second machine learning model generates one or more candidate responses based on the one or more candidate prompts. It should be noted that the first machine learning model may be trained on larger amounts of data than the second machine learning model. For example, the first machine learning model may be a higher-end model than the second machine learning model. In another example, the first machine learning model may be more advanced than the second machine learning model. In a further example, the second machine learning model may be used for production or deployment. Consequently, the first machine learning model and the second learning model may be different from each other. More specifically, after the first machine learning model generates one or more candidate prompts, the prompt improvement module 106b may retrieve the second machine learning model from, for example, the machine learning store 108. The prompt improvement module 106b may input each of the candidate prompts into the second machine learning model to generate the candidate responses. It should be noted that the second machine learning model may generate the candidate response based on the candidate prompt and the knowledge acquired by the second machine learning model via prior or previous training.

[0051] At block 210, the first machine learning model determines one or more candidate scores for the one or more candidate responses. More specifically, the first machine learning model determines a candidate score based on the similarity between the candidate response and a corresponding reference answer. In some embodiments, the candidate score is rated on a scale of one-hundred (e.g., 100), in which a high candidate score (e.g., moving towards one-hundred) indicates high similarity between the candidate response and the reference answer, while a low candidate score (e.g., moving towards zero) indicates a low similarity between the candidate response and the reference answer.

[0052] In some embodiments, the determination of similarity is performed by the first machine learning model using its own judgment (e.g., based on previous training). In some embodiments, the first machine learning model performs a chain-of-thought reasoning to determine the one or more candidate scores. More specifically, chain-of-thought reasoning indicates one or more logical steps that the first machine learning model has made in determining the candidate score. For example, the chain-of-thought reasoning may cause the first machine learning model to explain the reasoning process (e.g., thinking out loud) in a series of logical steps before generating the final answer (e.g., candidate score). In other words, the first machine learning model breaks down the problem into smaller, logical steps and explains how it arrives at the answer.

[0053] For example, as shown by the table 308 in FIG. 3D, using the candidate prompt 1 (“Write a short, engaging summary of the news article”), the second machine learning model has generated a candidate response 1 (e.g., “Sweden ceases future aid to Cambodia in outcry over political crackdown.”) that is given a candidate score 1 that is high (e.g., “93.0”). This makes sense because the candidate response 1 is very similar to the reference answer 1 with a few minor differences (e.g., both state that Sweden stopped new aid to Cambodia due to suppression of political protests, but in a different manner). However, the candidate prompt 1 may not receive a full score of 100.0 because there may be some nuances that are lacking in the candidate response 1 (e.g., Sweden has not stopped all new aid; it has only stopped some new aid).

[0054] In another example, as shown by the table 308 in FIG. 3D, using the candidate prompt 2 (“Write a brief, engaging synopsis of the news article”), the second machine learning model has generated a candidate response 2 (e.g., “Sweden fails to provide aid for Cambodia”) that is given a candidate score 2 (e.g., “55.0”) that is moderate. This makes sense because the candidate response 2 does include a headline that is similar to the reference answer, but the headline is misleading and missing some context (e.g., The term “fails” seems to indicate that Sweden was in the wrong. However, Sweden was not wrong, since the cessation of aid was due to Cambodia’s undemocratic crackdown on protests. In addition, the failure to provide “new” aid was also not specified).

[0055] In another example, as shown by the table 308 in FIG. 3D, using the candidate prompt 3 (“Summarize the key points of the news article in an engaging manner”), the second machine learning model has generated a candidate response 3 (e.g., “Chinese-Russian influence grows in Cambodia.”) that is given a candidate score 3 (e.g., “0.0”) that is extremely low. This makes sense because the candidate response 3 is not similar to the reference answer at all (e.g., the candidate response 3 is a statement about a Cambodian political party while the reference answer is statement on the status of new aid given to Cambodia by Sweden).

[0056] At block 212, the prompt improvement module 106b determines the improved prompt based on the candidate prompt having highest candidate score. In other words, the prompt improvement module identifies the candidate score of each candidate response. The prompt improvement module 106b then determines that the candidate prompt corresponding to the candidate prompt having the highest candidate score is the most optimal prompt out of the candidate prompts that it has generated. For example, as shown in the table 308 of FIG. 3D, the candidate response having the highest candidate score is candidate response 1 (“Sweden ceases future aid to Cambodia in outcry over political crackdown.”), which has a candidate score of 93.0. Therefore, the corresponding candidate prompt (“Write a short, engaging summary of the news article”) is determined to be the improved prompt. In some embodiments, the most optimal candidate response is determined based on the average score across multiple samples.

[0057] At block 214, the first machine learning model generates a similarity score based on one or more difference scores. The one or more difference scores may be determined based on differences between improved prompt and the user prompt. More specifically, after the improved prompt is selected, the prompt improvement module 106b may cause (or instruct) the first machine learning model to generate one or more difference scores (based on one or more difference criteria) for the improved prompt in view of the user prompt. For example, the first machine learning model may determine the differences between the improved prompt and the user prompt based on one or more difference criteria, such as, but not limited to, grammar, punctuation, context, clarity, and specificity.

[0058] For example, grammar may correspond to the differences in usage of words and their placement within a sentence or phrase in the prompt. In another example, punctuation may correspond to the marks (e.g., period, comma, question mark, exclamation mark, colon, semicolon, hyphens, quotation marks, etc.) indicating how a word, phrase, or sentence should be read. In some embodiments, context may correspond to how the prompt provides additional information (e.g., which may correspond to additional information that assists the machine learning model in understanding the query in the prompt) for the machine learning model to more accurately generate the response. In some embodiments, clarity may correspond to how easy it is to understand or how clear a direction that the prompt is with respect to allowing the machine learning model to generate an accurate response. In some embodiments, specificity may correspond to how well the prompt is in providing specific instructions so that the machine learning model can generate a detailed (or complete) response.

[0059] After the first machine learning model determines the differences according to the difference criteria, the first machine learning model may generate a difference score according to each difference criterion. It should be noted that the determination of the difference score is performed by the first machine learning model using its own judgment (e.g., based on previous training). In other words, the first machine learning model may (e.g., be instructed by the prompt improvement module 106b to) determine the differences (between the improved prompt and the user prompt) and difference score (that is appropriate or proper) based on its own knowledge and / or previous training.

[0060] Then, the first machine learning model generates a similarity score based on the one or more difference scores. For example, the similarity score may be a representation of the one or more difference scores in a single numeric value. In other words, the similarity score represents a degree of difference (or a degree of similarity) between the improved prompt and the user prompt. Like previously, it should be noted that the determination of the similarity score is performed by the first machine learning model using its own judgment (e.g., based on previous training). In other words, the first machine learning model may (e.g., be instructed by the prompt improvement module 106b to) determine the similarity score based on its own knowledge and / or previous training. An example of similarity score is shown in table 308 of FIG. 3D, in which the similarity score for the improved prompt (i.e., candidate prompt 1) is shown to be 80.0% (in which a high percentage means that the user prompt and the improved prompt are similar).

[0061] At block 216, the first machine learning model generates a prompt analysis. More specifically, after the first machine learning model has generated the similarity score, the first machine learning model may generate an improved prompt analysis based on the comparisons between the improved prompt and the user prompt. In some embodiments, the first machine learning model may generate a candidate prompt analysis based on the comparisons between the one or more candidate prompts and the user prompt. In some embodiments, the first machine learning model may be instructed to use its own judgment (e.g., based on previous training) to determine how to generate the prompt analysis. In some embodiments, the first machine learning model may generate the prompt analysis based in part on the similarity scores and the candidate scores.

[0062] An example of the prompt analysis is illustrated by the table 402 in FIG. 4, which shows the analytical comparison between the improved prompt (i.e., candidate prompt 1) and the user prompt, the analytical comparison between the candidate prompt 2 and the user prompt, and the analytical comparison between the candidate prompt 3 and the user prompt. More specifically, the comparisons shown in table 402 of FIG. 4 show semantic differences between the improved (or candidate prompt) and the user prompt (e.g., The IMPROVED_PROMPT uses more engaging language, asking for a "short, engaging summary" as opposed to the USER_PROMPT which simply asks for a summary).

[0063] Likewise, the analytical comparisons also explain why a candidate prompt, for example, is better (e.g., more clear, specific, easy-to-understand, well-written) or worse (e.g., from the perspective of the first machine learning model) than the user prompt (e.g., “The CANDIDATE_PROMPT_2 is more well-written, easy to understand, and provides a clear direction for the AI model to generate a detailed and engaging summary. The USER_PROMPT is straightforward but lacks specificity and direction, which may lead to a less detailed and less engaging summary.”).

[0064] In addition, the prompt analysis also includes the similarity score that measures the similarity between improved (or candidate) prompt and the user prompt (e.g., “Similarity between two prompts: 80.0%”), a clarity score that measures the amount of clarity provided by the improved (or candidate) prompt (e.g., “Clarity for Improved Prompt 1: 0.9”), and a specificity score that measures how specific the improved (or candidate prompt) is (e.g., “Specificity for Improved Prompt 1: 1.0”).

[0065] At block 218, the first machine learning model generates a composite score. For example, the first machine learning model may generate a composite score for at least one of the user prompt, the improved prompt, and the candidate prompts. More specifically, the composite score may be a measurement corresponding to the weighted average of an accuracy, clarity, specificity, and similarity of at least one of the user prompt, the improved prompt, and the candidate prompts. In some embodiments, the first machine learning model may generate the composite score based on at least one of the prompt analysis, the candidate scores, and the similarity scores. It should be noted that the prompt analysis includes analysis in a natural language format. Therefore, when generating the composite score, the first machine learning model may also take into consideration the portion of the prompt analysis that is in a natural language format. An example of composite scores is shown in the table 402 of FIG. 4 (e.g., “Composite score* for user prompt: 72%”, “Composite score* for Candidate Prompt: 76%).

[0066] At block 220, the user interface module 106a displays the improved prompt, the similarity score, the composite score, and the prompt analysis. More specifically, after the first machine learning model generates the prompt analysis, the prompt improvement module 106b transmits the improved prompt, the similarity score (which may include similarity scores between the user prompt and the one or more candidate (and / or improved) prompts), the composite score (which may include composite scores for the improved prompt and / or the candidate prompts), and a prompt analysis (which may include analysis for the improved prompt and / or the candidate prompts in view of the user prompt) to the user interface module 106a for display before a user (e.g., using the client computing device 102). In some embodiments, the user may be displayed with a table 402 similar to the one shown in FIG. 4. At block 222, the routine ends.Example Routine for Generating Consistency Score

[0067] When a routine described herein (i.e., 200, 500, 700, 900, and 1100) is initiated, as set of executable program instructions stored on one or more non-transitory computer-readable media (e.g., hard drive, flash memory, removable media, etc.) may be loaded into memory (e.g., random access memory or RAM) of a computing device, such as the computing device 1200 shown in FIG. 12, and executed by one or more processors. In some embodiments, the routine 200, 500, 700, 900, and 1100 or portions thereof may be implemented on multiple processors, serially or in parallel.

[0068] FIG. 5 illustrates example routine 500 (beginning at block 502) for generating a consistency score, that is performed, for example, by the server computing device 106. At block 502, the user interface module 106a receives instructions, a prompt (e.g., user prompt or improved prompt) and testing data (e.g., including one or more testing data items) from, for example, a user using a client computing device (e.g., client computing device 102). In some embodiments, at least one of the prompt (e.g., user prompt and / or improved prompt) and the testing data are disposed in files from which the user uploads to the server computing device 106 via the user interface module 106a. In some embodiments, the user interface module 106a provides one or more fields for the user to input (e.g., type in) the prompt and the testing data. In some embodiments, the user interface module 106a may provide a field for the user to specify where the server computing device 106 can obtain the specific testing data (e.g., via a uniform resource locator (URL) associated with the testing data database 110).

[0069] The instructions may cause the server computing device 106 to determine how consistent the responses are generated by the second machine learning model when inputting the second machine learning model with the prompt. Such consistency may be measured or represented by a consistency score. More specifically, after the user interface module 106a receives the instruction, the user interface 106a may determine from the content of the instruction that the instruction corresponds to generating a consistency score using the provided user prompt and the testing data. In some embodiments, the instruction may simply be generated by activating an icon (e.g., button) on the user interface module 106a that corresponds to a predetermined instruction for generating the consistency score. In some embodiments activating the icon causes the user prompt and the testing data to be transmitted to the prompt consistency module 106c.

[0070] At block 506, the second machine learning model generates multiple consistency responses based on the prompt and the testing data. More specifically, after the prompt consistency module 106c receives the instructions, the prompt, and the testing data from the user interface module 106a, the prompt consistency module 106c may retrieve the second machine learning model from, for example, the machine learning store 108. Then, the prompt consistency module 106c may cause the second machine learning model to generate multiple responses based on the prompt. In other words, the second machine learning model may continuously generate a response based on the same prompt. In some embodiments, the second machine learning model may continuously generate a response until a predetermined number is reached. It should be noted that the second machine learning model may generate the responses based on the prompt, the testing data, and the knowledge acquired by the second machine learning model via prior or previous training.

[0071] For example, FIG. 6A illustrates a table 602, which illustrates one or more responses (e.g., response 1 to 5) that are generated by the second machine learning model based on the user prompt 302 of FIG. 3A and the testing data item 304 of FIG. 3B. In another example, FIG. 6B illustrates a table 604, which illustrates one or more responses (e.g., response 1 to 5) that are generated by the second machine learning model based on the improved prompt (which is determined to be the candidate prompt 1 as shown in table 308 of FIG. 3D) and the testing data item 304 of FIG. 3B.

[0072] At block 508, the prompt consistency module 106c determines one or more consistency scores based on the number of responses that are similar to each other. More specifically, after the one or more responses are generated by the second machine learning model, the prompt consistency module 106c may generate an embedding(s) or vector(s) for each generated response. For example, such generating may be facilitated using one or more sentence transformer. A sentence transformer is a type of machine learning model that encodes sentences into high-dimensional vectors (e.g., embeddings), which can then be used for various tasks such as semantic search, clustering, and sentence similarity. For example, the sentence transformer may have been trained to determine how to convert a word into an embedding, and may generate a list pairing each word to its corresponding vector equivalent.

[0073] In another example, the sentence transformer may be stored in the machine learning store 108. More specifically, the prompt consistency module 106c may retrieve the sentence transformer from the machine learning store 108 to generate the embeddings. As a result, when a sentence is input into the sentence transformer, the input sentence is tokenized (e.g., broken down into individual words or tokens). Such tokenization may be performed using a tokenizer specific to the underlying transformer model. Examples of tokenizers include WordPiece (as described in Y. Wu et al., "Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation" arXiv:1609.08144v2 [cs.CL]8 Oct. 2016, incorporated herein by reference) for BERT (Bidirectional Encoder Representations from Transformers) or Byte Pair Encoding (as described in “Neural Machine Translation of Rare Words with Subword Units” arXiv:1508.07909v5 [cs.CL]10 Jun. 2016, incorporated herein by reference) for RoBERTa (A Robustly Optimized BERT Pretraining Approach).

[0074] More specifically, embeddings are sentences represented according to a multidimensional vector (e.g., a word may be represented by a single row or column vector having fifty numbers as elements of the vector). A machine learning model (configured for embedding) or SentenceTransformers (which is a Python framework for state-of-the-art sentence, text and image embeddings.) may have been trained to determine how to convert a word or sentence into an embedding, and may generate a list pairing each word or sentence to its corresponding vector equivalent. As such, in some embodiments, the converting of the word or sentence into an embedding may not necessarily require such machine learning model configured for embedding (or the SentenceTransformers). Instead, a simple algorithm for matching words and sentences to predefined vectors may be used.

[0075] After generating the embeddings, the prompt consistency module 106c may determine their similarity to each other (e.g., consistency) by generating the consistency score. For example, the similarity between embeddings may be determined by semantic similarity among the embeddings. An example of a technique to determine semantic similarity between words or sentences is using a measurement function (e.g., a heuristic quantification method of keyword matching), such as cosine similarity, Euclidean distance, Manhattan distance, Jaccard similarity, and Minkowski distance. Cosine similarity may be determined by taking the division between the dot product of vectors and the product of the Euclidean norms or magnitude of each vector. The resulting cosine similarity score may range from zero to one, with a score closer to one indicating higher semantic similarity between the two words (e.g., “King” and “Man” have a score of 0.98), and a score closer to zero indicating lower semantic similarity between the two words (e.g., “King” and “car” have a score of 0.14). Consequently, the result of the measurement function may be used to generate the consistency score.

[0076] As shown in FIG. 6A, one or more of the responses (e.g., responses 1, 2, 3, and 5) are different from each other (e.g., in terms of grammar or words utilized). However, prompt consistency module 106c may determine based on the measurement function (e.g., performed on the embeddings) that such responses (e.g., responses 1, 2, 3, and 5) are similar to each other or have similar content (e.g., Sweden blocks aid to Cambodia over protest). Nevertheless, the prompt consistency module 106c may determine that at least one of the responses is not similar to the others (e.g., response 4). Therefore, the prompt consistency module 106c may determine that the consistency score for the user prompt 302 of FIG. 3A may be four out of five (e.g., 4 / 5) or eighty percent (e.g., 80%).

[0077] As shown in FIG. 6B, one or more of the responses (e.g., responses 1, 2, and 5) are different from each other (e.g., in terms of grammar or words utilized). However, the prompt consistency module 106c may determine that such responses (e.g., responses 1, 2, and 5) are similar to each other or have similar content (e.g., Sweden blocks aid to Cambodia over protest). The remaining responses (e.g., 3 and 4) are the same as another response (e.g., response 1). Therefore, the prompt consistency module 106c may determine that the consistency score for the improved prompt (which is determined to be the candidate prompt 1 as shown in table 308 of FIG. 3D) may be five out of five (e.g., 5 / 5) or one hundred percent (e.g., 100%).

[0078] At block 510, the user interface module 106a displays the consistency score. More specifically, after the prompt consistency module 106c generates the consistency score, the prompt consistency module 106c transmits the consistency score to the user interface module 106a for display before a user (e.g., using the client computing device 102). In some embodiments, the consistency score for a user prompt and a consistency score for an improved prompt may be generated simultaneously. Therefore, the user interface module 106a may cause both the consistency score for the user prompt and the consistency score the improved prompt to be displayed together (e.g., for comparison). At block 512, the routine ends.Example Routine for Generating Correction Score

[0079] When a routine described herein (i.e., 200, 500, 700, 900, and 1100) is initiated, as set of executable program instructions stored on one or more non-transitory computer-readable media (e.g., hard drive, flash memory, removable media, etc.) may be loaded into memory (e.g., random access memory or RAM) of a computing device, such as the computing device 1200 shown in FIG. 12, and executed by one or more processors. In some embodiments, the routine 200, 500, 700, 900, and 1100 or portions thereof may be implemented on multiple processors, serially or in parallel.

[0080] FIG. 7 illustrates example routine 700 (beginning at block 702) for generating a correction score, that is performed, for example, by the server computing device 106. At block 702, the user interface module 106a receives instructions, a user prompt, testing data (e.g., including one or more testing data items), and a reference answer from, for example, a user using a client computing device (e.g., client computing device 102). In some embodiments, at least one of the user prompt, the testing data, and the reference answer are disposed in files from which the user uploads to the server computing device 106 via the user interface module 106a. In some embodiments, the user interface module 106a provides one or more fields for the user to input (e.g., type in) the user prompt, the testing data, and the reference answer. In some embodiments, the user interface module 106a may provide a field for the user to specify where the server computing device 106 can obtain the specific testing data (e.g., via a uniform resource locator (URL) associated with the testing data database 110).

[0081] The instructions may cause the server computing device 106 to determine the accuracy of a response (e.g., based on the reference answer) when inputting the machine learning model with the user prompt. Such accuracy may be measured or represented by a correction score. In some embodiments, such determination may be similar to determine of a candidate score for a candidate prompt in block 210 of routine 200 of FIG. 2. More specifically, after the user interface module 106a receives the instruction, the user interface 106a may determine from the content of the instruction that the instruction corresponds to generating a correction score using the provided user prompt, the testing data, and the reference answer. In some embodiments, the instruction may simply be generated by activating an icon (e.g., button) on the user interface module 106a that corresponds to a predetermined instruction for generating the correction score. In some embodiments activating the icon causes the user prompt, the testing data, and the reference answer to be transmitted to the prompt correction module 106d.

[0082] At block 706, the first machine learning model generates a response based on the user prompt and the testing data. More specifically, after the prompt correction module 106d receives the instructions, the user prompt, the testing data, and the reference answer from the user interface module 106a, the prompt correction module 106d may retrieve the first machine learning model from, for example, the machine learning store 108. Then, the prompt consistency module 106c may cause the first machine learning model to generate a response based on the user prompt and the testing data. An example of a response generated based on the user prompt 302 of FIG. 3A and the testing data 304 of FIG. 3B is shown in table 802 of FIG. 8. It should be noted that the first machine learning model may generate the response based on the user prompt and the knowledge acquired by the first machine learning model via prior (or previous) training.

[0083] At block 708, the first machine learning model determines a correction score based on the similarity between the response and the reference answer. In some embodiments, the correction score is rated on a scale of one-hundred (e.g., 100), in which a high candidate score (e.g., moving towards one-hundred) indicates a high similarity between the response and the reference answer, while a low correction score (e.g., moving towards zero) indicates a low similarity between the response and the reference answer. In some embodiments, the determination of similarity is performed by the first machine learning model using its own judgment (e.g., based on previous training). In some embodiments, the first machine learning model performs a chain-of-thought reasoning to determine the one or more correction scores. More specifically, chain-of-thought reasoning indicates one or more logical steps that the first machine learning model has made in determining the correction score. For example, the chain-of-thought reasoning may cause the first machine learning model to explain the reasoning process (e.g., thinking out loud) in a series of logical steps before generating the final answer (e.g., correction score). In other words, the first machine learning model breaks down the problem into smaller, logical steps and explains how it arrives at the answer.

[0084] For example, as shown by the table 802 in FIG. 8, using the user prompt 302 (“Write a short, engaging summary of the news article”) and the testing data item 304, the first machine learning model has generated a response (e.g., “Sweden stops new aid for Cambodia in protest.”) that is given a correction score that is somewhat high (e.g., “82.0”). This makes sense because the response is very similar to the reference answer 306 of FIG. 3C (e.g., “Sweden stops some new aid for Cambodia in protest over crackdown.”) with a few minor differences (e.g., both state that Sweden stopped aid to Cambodia in protest). However, the response may not receive a full score of 100.0 because there may be some nuances that are lacking in the response (e.g., the response is incomplete since it does not specify that only some new aid is stopped and it does not specify that some new aid was stopped to protest the crackdown).

[0085] At block 710, the user interface module 106a displays the correction score. More specifically, after the first machine learning model generates the correction score, the prompt consistency module 106c transmits the correction score to the user interface module 106a for display before a user (e.g., using the client computing device 102). At block 712, the routine ends.Example Routine for Generating Stress Test Score

[0086] When a routine described herein (i.e., 200, 500, 700, 900, and 1100) is initiated, as set of executable program instructions stored on one or more non-transitory computer-readable media (e.g., hard drive, flash memory, removable media, etc.) may be loaded into memory (e.g., random access memory or RAM) of a computing device, such as the computing device 1200 shown in FIG. 12, and executed by one or more processors. In some embodiments, the routine 200, 500, 700, 900, and 1100 or portions thereof may be implemented on multiple processors, serially or in parallel.

[0087] FIG. 9 illustrates example routine 900 (beginning at block 902) for generating a stress test score, that is performed, for example, by the server computing device 106. At block 902, the user interface module 106a receives instructions, a prompt (e.g., user prompt or improved prompt), testing data (e.g., including one or more testing data items), and a reference answer from, for example, a user using a client computing device (e.g., client computing device 102). In some embodiments, at least one of the prompt (e.g., the improved prompt or the user prompt), the testing data, and the reference answer are disposed in files from which the user uploads to the server computing device 106 via the user interface module 106a. In some embodiments, the user interface module 106a provides one or more fields for the user to input (e.g., type in) the prompt (e.g., the improved prompt or the user prompt), the testing data, and the reference answer. In some embodiments, the user interface module 106a may provide a field for the user to specify where the server computing device 106 can obtain the specific testing data (e.g., via a uniform resource locator (URL) associated with the testing data database 110).

[0088] The instructions may cause the server computing device 106 to determine the accuracy of a response (e.g., based on the reference answer) when inputting the machine learning model with specific portions of at least one of the prompt, the testing data, and the reference answer. Such accuracy may be measured or represented by a stress test score. More specifically, after the user interface module 106a receives the instruction, the user interface 106a may determine from the content of the instruction that the instruction corresponds to generating a stress test score using the provided prompt (e.g., the improved prompt or the user prompt), the testing data, and the reference answer. In some embodiments, the instruction may simply be generated by activating an icon (e.g., button) on the user interface module 106a that corresponds to a predetermined instruction for generating the stress test score. In some embodiments activating the icon causes the prompt (e.g., the improved prompt or the user prompt), the testing data, and the reference answer to be transmitted to the prompt stress testing module 106e.

[0089] At block 906, the prompt stress testing module 106e may generate embeddings corresponding to sentences in the testing data. More specifically, after the prompt stress testing module 106e receives the prompt (e.g., user prompt or improved prompt) from the user interface module 106a, the prompt stress testing module 106e may generate the embeddings by converting the testing data into embeddings or vectors using one or more sentence transformer. A sentence transformer is a type of machine learning model that encodes sentences into high-dimensional vectors (e.g., embeddings), which can then be used for various tasks such as semantic search, clustering, and sentence similarity. For example, the sentence transformer may have been trained to determine how to convert a word into an embedding, and may generate a list pairing each word to its corresponding vector equivalent.

[0090] In another example, the sentence transformer may be stored in the machine learning store 108. More specifically, the prompt stress testing module 106e may retrieve the sentence transformer from the machine learning store 108 to generate the embeddings. As a result, when a sentence is input into the sentence transformer, the input sentence is tokenized (e.g., broken down into individual words or tokens). Such tokenization may be performed using a tokenizer specific to the underlying transformer model. Examples of tokenizers include WordPiece (as described in Y. Wu et al., "Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation" arXiv:1609.08144v2 [cs.CL] 8 Oct. 2016, incorporated herein by reference) for BERT (Bidirectional Encoder Representations from Transformers) or Byte Pair Encoding (as described in “Neural Machine Translation of Rare Words with Subword Units” arXiv:1508.07909v5 [cs.CL] 10 Jun. 2016, incorporated herein by reference) for RoBERTa (A Robustly Optimized BERT Pretraining Approach).

[0091] More specifically, embeddings are sentences represented according to a multidimensional vector (e.g., a word may be represented by a single row or column vector having fifty numbers as elements of the vector). A machine learning model (configured for embedding) or SentenceTransformers (which is a Python framework for state-of-the-art sentence, text and image embeddings.) may have been trained to determine how to convert a word or sentence into an embedding, and may generate a list pairing each word or sentence to its corresponding vector equivalent. As such, in some embodiments, the converting of the word or sentence into an embedding may not necessarily require such machine learning model configured for embedding (or the SentenceTransformers). Instead, a simple algorithm for matching words and sentences to predefined vectors may be used.

[0092] At block 908, the prompt stress testing module 106e determines one or more clusters among embeddings by executing a clustering algorithm. In some embodiments, the prompt stress testing module 106e may retrieve a clustering machine learning model from, for example, the machine learning store 108. The clustering machine learning model is capable of executing the clustering algorithm. The clustering algorithm may, for example, be an unsupervised machine learning technique that is configured to group similar data points (e.g., in this case, the embeddings) together into clusters. In other words, clustering may correspond to a task of grouping a set of objects in such a way that objects in the same group (e.g., cluster) are more similar to each other than to those in other groups (or clusters). It should be noted that the shape formed by a cluster can be arbitrary.

[0093] For example, the similarity between embeddings may be determined by semantic similarity among the embeddings. An example of a technique to determine semantic similarity between words or sentences is using a measurement function (e.g., a heuristic quantification method of keyword matching), such as cosine similarity, Euclidean distance, Manhattan distance, Jaccard similarity, and Minkowski distance. Cosine similarity may be determined by taking the division between the dot product of vectors and the product of the Euclidean norms or magnitude of each vector. The resulting cosine similarity score may range from zero to one, with a score closer to one indicating higher semantic similarity between the two words (e.g., “King” and “Man” have a score of 0.98), and a score closer to zero indicating lower semantic similarity between the two words (e.g., “King” and “car” have a score of 0.14). In some embodiments, the embeddings may then be disposed or mapped onto a chart based on their semantic similarity, as shown in FIG. 10.

[0094] In some embodiments, the clustering algorithm may be a k-means clustering algorithm. The k-means clustering algorithm may be used to determine clusters among the embeddings. In some embodiments, the clustering algorithm is HDBSCAN (Hierarchical Density-Based Spatial Clustering of Applications with Noise), which is a clustering algorithm that identifies clusters based on the density of data points (e.g., embeddings). More specifically, the HDBSCAN algorithm examines the density of the data points (e.g., embedding) in the dataset by first determining density-based clustering hierarchy, which creates clusters from densely connected data points. More specifically, in hierarchical clustering, smaller clusters are nested within larger ones, therefore relationships between cluster can be recognized at different levels of granularity. In addition, the hierarchical structure allows the recognition of clusters of various shapes and sizes.

[0095] The HDBSCAN algorithm then extracts clusters from the hierarchy, by considering stability of cluster assignments across different levels of the hierarchy. The HDBSCAN algorithm identifies stable clusters as those with consistent memberships at multiple levels, ensuring cluster formation robustness. In addition, the HDBSCAN algorithm differentiates between noise and meaningful clusters by considering points associated with low densities or points that do not belong to any cluster. The HDBSCAN algorithm eliminates the noise by constantly adjusting the minimum cluster size parameter and adding a minimum spanning tree. It should be noted that the clustering algorithm is not limited to HDBSCAN and k-means clustering algorithm. Other clustering algorithms may be utilized as well.

[0096] After the prompt stress testing module 106e determines the clusters among the embeddings, the prompt stress testing module 106e may then determine the centroids among the clusters. The centroid of a cluster is the arithmetic mean of all the points (e.g., embeddings) in the cluster. In some embodiments, the clustering algorithm organizes the data into non-hierarchical clusters. Therefore, the prompt stress testing module 106e may determine the centroids via the arithmetic mean of data points assigned to the cluster.

[0097] At block 912, the prompt stress testing module 106e determines the outliers based on the centroids. An example of the determined outliers is shown in a chart (e.g., “Overfitted Clustering of Text Data with 2 Clusters and Outliers”) illustrated in FIG. 10. The chart in FIG. 10 includes an x-axis (e.g., “UMAP Dimension 1”) and a y-axis (e.g., “UMAP Dimension 2”). More specifically, the x-axis and the y-axis are two-dimensional projections of high dimensional sentence embeddings. As each sentence is turned into 768-dimensional vectors, UMAP (Uniform Manifold Approximation and Projection) can be utilized to reduce the 768-dimensional vectors to two-dimensions for visualization. For example, neither the x-axis or the y-axis may have an explicit interpretable meaning, but together the x-axis or the y-axis preserve the relative distances.

[0098] The outliers correspond to embeddings (e.g., of the sentences) that are determined to be the furthest distance away from the centroids. It should be noted that the concept of furthest away can be represented as a threshold distance. In other words, an outlier is determined based on the embedding having a distance (measured from the centroid) that is greater than or equal to a threshold. In other words, an outlier may be determined by first calculating the distance from each centroid to a cluster point (e.g., each cluster point represents an embedding). If the distance of the point from the centroid is more than a certain threshold in relative units, such point can be considered an outlier.

[0099] At block 914, the prompt stress testing module 106e generates a response based on the prompt (e.g., user prompt or improved prompt) and the determined outliers. More specifically, the prompt stress testing module 106e may retrieve the second machine learning model from, for example, the machine learning store 108. Then, the prompt stress testing module 106e may cause the second machine learning model to generate a response based on the user prompt and the determined outliers. It should be noted that the second machine learning model may generate the response based on the user prompt, the determined outliers, and the knowledge acquired by the second machine learning model via prior (or previous) training.

[0100] At block 916, the second machine learning model determines a stress test score based on the similarity between the response and the reference answer. In some embodiments, the stress test score is rated on a scale of one-hundred (e.g., 100), in which a high candidate score (e.g., moving towards one-hundred) indicates a high similarity between the response and the reference answer, while a low stress test score (e.g., moving towards zero) indicates a low similarity between the response and the reference answer. In other words, the identified outliers of the testing data is passed the second machine learning model, and the generated output by the second machine learning model is mapped or validated with the reference answer to obtain the stress test score which is the percentage accurate responses. In some embodiments, the determination of similarity is performed by the second machine learning model using its own judgment (e.g., based on previous training).

[0101] It should be noted that, in some embodiments, stress testing is helpful in understanding how the user prompt reacts when there is varied input. Such reaction may be tested using outliers. In other words, such tests are performed on unusual embeddings (e.g., outliers) as opposed to the embeddings closest to the centroids. It should also be noted that, in some embodiments, the stress test score may be generated in order to observe how a user prompt (or the improved prompt) causes a response to be generated when portions of the testing data are used (e.g., a very different kind of testing data). In other words, conventionally the entire testing data is used (along with the user prompt) to generate the response. However, the stress test score is used to determine what happens when a portion of the testing data is used in the extreme (e.g., usage of outliers). At block 918, the routine ends.Example Routine for Analyzing User Prompt

[0102] When a routine described herein (i.e., 200, 500, 700, 900, and 1100) is initiated, as set of executable program instructions stored on one or more non-transitory computer-readable media (e.g., hard drive, flash memory, removable media, etc.) may be loaded into memory (e.g., random access memory or RAM) of a computing device, such as the computing device 1200 shown in FIG. 12, and executed by one or more processors. In some embodiments, the routine 200, 500, 700, 900, and 1100 or portions thereof may be implemented on multiple processors, serially or in parallel.

[0103] FIG. 11 illustrates example routine 1100 (beginning at block 1102) for analyzing a user prompt, that is performed, for example, by the server computing device 106. At block 1102, the user interface module 106a receives instructions, a prompt (e.g., user prompt), testing data (e.g., including one or more testing data items), and a reference answer from, for example, a user using a client computing device (e.g., client computing device 102). In some embodiments, at least one of the prompt (e.g., the user prompt), the testing data, and the reference answer are disposed in files from which the user uploads to the server computing device 106 via the user interface module 106a. In some embodiments, the user interface module 106a provides one or more fields for the user to input (e.g., type in) the prompt (e.g., the improved prompt or the user prompt), the testing data, and the reference answer. In some embodiments, the user interface module 106a may provide a field for the user to specify where the server computing device 106 can obtain the specific testing data (e.g., via a uniform resource locator (URL) associated with the testing data database 110).

[0104] The instructions may cause the server computing device 106 to allow a user to analyze a user prompt as well as generate (and analyze) an improved prompt based on the user prompt. More specifically, after the user interface module 106a receives the instruction, the user interface 106a may determine from the content of the instruction that the instruction corresponds to analyzing the user prompt using the testing data, and the reference answer. In some embodiments, the instruction may simply be generated by activating an icon (e.g., button) on the user interface module 106a that corresponds to a predetermined instruction for analyzing the user prompt. In some embodiments activating the icon causes user the prompt, the testing data, and the reference answer to be transmitted to the prompt analysis module 106f.

[0105] At block 1106, the prompt analysis module 106f may transmit instructions to the prompt improvement module 106b to generate an improved prompt based on the testing data and the reference answer. As such, the prompt improvement module 106b may perform the process described in the routine 200 of FIG. 2 (or may perform the actions associated with blocks 204 to 216). After performing the routine200 (or one or more relevant blocks associated with the routine 200), the prompt improvement module 106b may transmit the improved prompt, composite score, and improved (and / or candidate) prompt analysis to the prompt analysis module 106f.

[0106] At block 1108, the prompt analysis module 106f may transmit instructions to the prompt consistency module 106c to generate consistency scores for at least one of the user prompt and the improved prompt. As such, the prompt consistency module 106c may perform the process described in the routine 500 of FIG. 5 (or may perform the actions associated with blocks 504 to 508) for each of the user prompt and the improved prompt. After performing the routine 500 (or one or more relevant blocks associated with the routine 500), the prompt consistency module 106c may transmit the consistency score (e.g., for the user prompt and / or the improved prompt) to the prompt analysis module 106f.

[0107] At block 1110, the prompt analysis module 106f may transmit instructions to the prompt correction module 106d to generate a correction score for the user prompt. As such, the prompt correction module 106d may perform the process described in the routine 700 of FIG. 7 (or may perform the actions associated with blocks 704 to 710). After performing the routine 700 (or one or more relevant blocks associated with the routine 700), prompt correction module 106d may transmit the correction score to the prompt analysis module 106f.

[0108] At block 1110, the prompt analysis module 106f may transmit instructions to the prompt stress testing module 106e to generate a stress test score for at least one of the user prompt and the improved prompt. As such, the prompt stress testing module 106e may perform the process described in the routine 900 of FIG. 9 (or may perform the actions associated with blocks 904 to 916) for each of the user prompt and the improved prompt. After performing the routine 900 (or one or more relevant blocks associated with the routine 900), the prompt stress testing module 106e may transmit the stress test score (e.g., for the user prompt and / or the user prompt) to the prompt analysis module 106f.

[0109] At block 1112, the prompt analysis module displays the analysis. More specifically, the analysis may include one or more outputs received by the prompt analysis module 106f at each of the blocks 1106 to 1112. More specifically, the analysis includes at least one of the improved prompt, composite score, and improved (and / or candidate) prompt analysis to the prompt analysis (e.g., from the prompt improvement module 106b), the consistency scores corresponding to the user prompt and / or the improved prompt (e.g., from the prompt consistency module 106c), the correction score (e.g., from the prompt correction module 106d), and the stress test scores corresponding to the user prompt and / or the improved prompt (e.g., from the prompt stress testing module 106e). At block 1116, the routine ends.Execution Environment

[0110] FIG. 12 illustrates various components of an example computing device 1200 configured to implement various functionality described herein.

[0111] In some embodiments, the computing device 1200 may be implemented using any of a variety of computing devices, such as server computing devices, desktop computing devices, personal computing devices, mobile computing devices, mainframe computing devices, midrange computing devices, host computing devices, or some combination thereof.

[0112] In some embodiments, the features and services provide by the computing device 1200 may be implemented as webs services consumable via one or more communication networks. In further embodiments, the computing device 1200 is provided by one or more virtual machines implemented in a hosted computing environment. The hosted computing environment may include one or more rapidly provisioned and released computing resources such as computing devices, networking devices, and / or storage devices. A hosted computing environment may also be referred to as a “cloud” computing environment.

[0113] In some embodiments, as shown, a computing device 1200 may include one or more processors 1202, such as physical central processing units (“CPUs”); one or more network interfaces 1204, such as network interface cards (“NICs”); one or more computer readable medium drives 1206, such as a high density disk (“HDDs”), solid state drives (“SSDs”), flash drives, and / or other persistent computer readable media; one or more input / output drive interfaces 1208; and one or more computer-readable memories 1210, such as random access memory (“RAM”) and / or other volatile non-transitory readable media. The one or more computer-readable memories 1210 may include computer program instructions that one or more computer processors 1202 execute and / or data that the one or more computer processors 1202 use in order to implement one or more embodiment. For example, the one or more computer-readable memories 1210 can store an operating system 1212 to provide general administration of the computing device 1200.

[0114] As another example, the one or more computer-readable memories 1210 can store a user interface module 1214 (e.g., user interface module 106a) for receiving input from the user (e.g., user prompt, testing data, reference answer, etc.) and displaying output (e.g., prompt analysis, etc.) to the user. In yet another example, the one or more computer-readable memories 1210 can store a prompt improvement module 1216 (e.g., prompt improvement module 106b) for generating at least one of an improved (or candidate) prompts, one or more composite scores, and a prompt analysis of the improved (or candidate) prompt in view of the user prompt. In yet a further example, the one or more computer-readable memories 1210 can store prompt consistency module 1218 (e.g., prompt consistency module 106c), which generates a consistency score to measure how consistent responses generated by the machine learning model are when using the user prompt or the improved prompt.

[0115] In yet another example, the one or more computer-readable memories 1210 can store a prompt correction module 1220 (e.g., a prompt correction module 106d), which generates a correction score that indicates how similar a response generated by a user prompt is to the reference answer. In yet a further example, the one or more computer-readable memories 1210 can store a prompt stress testing module 1222 (e.g., prompt stress testing module 106e), which generates a stress test score based on outliers, of embeddings of the testing data, that were determined via one or more clustering algorithms. In another example, the one or more computer-readable memories 1210 can store a prompt analysis module 1224 (e.g., prompt analysis module 106f), which causes the aforementioned modules (e.g., prompt improvement module 1216, the prompt consistency module 1218, prompt correction module 1220, prompt stress testing module 1222, etc.) to generate the improved (or candidate) prompts, one or more similarity scores, one or more composite scores, improved (or candidate) prompt analysis, one or more consistency scores, one or more correction scores, one or more stress test scores, etc. In another example, the one or more computer-readable memories 1210 can store machine learning model(s) 1226 (e.g., machine learning store 108) that may store different types of machine learning models including, but not limited to, (large) language models for processing natural language input and generating natural language output.Terminology

[0116] The term “model,” as used in the present disclosure, can include computer-based models of any type and of any level of complexity, such as any type of sequential, functional, or concurrent model. Models can further include various types of computation models, such as, for example, artificial neural networks (“NN”), language models (e.g., large language models (“LLMs”)), artificial intelligence (“AI”) models, machine learning (“ML”) models, multimodals (e.g., models or combinations of models that can accept inputs of multiple modalities, such as images and text), and / or the like.

[0117] A Language Model is any algorithm, rule, model, and / or other programmatic instructions that can predict the probability of a sequence of words. A language model may, given a starting text string (e.g., one or more words), predict the next word in the sequence. A language model may calculate the probability of different word combinations based on the patterns learned during training (based on a set of text data from books, articles, websites, audio files, etc.). A language model may generate many combinations of one or more next words (and / or sentences) that are coherent and contextually relevant. Thus, a language model can be an advanced artificial intelligence algorithm that has been trained to understand, generate, and manipulate language. A language model can be useful for natural language processing, including receiving natural language prompts and providing natural language response based on the text on which the model is trained. A language model may include n-gram, exponential, positional, neural network, and / or other types of models.

[0118] A Large Language Model (“LLM”) is any type of language model that has been trained on a larger data set and has a larger number of training parameters compared to a regular language model. An LLM can understand more intricate patterns and generate text that is more coherent and contextually relevant due to its extensive training. Thus, an LLM may perform well on a wide range of topics and tasks. An LLM may comprise an NN trained using self-supervised learning. An LLM may be of any type, including a Question Answer (“QA”) LLM that may be optimized for generating answers from a context, a multimodel LLM / model, and / or the like. An LLM (and / or other models of the present disclosure), may include, for example, attention-based and / or transformer architecture or functionality.

[0119] While certain aspects and implementations are discussed herein with reference to use of a language model, LLM, and / or AI, those aspects and implementations may be performed by any other language model, LLM, AI model, generative AI model, generative model, ML model, NN, multimodel model, and / or other algorithmic process. Similarly, while certain aspects and implementations are discussed herein with reference to use of a ML model, those aspects and implementations may be performed any other AI model, generative AI model, generative model, NN, multimodel model, and / or other algorithmic processes.

[0120] In various implementations, the LLMs and / or other models (including ML models) of the present disclosure may be locally hosted, cloud managed, accessed via one or more Application Programming Interfaces (“API’s”), and / or any combination of the foregoing and / or the like. Additionally, in various implementations, the LLMS and / or other models (including ML models) of the present disclosure may be implemented in or by electronic hardware such application-specific processors (e.g., application-specific integrated circuits (“ASICs”)), programmable processors (e.g., field programmable gate arrays (“FPGAs”)), application-specific circuitry, and / or the like. Data that may be queried using the systems and methods of the present disclosure may include any type of electronic data, such as text, files, documents, books, manuals, emails, images, audio, video, databases, metadata, positional data (e.g., geo-coordinates), geospatial data, sensor data, web pages, time series data, and / or any combination of the foregoing and / or the like. In various implementations, such data may comprise model inputs and / or outputs, model training data, modeled data, and / or the like.

[0121] Examples of models, language models, and / or LLMs that may be used in various implementations of the present disclosure include, for example, Bidirectional Encoder Representations from Transformers (BERT), LaMDA (Language Model for Dialogue Applications), PaLM (Pathways Language Model), PaLM 2 (Pathways Language Model 2), Generative Pre-trained Transformer 2 (GPT-2), Generative Pre-trained Transformer 3 (GPT-3), Generative Pre-trained Transformer 4 (GPT-4), LLaMA (large Language Model Meta AI), and BigScience Large Open-science Open-access Multilingual Language Model (BLOOM).

[0122] The above-described techniques can be implemented in digital and / or analog electronic circuitry, or in computer hardware, firmware, software, or in combinations of them. The implementation can be as a computer program product, i.e., a computer program tangibly embodied in a machine-readable storage device, for execution by, or to control the operation of, a data processing apparatus (e.g., a programmable processor, a computer, and / or multiple computers). A computer program can be written in any form of computer or programming language, including source code, compiled code, interpreted code and / or machine code, and the computer program can be deployed in any form, including as a stand-alone program or as a subroutine, element, or other unit suitable for use in a computing environment. A computer program can be deployed to be executed on one computer or on multiple computers at one or more sites. The computer program can be deployed in a cloud computing environment (e.g., Amazon® AWS, Microsoft® Azure, IBM®).

[0123] Method steps can be performed by one or more processors executing a computer program to perform functions of the invention by operating on input data and / or generating output data. Method steps can also be performed by, and an apparatus can be implemented as, special purpose logic circuitry (e.g., a FPGA (field programmable gate array), a FPAA (field-programmable analog array), a CPLD (complex programmable logic device), a PSoC (Programmable System-on-Chip), ASIP (application-specific instruction- set processor), or an ASIC (application-specific integrated circuit), or the like). Subroutines can refer to portions of the stored computer program and / or the processor, and / or the special circuitry that implement one or more functions.

[0124] Processors suitable for the execution of a computer program include, by way of example, special purpose microprocessors specifically programmed with instructions executable to perform the methods described herein, and any one or more processors of any kind of digital or analog computer. Generally, a processor receives instructions and data from a read-only memory or a random-access memory or both. The essential elements of a computer are a processor for executing instructions and one or more memory devices for storing instructions and / or data. Memory devices, such as a cache, can be used to temporarily store data. Memory devices can also be used for long-term data storage. Generally, a computer also includes, or is operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data (e.g., magnetic, magneto-optical disks, or optical disks). A computer can also be operatively coupled to a communications network in order to receive instructions and / or data from the network and / or to transfer instructions and / or data to the network. Computer-readable storage mediums suitable for embodying computer program instructions and data include all forms of volatile and non-volatile memory, including by way of example semiconductor memory devices (e.g., DRAM, SRAM, EPROM, EEPROM, and flash memory devices); magnetic disks (e.g., internal hard disks or removable disks); magneto-optical disks; and optical disks (e.g., CD, DVD, HD-DVD, and Blu-ray disks). The processor and the memory can be supplemented by and / or incorporated in special purpose logic circuitry.

[0125] To provide for interaction with a user, the above-described techniques can be implemented on a computing device in communication with a display device (e.g., a CRT (cathode ray tube), plasma, or LCD (liquid crystal display) monitor, a mobile device display or screen, a holographic device and / or projector, for displaying information to the user and a keyboard and a pointing device (e.g., a mouse, a trackball, a touchpad, or a motion sensor, by which the user can provide input to the computer (e.g., interact with a user interface element). Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, and / or tactile input).

[0126] The above-described techniques can be implemented in a distributed computing system that includes a back-end component. The back-end component can, for example, be a data server, a middleware component, and / or an application server. The above-described techniques can be implemented in a distributed computing system that includes a front-end component. The front-end component can, for example, be a client computer having a graphical user interface, a Web browser through which a user can interact with an example implementation, and / or other graphical user interfaces for a transmitting device. The above-described techniques can be implemented in a distributed computing system that includes any combination of such back-end, middleware, or front-end components.

[0127] The components of the computing system can be interconnected by transmission medium, which can include any form or medium of digital or analog data communication (e.g., a communication network). Transmission medium can include one or more packet-based networks and / or one or more circuit-based networks in any configuration. Packet-based networks can include, for example, the Internet, a carrier internet protocol (IP) network (e.g., local area network (LAN), wide area network (WAN), campus area network (CAN), metropolitan area network (MAN), home area network (HAN)), a private IP network, an IP private branch exchange (IPBX), a wireless network (e.g., radio access network (RAN), Bluetooth, near field communications (NFC) network, Wi-Fi, WiMAX, general packet radio service (GPRS) network, HiperLAN), and / or other packet-based networks. Circuit-based networks can include, for example, the public switched telephone network (PSTN), a legacy private branch exchange (PBX), a wireless network (e.g., RAN, code-division multiple access (CDMA) network, time division multiple access (TDMA) network, global system for mobile communications (GSM) network), and / or other circuit-based networks.

[0128] Information transfer over transmission medium can be based on one or more communication protocols. Communication protocols can include, for example, Ethernet protocol, Internet Protocol (IP), Voice over IP (VOIP), a Peer-to-Peer (P2P) protocol, Hypertext Transfer Protocol (HTTP), Session Initiation Protocol (SIP), H.323, Media Gateway Control Protocol (MGCP), Signaling System #7 (SS7), a Global System for Mobile Communications (GSM) protocol, a Push-to-Talk (PTT) protocol, a PTT over Cellular (POC) protocol, Universal Mobile Telecommunications System (UMTS), 3GPP Long Term Evolution (LTE) and / or other communication protocols.

[0129] Devices of the computing system can include, for example, a computer, a computer with a browser device, a telephone, an IP phone, a mobile device (e.g., cellular phone, personal digital assistant (PDA) device, smart phone, tablet, laptop computer, electronic mail device), and / or other communication devices. The browser device includes, for example, a computer (e.g., desktop computer and / or laptop computer) with a World Wide Web browser (e.g., Chrome™ from Google, Inc., Microsoft® Internet Explorer® available from Microsoft Corporation, and / or Mozilla® Firefox available from Mozilla Corporation). Mobile computing device include, for example, a Blackberry® from Research in Motion, an iPhone® from Apple Corporation, and / or an Android™-based device. IP phones include, for example, a Cisco® Unified IP Phone 7985G and / or a Cisco® Unified Wireless Phone 7920 available from Cisco Systems, Inc.

[0130] The above-described techniques can be implemented using supervised learning and / or machine learning algorithms. Supervised learning is the machine learning task of learning a function that maps an input to an output based on example input-output pairs. It infers a function from labeled training data consisting of a set of training examples. Each example is a pair consisting of an input object and a desired output value. A supervised learning algorithm or machine learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples.

[0131] Comprise, include, and / or plural forms of each are open ended and include the listed parts and can include additional parts that are not listed. And / or is open ended and includes one or more of the listed parts and combinations of the listed parts.

[0132] One skilled in the art will realize the subject matter may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The foregoing embodiments are therefore to be considered in all respects illustrative rather than limiting of the subject matter described herein.

Claims

1. A computing system for improving prompt engineering, the system comprising a server computing system having memory for storing computer-executable instructions and a processor that executes the computer-executable instructions to:receive a prompt, testing data that includes information that provides an answer to the prompt, and a reference answer that provides a correct answer to the prompt;generate an improved prompt that is configured to cause a machine learning model to generate a more accurate response than using the prompt, wherein the improved prompt is generated by:generating, via a first machine learning model, one or more candidate prompts based on the prompt, the testing data, and the reference answer, wherein each of the one or more candidate prompts are different variations of the prompt:generating, via a second machine learning model, one or more candidate responses corresponding to each of the one or more candidate prompts, wherein each candidate response is generated based on the corresponding candidate prompt, the testing data, and the reference answer, and wherein the first machine learning model is trained on larger amounts of data than the second machine learning model; anddetermining, via the first machine learning model, one or more candidate scores based on a similarity between the reference answer and each of the one or more candidate responses, wherein the candidate prompt associated with a highest candidate score of the one or more candidate scores is determined to be the improved prompt; anddisplay the improved prompt on a user interface.

2. The computing system of claim 1, wherein the first machine learning model continuously generates a candidate response based on the prompt, the testing data, and the reference answer, until it is determined that a candidate score, corresponding to a candidate prompt generated based on the candidate prompt, begins to decrease or until it is determined that a candidate prompt has generated a candidate response that is associated with a maximum candidate score.

3. The computing system of claim 1, wherein the computer-executable instructions cause the processor to perform further operations to:generate, via the first machine learning model, one or more difference scores for the improved prompt by determining differences between the improved prompt and the prompt based on at least one of grammar, punctuation, context, clarity, and specificity.

4. The computing system of claim 1, wherein the computer-executable instructions cause the processor to perform further operations to:generate, via the first machine learning model, a similarity score based on the one or more difference scores; anddisplay the similarity score on the user interface.

5. The computing system of claim 1, wherein the computer-executable instructions cause the processor to perform further operations to:generate a consistency score for the prompt by:generating, via the second machine learning model, two or more consistency responses based on the prompt; anddetermining the consistency score based on the number of consistency responses that are similar to each other; anddisplay the consistency score on the user interface.

6. The computing system of claim 1, wherein the computer-executable instructions cause the processor to perform further operations to:generate a correction score by:generating, via the first machine learning model, a correction response, based on the prompt, the testing data, and the reference answer; anddetermining, via the first machine learning model, the correction score based on the similarity between the correction response and the reference answer.

7. The computing system of claim 6, wherein the correction score is associated with a numerical value, in which a higher numerical value indicates that the correction response is more similar to the reference answer and a lower numerical value indicates that the correction response is less similar to the reference answer.

8. The computing system of claim 6, wherein the first machine learning model is instructed to perform chain-of-thought reasoning when determining the correction score, and wherein the chain-of-thought reasoning performed by the first machine learning model indicates one or more logical steps that the second machine learning model has made in determining the correction score.

9. The computing system of claim 7, wherein the chain-of-thought reasoning is displayed on the user interface along with the correction score.

10. The computing system of claim 1, wherein the computer-executable instructions cause the processor to perform further operations to:generate, via the second machine learning model, a test response based on one or more outliers and the improved prompt, wherein the one or more outliers are generated by:generating one or more embeddings, in which each embedding corresponds to the testing data;performing a clustering algorithm on the one or more embeddings to determine one or more clusters and one or more centroids with respect to the one or more clusters, wherein the one or more outliers are determined to be the embeddings that have distances from the one or more centroids that are greater than or equal to a predetermine threshold.

11. The computing system of claim 10, wherein the computer-executable instructions cause the processor to perform further operations to:generate a test score by:determining, via the second machine learning model, the test score based on the similarity between the test response and the reference answer.

12. The computing system of claim 10, wherein the clustering algorithm is at least one of HDBScan (Hierarchical Density-Based Spatial Clustering of Applications with Noise) or k-means clustering.

13. A computerized method for improving prompt engineering, the method comprising:receiving, by server computing device, a prompt, testing data that includes information that provides an answer to the prompt, and a reference answer that provides a correct answer to the prompt;generating, by the server computing device, an improved prompt that is configured to cause a machine learning model to generate a more accurate response than using the prompt, wherein the improved prompt is generated by:generating, by the server computing device using a first machine learning model, one or more candidate prompts based on the prompt, the testing data, and the reference answer, wherein each of the one or more candidate prompts are different variations of the prompt:generating, by the server computing device using a second machine learning model, one or more candidate responses corresponding to each of the one or more candidate prompts, wherein each candidate response is generated based on the corresponding candidate prompt, the testing data, and the reference answer, and wherein the first machine learning model is trained on larger amounts of data than the second machine learning model; anddetermining, by the server computing device using the first machine learning model, one or more candidate scores based on a similarity between the reference answer and each of the one or more candidate responses, wherein the candidate prompt associated with a highest candidate score of the one or more candidate scores is determined to be the improved prompt; anddisplaying, by the server computing device, the improved prompt on a user interface.

14. The computerized method of claim 13, wherein the first machine learning model continuously generates a candidate response based on the prompt, the testing data, and the reference answer, until it is determined that a candidate score, corresponding to a candidate prompt generated based on the candidate prompt, begins to decrease or until it is determined that a candidate prompt has generated a candidate response that is associated with a maximum candidate score.

15. The computerized method of claim 13, further comprising:generating, by the server computing device using the first machine learning model, one or more difference scores for the improved prompt by determining differences between the improved prompt and the prompt based on at least one of grammar, punctuation, context, clarity, and specificity.

16. The computerized method of claim 13, further comprising:generating, by the server computing device using the first machine learning model, a similarity score based on the one or more difference scores; anddisplaying, by the server computing device, the similarity score on the user interface.

17. The computerized method of claim 13, further comprising:generating, by the server computing device, a consistency score for the prompt by:generating, by the server computing device using the second machine learning model, two or more consistency responses based on the prompt; anddetermining, by the server computing device, the consistency score based on the number of consistency responses that are similar to each other; anddisplaying, by the server computing device, the consistency score on the user interface.

18. The computerized method of claim 13, further comprising:generating, by the server computing device, a correction score by:generating, by the server computing device using the first machine learning model, a correction response, based on the prompt, the testing data, and the reference answer; anddetermining, by the server computing device using the first machine learning model, the correction score based on the similarity between the correction response and the reference answer.

19. The computerized method of claim 18, wherein the correction score is associated with a numerical value, in which a higher numerical value indicates that the correction response is more similar to the reference answer and a lower numerical value indicates that the correction response is less similar to the reference answer.

20. The computerized method of claim 18, wherein the first machine learning model is instructed to perform chain-of-thought reasoning when determining the correction score, and wherein the chain-of-thought reasoning performed by the first machine learning model indicates one or more logical steps that the first machine learning model has made in determining the correction score.

21. The computerized method of claim 20, wherein the chain-of-thought reasoning is displayed on the user interface along with the correction score.

22. The computerized method of claim 13, further comprising:generating, by the server computing device using the second machine learning model, a test response based on one or more outliers and the improved prompt, wherein the one or more outliers are generated by:generating, by the server computing device, one or more embeddings, in which each embedding corresponds to a sentence in the prompt, the testing data, and the reference answer;performing, by the server computing device, a clustering algorithm on the one or more embeddings to determine one or more clusters and one or more centroids with respect to the one or more clusters, wherein the one or more outliers are determined to be the embeddings that have distances from the one or more centroids that are greater than or equal to a predetermine threshold.

23. The computerized method of claim 22, further comprising:generating, by the server computing device, a test score by:determining, by the server computing device using the second machine learning model, the test score based on the similarity between the test response and the reference answer.

24. The computerized method of claim 22, wherein the clustering algorithm is at least one of HDBScan (Hierarchical Density-Based Spatial Clustering of Applications with Noise) or k-means clustering.