Language model generation content evaluation method and device and electronic equipment

By expanding the target dialogue corpus and using an auxiliary evaluation model to generate multiple sets of content, and calculating indicators such as similarity and information entropy, the illusion problem of content generated by large language models is solved, improving the credibility and accuracy of the generated content. It is suitable for customer service systems and other language translation applications.

CN122045385APending Publication Date: 2026-05-15GUANGZHOU SHIYUAN ELECTRONICS CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU SHIYUAN ELECTRONICS CO LTD
Filing Date
2024-11-15
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Large language models suffer from illusion problems when generating content, which may result in content that is not based on real knowledge, affecting the reliability of customer service systems and user trust.

Method used

By expanding the diversity of target dialogue corpus data, multiple sets of content are generated using an auxiliary evaluation language model, and indicators such as similarity, category ratio, and information entropy are calculated to assess the credibility of the generated content and identify and reduce illusion problems.

Benefits of technology

It provides a systematic evaluation mechanism that can effectively identify and reduce the risks of content generated by large language models, improve the accuracy and credibility of the generated content, and provide feedback for model improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122045385A_ABST
    Figure CN122045385A_ABST
Patent Text Reader

Abstract

The invention discloses a language model generation content evaluation method and device and electronic equipment. The method comprises the steps of obtaining a target dialogue corpus; expanding the diversity of the target dialogue corpus data to obtain a target dialogue corpus expansion set; respectively obtaining first generated content data, second generated content data and third generated content data; calculating a first similarity between the first generated content data and the second generated content data, a category ratio of the second generated content data, a first information entropy of the second generated content data and a second information entropy of the third generated content data; according to the first similarity, the category ratio, the first information entropy and the second information entropy, an evaluation result of the generated content is obtained, and the evaluation result of the generated content is used for detecting the credibility of the generated content of the to-be-evaluated language model. According to the method, by introducing the auxiliary evaluation model and diversified data processing, a systematic mode is provided to detect and reduce the risk of generating the content by the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an evaluation method, apparatus, and electronic device for language model-generated content. Background Technology

[0002] Current intelligent customer service systems on the market are shifting towards those based on large-scale models. These systems utilize large language models combined with retrieval-based answer generation and knowledge bases for question-and-answer processing to improve accuracy and fluency. However, large language models suffer from the illusion problem, which can cause generated content to deviate from real-world knowledge, potentially impacting system reliability and user experience. Summary of the Invention

[0003] One objective of this application is to provide a method, apparatus, and electronic device for evaluating content generated by a language model, aiming to reduce the risk of illusion problems caused by large language models, thereby enabling large language models to provide more accurate and reliable knowledge and answers to meet the needs of customer service scenarios for high-precision knowledge.

[0004] To address the aforementioned technical problems, one technical solution adopted in this application is: providing a method for evaluating content generated by a language model, comprising: acquiring a target dialogue corpus; expanding the diversity of the target dialogue corpus data to obtain an expanded target dialogue corpus set; inputting the target dialogue corpus into a language model to be evaluated to obtain corresponding first generated content data; inputting the target dialogue corpus into a preset auxiliary evaluation language model to obtain corresponding second generated content data; inputting the expanded target dialogue corpus set into the auxiliary evaluation language model to obtain corresponding third generated content data; calculating a first similarity between the first generated content data and the second generated content data, a category ratio of the second generated content data, a first information entropy of the second generated content data, and a second information entropy of the third generated content data; and obtaining an evaluation result of the generated content of the language model to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy, wherein the evaluation result of the generated content is used to detect the credibility of the generated content of the language model to be evaluated.

[0005] The above describes a scheme for evaluating a language model under evaluation using an auxiliary evaluation model. It primarily involves expanding the diversity of the target dialogue corpus to generate different dialogue examples, enabling the model to learn more comprehensive features. The target dialogue corpus is input into the language model under evaluation to generate a first set of content. A second set of content is generated using a pre-defined auxiliary evaluation model. The expanded set is then input into the auxiliary evaluation model to generate a third set of content. The similarity between the first and second generated content is calculated to ensure the relevance of the generated content to the real dialogue. The category ratio and information entropy of the second generated content are calculated; these indicators reflect the diversity and complexity of the generated content. The information entropy of the third generated content is also calculated to compare the diversity of the expanded content with the actual generated content. Finally, the credibility of the generated content is evaluated based on the combined results of similarity, category ratio, and information entropy. This multi-dimensional evaluation mechanism can effectively identify potential illusion problems. By introducing an auxiliary evaluation model and diversified data processing, a systematic approach is provided to detect and reduce the risks of content generated by large language models. In addition, this evaluation mechanism provides feedback for the improvement of subsequent models. By identifying and analyzing the patterns of illusion occurrence, developers can improve the model in a targeted manner to reduce illusion problems in future generated content.

[0006] Optionally, the step of inputting the target dialogue corpus into a preset auxiliary evaluation language model to obtain corresponding second generated content data includes: setting generated content parameters, the generated content parameters including the number of sentences; inputting the target dialogue corpus into the preset auxiliary evaluation language model to generate initial candidate sentences; inputting the initial candidate sentences into the auxiliary evaluation language model to continue generating text, wherein the continued generation of text includes generating candidate sentences corresponding to the current time step through the auxiliary evaluation language model according to a preset algorithm, continuously generating candidate sentences until the number of generated candidate sentences meets the required number of sentences, and the multiple generated candidate sentences constitute the second generated content data; wherein the initial candidate sentences are the starting point for the continuous generation of candidate sentences. By expanding the diversity of the initial candidate sentences according to the generated content parameters, more candidate sentences are obtained, further enriching the data used for the language model to be evaluated, making the evaluation of the language model to be evaluated more accurate.

[0007] Optionally, calculating the first similarity between the first generated content data and the second generated content data includes: representing the first generated content data and the second generated content data as feature vectors, where the first generated content data corresponds to a first feature vector and the second generated content data corresponds to multiple second feature vectors; calculating the similarity between the first feature vector and each of the second feature vectors to obtain multiple similarities; and calculating the average of the multiple similarities to obtain the first similarity between the first generated content data and the second generated content data. Calculating the similarity between the content data generated by the language model to be evaluated and the content data generated by the auxiliary evaluation language model can assess the semantic consistency between the two, ensuring that the generated content is related to the reference content.

[0008] Optionally, the calculation steps for the category ratio of the second generated content data are as follows: clustering the second generated content data to obtain the number of clustered categories; dividing the number of categories by the total number of candidate sentences in the second generated content data to obtain the category ratio. Calculating the category ratio through cluster analysis can effectively assess the diversity of generated content, identify redundancy, understand content distribution, and provide feedback for model optimization.

[0009] Optionally, the calculation steps corresponding to the first information entropy of the second generated content data are as follows: calculating the first sub-information entropy of the characters in the first two positions of the initial candidate sentence in a preset dictionary; calculating the second sub-information entropy of the characters in each position of the initial candidate sentence in the preset dictionary; the first sub-information entropy and the second sub-information entropy constitute the first information entropy. In this approach, considering the information entropy of the first two positions provides a more accurate standard when evaluating generated content, better reflecting the quality and diversity of the generated content. The scheme of selecting the first two positions for information entropy calculation provides strong support for model evaluation.

[0010] Optionally, the calculation steps for the second information entropy of the third generated content data are as follows: calculating the sub-probability of each candidate sentence in the third generated content data; clustering the third generated content data to obtain clustering results; and calculating the second information entropy based on the sub-probability of each candidate sentence and the clustering results. The process of calculating semantic information entropy by combining the sub-probability of candidate sentences and the clustering results can effectively evaluate the quality and diversity of the generated content, identify redundancy, and provide optimization feedback.

[0011] Optionally, obtaining the evaluation result of the language model-generated content to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy includes: calculating the weighted entropy of the language model-generated content to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy; and normalizing the weighted entropy to obtain the evaluation result of the language model-generated content to be evaluated. By combining the first similarity, the category ratio, the first information entropy, and the second information entropy to calculate the weighted entropy of the generated content and then performing normalization, a comprehensive, flexible, and easily understandable evaluation result of the generated content can be provided.

[0012] To solve the above-mentioned technical problems, the second technical solution adopted in this application is: providing an evaluation device for language model-generated content, comprising: a dialogue corpus acquisition module for acquiring target dialogue corpus; a target dialogue corpus expansion set acquisition module for expanding the diversity of the target dialogue corpus data to obtain a target dialogue corpus expansion set; a first generated content data acquisition module for inputting the target dialogue corpus into the language model to be evaluated to obtain corresponding first generated content data; a second generated content data acquisition module for inputting the target dialogue corpus into a preset auxiliary evaluation language model to obtain corresponding second generated content data; and a third generated content data acquisition module. The module is used to input the target dialogue corpus expansion set into the auxiliary evaluation language model to obtain the corresponding third generated content data; the data calculation module is used to calculate the first similarity between the first generated content data and the second generated content data, the category ratio of the second generated content data, the first information entropy of the second generated content data, and the second information entropy of the third generated content data; the evaluation module is used to obtain the evaluation result of the generated content of the language model to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy, and the evaluation result of the generated content is used to detect the credibility of the generated content of the language model to be evaluated.

[0013] To solve the above-mentioned technical problems, the third technical solution adopted in the embodiments of this application is: to provide an electronic device, including: a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory, wherein when the processor executes the one or more computer programs, the electronic device implements the evaluation method for language model-generated content as described above.

[0014] To solve the above-mentioned technical problems, the fourth technical solution adopted in the embodiments of this application is: to provide a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device executes the evaluation method for language model-generated content as described above.

[0015] Among them, the evaluation device, electronic device and non-volatile computer-readable storage medium for the language model-generated content have the beneficial effects corresponding to the above-mentioned evaluation method for the language model-generated content. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of an evaluation method for language model-generated content provided in an embodiment of this application;

[0018] Figure 2 This is a schematic diagram of an application scenario corresponding to an evaluation method for language model-generated content provided in an embodiment of this application;

[0019] Figure 3 This is a flowchart of an evaluation method for language model-generated content provided in another embodiment of this application;

[0020] Figure 4 This is a schematic diagram of the structure of an evaluation device for language model-generated content provided in an embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0023] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than the module division in the device or the order in the flowchart. It should also be noted that in the following embodiments, there is no necessarily a specific order between the following steps. Those skilled in the art will understand from the description of the embodiments of this application that the following steps can have different execution orders in different embodiments; that is, they can be executed in parallel, or they can be executed alternately, etc.

[0024] Large Language Models (LLMs) represent a significant advancement in Natural Language Processing (NLP) in recent years. These models utilize deep learning techniques, particularly transformer-based architectures, to understand and generate natural language. LLMs are commonly used in dialogue systems, such as chatbots and virtual assistants, enabling natural conversation; content generation, such as generating articles, stories, poems, and other creative content; translation, such as providing high-quality machine translation services; and information retrieval, such as in question-answering systems, extracting information from text.

[0025] A customer service system is a software system used to manage and process customer service requests, typically used to organize, track, and resolve customer problems and needs. Virtual agents are an artificial intelligence technology within customer service systems that uses natural language processing and machine learning to simulate the conversational abilities of human customer service representatives, providing real-time automated service. The introduction of virtual agents can improve the efficiency and scalability of customer service systems, reduce the workload of customer service personnel, and provide customers with instant responses and personalized service experiences. In application, large language models possess powerful natural language understanding and generation capabilities, helping virtual agents to more accurately understand user input and generate natural and fluent responses. Large language models can also help virtual agents better understand the context of the conversation, thereby generating more context-rich responses and improving the user experience. The automated generation capabilities of large language models can help virtual agents generate responses quickly, improving response speed and processing efficiency. Therefore, by leveraging the powerful text understanding and generation capabilities of large language models, virtual agents can currently respond to user needs more intelligently, providing customers with a better service experience.

[0026] However, large language models themselves suffer from the illusion problem, meaning the generated content may not be based on real knowledge, but rather on patterns and statistical regularities learned by the model from large-scale text data. This can lead to incorrect or inaccurate answers. In customer service systems, users typically expect accurate, detailed answers based on real knowledge. Furthermore, user trust in the system is crucial in customer service. If the system frequently exhibits illusion problems, users may doubt its reliability, reducing their trust. Since illusion problems can lead to inaccurate, unreliable, or unrealistic answers, this contradicts the high-precision knowledge required in customer service scenarios.

[0027] To address the risks posed by the inherent illusions of large language models, this application provides a method and apparatus for evaluating content generated by language models. This method can help mitigate the impact of illusions and improve the confidence of customer service systems in the content generated by large language models. To enhance confidence in the content generated by large language models, the method primarily involves expanding the diversity of the target dialogue corpus to generate different dialogue examples. This diversity allows the model to learn more comprehensive features. The target dialogue corpus is input into the language model to be evaluated, generating a first set of content. A second set of content is generated using a preset auxiliary evaluation model. The expanded set is then input into the auxiliary evaluation model to generate a third set of content. The similarity between the first and second generated content is calculated to ensure the relevance of the generated content to the real dialogue. The category ratio and information entropy of the second generated content are calculated; these indicators reflect the diversity and complexity of the generated content. The information entropy of the third generated content is also calculated to compare the diversity of the expanded content with the actual generated content. Finally, the credibility of the generated content is evaluated based on the combined results of similarity, category ratio, and information entropy. This multi-dimensional evaluation mechanism can effectively identify potential illusions. The methods and apparatus of this application, by introducing auxiliary evaluation models and diversified data processing, provide a systematic approach to detect and reduce the risks of content generated by large language models. Furthermore, this evaluation mechanism provides feedback for subsequent model improvements; by identifying and analyzing the patterns of illusion occurrence, developers can specifically improve the model, reducing illusion problems in future generated content.

[0028] It should be noted that the evaluation method for language model-generated content provided in this application embodiment can evaluate not only the generated content of large language models in customer service systems, but also the generated content of language models in other application scenarios. For example, in language translation applications, it can evaluate the fluency and accuracy of the translation results to ensure the quality and contextual consistency of the translation.

[0029] Please see Figure 1 , Figure 1This is a flowchart illustrating an evaluation method for language model-generated content provided in an embodiment of this application. For example... Figure 1 As shown, the method includes the following steps:

[0030] S101. Obtain target dialogue data.

[0031] Target dialogue corpus refers to the dialogue text data required for a specific application or task. For example, in a customer service system, the target dialogue corpus can be various interactive texts involving users and customer service representatives. These dialogues cover a variety of scenarios, including inquiries, complaints, and problem-solving. The interactive text can be presented as text, voice, images, or other forms of information.

[0032] There are several ways to obtain target dialogue data, such as using publicly available dialogue datasets; extracting past customer interaction records from the company's internal customer service system; and extracting data based on user dialogue content.

[0033] S102. Expand the diversity of the target dialogue corpus data to obtain an expanded target dialogue corpus set.

[0034] Enhancing the diversity of target dialogue corpus data refers to increasing the variety and richness of dialogue data to better evaluate language models. The target dialogue corpus expansion set refers to a rich and diverse dialogue dataset generated based on the original dialogue corpus (i.e., target dialogue corpus data) through relevant strategies. This set aims to increase data variation to improve the evaluation performance of language models.

[0035] Specifically, by introducing different customer service names or roles, the answers to the same questions can have different styles and tones, reflecting the personalized service of different customer service representatives.

[0036] For example, the original dialogue is: User: "My order hasn't arrived yet." Customer service (Xiao Li): "Hello, let me check for you."

[0037] Expanded dialogue:

[0038] User: "My order hasn't arrived yet."

[0039] Customer service representative (Xiao Zhang): "Hello, let me check for you."

[0040] Customer service representative (Xiao Wang): "Hello, let me check for you. I'll check the order status for you right away."

[0041] The expanded set (X) contains multiple candidate sentences, each representing a different customer service representative's response to the same user's question. Suppose X contains 15 such candidate sentences, which might look like this:

[0042] User: "My order hasn't arrived yet."

[0043] Customer service representative (Xiao Zhang): "Hello, let me check for you."

[0044] Customer service representative (Xiao Wang): "Hello, I'm here to check your order status."

[0045] Customer service representative (Xiao Chen): "Hello, thank you for your patience, I will handle it immediately."

[0046] Customer service representative (Xiao Li): "Hello, I'm here to check the details of your order."

[0047] ... (15 sentences in total)

[0048] For example, in Table 1 below, 'x' represents the target dialogue corpus data, and 'X' represents the expanded set of the target dialogue corpus. The expanded 'X' can yield multiple candidate sentences. 'X' can take the value 15, resulting in 15 candidate sentences, each reflecting a different customer service representative's response to a user's question. The customer service representative can be a virtual agent.

[0049] Table 1

[0050]

[0051] S103. Input the target dialogue corpus into the language model to be evaluated to obtain the corresponding first generated content data.

[0052] The language model to be evaluated can be a large-scale language model with strong learning capabilities and diverse application scenarios, such as the Qwen 7B model.

[0053] In this embodiment, the language model to be evaluated can be fine-tuned in advance. It can be trained using domain knowledge and chat corpora, thereby improving the domain adaptability of the language model, enhancing the relevance of the generated content, and increasing the model's accuracy. When fine-tuning the language model, the following preset features can be added during the data processing stage. These preset features include:

[0054] User request summary: Text summary generation of user-input dialogue content can be achieved using a model structure similar to GPT-2 (Generative Pre-trained Transformer 2). The information from the first two rounds of dialogue is input into the summary generation model to obtain a summary of the user's request.

[0055] Dialogue Phase Summary: The entire dialogue content is divided into multiple segments using a sliding window, and then a text summary is generated for each segment to obtain a phase summary of the dialogue.

[0056] Product Information: Entity recognition or keyword extraction is performed on the dialogue content input by the user. If specific information such as product serial number appears, the corresponding product information can be retrieved through the business system.

[0057] Dialogue rounds: Track the interaction process of the dialogue, record each round of questions and answers between the user and the system to determine which round the current dialogue is in, thereby obtaining dialogue round information.

[0058] Agent Name: Extract the agent's name at the start of the conversation or through user input to determine who the agent is in the current conversation, thereby recording or inferring the agent's name information.

[0059] User waiting time: Record the timestamp of each message sent by the user to calculate the user waiting time. Based on the difference in responses during different waiting time periods, infer the impact of user waiting time on system responses.

[0060] Intelligent agent reasoning results refer to the conclusions or decisions derived from the reasoning process based on dialogue content and the model. The goal of intelligent agent reasoning results is to provide users with suitable fault handling solutions through reasoning and decision-making processes, based on the dialogue content and defined relationships between nodes. Specifically, these intelligent agent reasoning results can be Bayesian inference results, i.e., generated based on a Bayesian network model. This Bayesian network model can be trained using set random variables, allowing Bayesian inference results to be generated during application.

[0061] The first generated content data refers to the corresponding output text generated by the model after the target dialogue corpus is input into the language model to be evaluated (such as Qwen7B). This output text is the result based on the model's understanding and generation capabilities of the input corpus.

[0062] For example, if the target dialogue is "My order hasn't arrived yet," the first generated content data from the language model to be evaluated after fine-tuning could be: "Hello, thank you for your patience. Let me check the order status for you."

[0063] S104. Input the target dialogue corpus into the preset auxiliary evaluation language model to obtain the corresponding second generated content data.

[0064] The language model used for auxiliary evaluation can be a small language model, which refers to a natural language processing model with a relatively small number of parameters and low computational resource consumption, such as GPT2.

[0065] In this embodiment, the auxiliary evaluation language model can be fine-tuned in advance. It can be trained using domain knowledge and chat corpora, allowing the model to better understand and generate content relevant to that domain. The fine-tuned auxiliary evaluation language model can generate responses that better match user needs and context, improving the relevance of the dialogue. When fine-tuning the auxiliary evaluation language model, the aforementioned preset features can be added during the data processing stage, including: user request summary data, dialogue phase summary data, product information involved in the dialogue, dialogue rounds, agent names, and user waiting time. It should be noted that Bayesian inference results are not included in the data processing corresponding to the auxiliary evaluation language model. This is because, under the guidance of Bayesian inference results, the outputs of the language model to be evaluated and the auxiliary evaluation language model are highly consistent. To ensure diverse outputs from the auxiliary evaluation language model and make the model evaluation results more accurate, Bayesian inference results are not included in the data processing corresponding to the auxiliary evaluation language model.

[0066] In this embodiment, inputting the target dialogue corpus into a preset auxiliary evaluation language model to obtain the corresponding second generated content data includes: setting generated content parameters, including the number of sentences; inputting the target dialogue corpus into the preset auxiliary evaluation language model to generate initial candidate sentences; inputting the initial candidate sentences into the auxiliary evaluation language model to continue generating text, wherein the continued text generation includes generating candidate sentences corresponding to the current time step through the auxiliary evaluation language model according to a preset algorithm, continuously generating candidate sentences until the number of generated candidate sentences meets the required number of sentences, and the multiple generated candidate sentences constitute the second generated content data. The main purpose of this process is to generate multiple candidate sentences through the preset auxiliary evaluation language model for subsequent evaluation and comparison. The auxiliary evaluation language model generates a set of initial candidate sentences based on the input target dialogue corpus. These sentences are generated by the auxiliary evaluation language model based on training data and may have various different expressions. The initial candidate sentences are then input into the auxiliary evaluation language model again for further text generation. This process includes generating candidate sentences corresponding to the current time step according to a set generation algorithm (such as greedy decoding). The model continuously generates new candidate sentences until the preset number of sentences is reached. In the process of generating candidate sentences, a greedy decoding algorithm is used. This algorithm selects the next word with the highest probability at each time step, gradually constructing a complete sentence. The resulting multiple candidate sentences constitute the second generated content data. These sentences can reflect different expressions and can be used for subsequent evaluation and comparison. Besides the greedy decoding method, other algorithms can also be used, such as random sampling and hybrid decoding.

[0067] In this case, the number of candidate sentences in the second generated content data is the same as the number of candidate sentences in the third generated content data (described below), meaning the number of samples obtained is consistent. Both different generation methods generate the same number of samples for comparison and evaluation; this design ensures consistency and comparability in subsequent analyses.

[0068] S105. Input the target dialogue corpus to expand the set into the auxiliary evaluation language model to obtain the corresponding third generated content data.

[0069] The third type of generated content data refers to the corresponding output text generated by the model after the target dialogue corpus is expanded and input into a pre-defined auxiliary evaluation language model (such as a small language model). These output texts are generated based on the expanded dialogue dataset and aim to provide richer and more diverse dialogue content.

[0070] S106. Calculate the first similarity between the first generated content data and the second generated content data, the category ratio of the second generated content data, the first information entropy of the second generated content data, and the second information entropy of the third generated content data.

[0071] The calculation of the first similarity between the first generated content data and the second generated content data includes: representing the first generated content data and the second generated content data as feature vectors, where the first generated content data corresponds to a first feature vector and the second generated content data corresponds to multiple second feature vectors; calculating the similarity between the first feature vector and each of the second feature vectors to obtain multiple similarities; and calculating the average of the multiple similarities to obtain the first similarity between the first generated content data and the second generated content data. By calculating the similarity between the content data generated by the language model to be evaluated and the content data generated by the auxiliary evaluation language model, the semantic consistency between the two can be assessed, ensuring that the generated content is related to the reference content. Specifically, a BGE (Bidirectional Generative Encoder) model can be used to represent the first generated content data and the second generated content data as feature vectors. Then, the similarity between these two representation vectors can be calculated using various similarity metrics, such as cosine similarity and Euclidean distance. Through this process, the semantic consistency between the content data generated by the language model to be evaluated and the content data generated by the auxiliary evaluation language model can be assessed, thereby ensuring the relevance and consistency between the generated content and the reference content.

[0072] The calculation of the category ratio of the second generated content data includes: clustering the second generated content data to obtain the number of clusters; and dividing the number of clusters by the total number of candidate sentences in the second generated content data to obtain the category ratio. Based on the above steps, it can be seen that the second generated content consists of multiple candidate sentences, and clustering is used to group similar candidate sentences into the same category. After clustering, the number of different categories is obtained, which represents the number of different categories or topics existing in the data. The number of categories represents the number of different categories or clusters obtained during the clustering process. Calculating the category ratio through cluster analysis can effectively assess the diversity of generated content, identify redundancy, understand content distribution, and provide feedback for model optimization. Specific clustering methods can include k-means, density clustering, hierarchical clustering, etc.

[0073] The calculation of the first information entropy of the second generated content data includes: calculating the first sub-information entropy of the characters in the first two positions of the initial candidate sentence in a preset dictionary; calculating the second sub-information entropy of the characters in each position of the initial candidate sentence in the preset dictionary; the first sub-information entropy and the second sub-information entropy constitute the first information entropy. When evaluating generated content, considering the information entropy of the first two positions provides a more accurate standard, better reflecting the quality and diversity of the generated content. The scheme of selecting the first two positions for information entropy calculation provides strong support for model evaluation. The first sub-information entropy E1 and the second sub-information entropy E2 can be calculated using the following formula:

[0074]

[0075] Where E can be E1 or E2; n is the number of samples in the target dialogue corpus augmentation set; P represents the position of the character, when E1 uses the characters in the first two positions, the corresponding P = 2, when E2 uses the characters in all positions of the sentence, the corresponding P = the length of the sentence; V represents the size of the dictionary; p(v) represents the probability that character v appears in the initial candidate sentence at the current position.

[0076] The first information entropy is a combination of the first sub-information entropy (E1) and the second sub-information entropy (E2). By comparing the information entropy of the first two positions in the initial candidate sentence with the information entropy of the entire sentence, the quality and diversity of the generated content can be evaluated. The first sub-information entropy (E1) is obtained by calculating the information entropy of the characters at the first two positions in the initial candidate sentence within a predefined dictionary; this information entropy reflects the diversity and uncertainty of the characters at those first two positions. The second sub-information entropy (E2) is obtained by calculating the information entropy of the characters at each position in the initial candidate sentence within a predefined dictionary; this information entropy takes into account the diversity and uncertainty of the characters at each position in the entire sentence.

[0077] The calculation of the second information entropy of the third generated content data includes: calculating the sub-probability of each candidate sentence in the third generated content data; clustering the third generated content data to obtain clustering results; and calculating the second information entropy based on the sub-probability of each candidate sentence and the clustering results. The process of calculating semantic information entropy by combining the sub-probability of candidate sentences and the clustering results can effectively evaluate the quality and diversity of generated content, identify redundancy, and provide optimization feedback. For example, based on the output of the auxiliary evaluation language model, the probability of each candidate sentence in the third generated content data is calculated. This probability can be the product of the probability outputs of GPT2 at each token position. Clustering analysis is then performed on the third generated content data, and the semantic information entropy E3, i.e., the second information entropy, is calculated by combining the sentence probabilities and the clustering results. The corresponding formula is as follows: where E represents the second information entropy E3, C represents the clustered category, and p(c) represents the sum of the probabilities of sentences in the same category.

[0078]

[0079] The second information entropy mentioned above is the result of evaluating the quality and diversity of the generated content by calculating the sub-probability of each candidate sentence in the third generated content data and combining it with the clustering results. The second information entropy reflects the distribution of sub-probabilities in different clusters, which helps to evaluate the semantic diversity and quality of the generated content.

[0080] S107. Based on the first similarity, category ratio, first information entropy and second information entropy, obtain the evaluation result of the content generated by the language model to be evaluated. The evaluation result of the generated content is used to detect the credibility of the content generated by the language model to be evaluated.

[0081] Specifically, the weighted entropy of the generated content of the language model to be evaluated is calculated based on the first similarity, the category ratio, the first information entropy, and the second information entropy; the weighted entropy is then normalized to obtain the evaluation result of the generated content of the language model to be evaluated. The specific calculation formula is as follows:

[0082] E4 = a * b * (E1 + E2 + E3);

[0083] Where E4 is the evaluation result of the generated content, a is the first similarity, b is the category ratio, E1 is the first sub-information entropy, E2 is the second sub-information entropy, and E3 is the second information entropy.

[0084] The maximum value of E4 can be set to 100 and the minimum value to 0. It can also be normalized to the range [0,1]. This value is the final evaluation result of the generated content. The larger the value, the more credible the generated content is; otherwise, the less credible it is.

[0085] Weighted entropy refers to the comprehensive entropy value obtained by weighting different indicators (such as first similarity, category ratio, first information entropy, second information entropy, etc.). Normalization is the process of scaling the data proportionally to make it fall within a specific range, such as [0,1] or [-1,1]. This helps to eliminate the influence of different dimensions between indicators, allowing them to be compared and analyzed within the same range. In this embodiment, normalizing the weighted entropy of the generated content maps its value to a predetermined range, making it easier to understand and compare the quality of the generated content.

[0086] The following is an embodiment in which the evaluation method of the content generated by the language model is applied to an intelligent customer service system. It is mainly used to evaluate the content generated by the large language model used in the intelligent customer service system, so as to detect whether the content generated by the large language model meets the actual needs of the user's question, thereby reducing the risk of inaccurate or irrelevant content generated due to illusion problems.

[0087] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating the process from the training phase to the evaluation phase of a large language model and a small language model in the language model-generated content evaluation method provided in this application embodiment, as shown below. Figure 2As shown, in the training phase, the corresponding target domain knowledge chat corpus is first acquired as training data. Then, according to the data formats or specifications that the large language model (i.e., the language model to be evaluated) and the small language model (i.e., the auxiliary evaluation language model) can accept, different data processing is performed on the acquired domain knowledge chat corpus to obtain their respective preprocessed data. Specifically, the data processing for the large language model involves adding necessary data features, such as user request summary data, dialogue phase summary data, product information involved in the dialogue, dialogue rounds, agent names, user waiting time, and Bayesian inference results. It should be noted that Bayesian inference results are not added when processing the data for the small language model. This is because, under the guidance of Bayesian inference results, the outputs of the large and small language models are highly consistent. To ensure diverse outputs from the small language model and more accurate model evaluation results, Bayesian inference results are not added when processing the data for the small language model. Finally, this preprocessed data is sent to the corresponding large and small language models for model training. After training is complete, the evaluation phase begins. In the evaluation phase, test corpus data x for language model evaluation is first acquired. Then, the test corpus data x is augmented to obtain corresponding augmented test corpus data X. This augmented test corpus data x is then sent to the trained large-scale language model, and the augmented test corpus data X is sent to the trained small-scale language model. The large-scale language model processes the corresponding test corpus data x to obtain the first candidate corpus result y, and the small-scale language model processes the corresponding augmented test corpus data X to obtain the second candidate corpus result Y. Finally, the first candidate corpus result y and the second candidate corpus result Y are processed according to a preset calculation method to obtain the confidence evaluation result of the large-scale language model.

[0088] For details, please continue reading Figure 3 , Figure 3 This is a schematic diagram of the data flow of large and small language models during the evaluation stage in the language model-generated content evaluation method provided in this application embodiment, as shown below. Figure 3As shown, the test corpus data x is sent to a large language model M to obtain the output y of the large language model, and the test corpus data x is augmented with diversity to obtain augmented test corpus data X. Then, the augmented test corpus data X is input to a small language model m to obtain the corresponding small language model output Y. Diversity sampling is performed on the small language model output Y to obtain multiple candidate sentences Y_sample. Greedy decoding is performed on the small language model output Y to obtain multiple other candidate sentences Y_greedy. The probability calculation and cluster analysis of the generated sentences Y_sample are performed on the multiple candidate sentences Y_sample respectively, and the corresponding semantic entropy is calculated based on the generated sentence probability calculation results and the corresponding cluster analysis results. For the generated sentences in the greedy decoding process, the entropy of the first two positions and the entropy of all positions are calculated respectively. In specific practice, it was found that the first two tokens of the generated sentence are important positions. When the first two tokens of the generated sentence are determined, the similarity between the overall generated sentence and the reference sentence is much greater than when the first two tokens are unknown. The BLEU (Bilingual Evaluation Understudy) index differs by about 100%. Then, the semantic entropy, the entropy of the first two positions, and the entropy of all positions are summed to obtain the corresponding comprehensive entropy. In addition, after obtaining the output y of the large language model, a matching analysis is performed between the output y and multiple candidate sentences Y_greedy obtained after greedy decoding (e.g., calculating the similarity between y and Y_greedy) to obtain the corresponding first matching analysis result. Furthermore, a clustering analysis is performed on the multiple candidate sentences Y_greedy obtained after greedy decoding to obtain the corresponding first clustering analysis result. The comprehensive entropy, the first matching analysis result, and the first clustering analysis result are then multiplied to obtain the corresponding weighted entropy. Finally, the weighted entropy is normalized to obtain the comprehensive evaluation result of the large language model.

[0089] For example, the normalized results should fall within the range of [0,1]. A larger value within this range indicates higher credibility of the content generated by the large language model, while a smaller value indicates lower credibility. When the value falls below a preset threshold, it needs to be transferred to human intervention. This process helps mitigate the impact of illusions. When large language models exhibit illusions, proactively guiding human customer service intervention helps the customer service system increase its confidence in the content generated by the large language model.

[0090] The method for evaluating content generated by language models provided in this application is mainly used to evaluate the content generated by large language models in intelligent customer service system application scenarios, such as evaluating the content generated by virtual agents. A virtual agent is a highly human-like intelligent AI that mimics a human agent, using a large language model to generate responses to user questions. This application embodiment completes the confidence assessment of the content generated by the original large language model by adding a small language model that works in conjunction with the existing large language model.

[0091] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an evaluation device for language model-generated content provided in an embodiment of this application. The evaluation device 30 for language model-generated content includes:

[0092] Dialogue data acquisition module 31 is used to acquire target dialogue data;

[0093] The target dialogue corpus expansion set acquisition module 32 is used to expand the diversity of the target dialogue corpus data to obtain the target dialogue corpus expansion set;

[0094] The first generated content data acquisition module 33 is used to input the target dialogue corpus into the language model to be evaluated and obtain the corresponding first generated content data.

[0095] The second generated content data acquisition module 34 is used to input the target dialogue corpus into a preset auxiliary evaluation language model to obtain the corresponding second generated content data;

[0096] The third generated content data acquisition module 35 is used to input the target dialogue corpus expansion set into a preset auxiliary evaluation language model to obtain the corresponding third generated content data;

[0097] Data calculation module 36 is used to calculate the first similarity between the first generated content data and the second generated content data, the category ratio of the second generated content data, the first information entropy of the second generated content data, and the second information entropy of the third generated content data;

[0098] Evaluation module 37 is used to obtain an evaluation result of the content generated by the language model to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy. The evaluation result of the generated content is used to detect the credibility of the content generated by the language model to be evaluated. The virtual agent dialogue processing device 30 described above can be a software module. This software module includes several instructions stored in a memory. The processor can access the memory, call the instructions, and execute them to complete the virtual agent dialogue processing method described in the above embodiments.

[0099] In some embodiments, the language model generation content evaluation device 30 described above can also be constructed from hardware devices. For example, the language model generation content evaluation device 30 can be constructed from one or more chips, and the chips can work together to complete the language model generation content evaluation method described in the various embodiments above. As another example, the language model generation content evaluation device 30 can also be constructed from various logic devices, such as general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), microcontrollers, ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components.

[0100] It should be noted that the language model-generated content evaluation device 30 described above can execute the language model-generated content evaluation method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the language model-generated content evaluation device 30 embodiments can be found in the language model-generated content evaluation method provided in the embodiments of this application.

[0101] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device 40 provided in an embodiment of this application. The electronic device includes one or more processors 41 and a memory 42. The memory 42 is connected to one or more processors, for example, connected to the processor 41 via a bus.

[0102] Processor 41 is configured to support the electronic device in performing the corresponding functions in the methods described in the above method embodiments. Processor 41 may be a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0103] Memory 42 is used to store program code, etc. Memory 42 may include volatile memory (VM), such as random access memory (RAM); memory may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); memory 42 may also include combinations of the above types of memory.

[0104] The memory 42 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the language model generation content evaluation method in this embodiment. The processor 41 executes the various functional applications and data processing of the language model generation content evaluation method and the language model generation content evaluation device by running the non-volatile software programs, instructions, and modules stored in the memory 42, thereby realizing the functions of each module or unit of the language model generation content evaluation method and the language model generation content evaluation device provided in the above method embodiments.

[0105] The memory 42 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function. The data storage area may store data created by the use of the evaluation device for generating content based on the language model. In some embodiments, the memory 42 may include memory remotely located relative to the processor 41, and this remote memory may be connected to the evaluation device for generating content based on the language model via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0106] The one or more modules are stored in the memory 42. When executed by the one or more processors 41, they perform the evaluation method of the language model generated content in any of the above method embodiments. For example, they perform the method steps described in the above method embodiments to realize the functions of the modules described in the above device embodiments.

[0107] The electronic device in this application embodiment may specifically be an ultra-mobile personal computer device, a smartphone, a server or server cluster, etc.

[0108] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example... Figure 4 The processor 41 shown enables one or more processors to execute the evaluation method of the language model generated content in any of the above method embodiments, for example, to execute the method steps described in the above method embodiments and to implement the functions of the modules described in the above device embodiments.

[0109] This application provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions, which, when executed by the electronic device, enable the electronic device to perform the language model generation content evaluation method in any of the above method embodiments. For example, it can perform the method steps described in the above method embodiments to achieve the functions of the modules described in the above device embodiments.

[0110] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0111] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A method for evaluating content generated by a language model, characterized in that, include: Obtain target dialogue data; The diversity of the target dialogue corpus data is expanded to obtain an expanded target dialogue corpus set; Input the target dialogue corpus into the language model to be evaluated to obtain the corresponding first generated content data; Input the target dialogue corpus into a preset auxiliary evaluation language model to obtain the corresponding second generated content data; Input the target dialogue corpus augmentation set into the auxiliary evaluation language model to obtain the corresponding third generated content data; Calculate the first similarity between the first generated content data and the second generated content data, the category ratio of the second generated content data, the first information entropy of the second generated content data, and the second information entropy of the third generated content data; Based on the first similarity, the category ratio, the first information entropy, and the second information entropy, an evaluation result is obtained for the content generated by the language model to be evaluated. The evaluation result of the generated content is used to detect the credibility of the content generated by the language model to be evaluated.

2. The method according to claim 1, characterized in that, The input of the target dialogue corpus into a preset auxiliary evaluation language model yields corresponding second generated content data, including: Set the generated content parameters, including the number of sentences; The target dialogue corpus is input into a preset auxiliary evaluation language model to generate initial candidate sentences; The initial candidate sentence is input into the auxiliary evaluation language model to continue generating text. The continued generation of text includes generating candidate sentences corresponding to the current time step through the auxiliary evaluation language model according to a preset algorithm, and continuously generating candidate sentences until the number of generated candidate sentences meets the required number of sentences. The multiple generated candidate sentences constitute the second generated content data. The initial candidate sentence is the starting point for the continuous generation of candidate sentences.

3. The method according to claim 2, characterized in that, The calculation of the first similarity between the first generated content data and the second generated content data includes: The first generated content data and the second generated content data are respectively represented as feature vectors, the first generated content data corresponds to the first feature vector, and the second generated content data corresponds to multiple second feature vectors; Calculate the similarity between the first feature vector and each of the second feature vectors to obtain multiple similarity scores; The average of the multiple similarities is calculated to obtain the first similarity between the first generated content data and the second generated content data.

4. The method according to claim 2, characterized in that, The calculation steps for the category ratio of the second generated content data are as follows: The second generated content data is clustered to obtain the number of clustered categories; The category ratio is obtained by dividing the number of categories by the total number of candidate sentences in the second generated content data.

5. The method according to claim 2, characterized in that, The calculation steps for the first information entropy of the second generated content data are as follows: Calculate the first sub-information entropy of the characters at the first two positions of the initial candidate sentence in the preset dictionary; Calculate the second sub-information entropy of the character at each position in the initial candidate sentence on the preset dictionary; The first sub-information entropy and the second sub-information entropy constitute the first information entropy.

6. The method according to claim 1, characterized in that, The calculation steps for the second information entropy of the third generated content data are as follows: Calculate the sub-probability of each candidate sentence in the third generated content data; Cluster the third generated content data to obtain clustering results; The second information entropy is calculated based on the subprobability of each candidate sentence and the clustering result.

7. The evaluation method for language model-generated content according to claim 4, characterized in that, The step of obtaining the evaluation result of the content generated by the language model to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy includes: The weighted entropy of the content generated by the language model to be evaluated is calculated based on the first similarity, the category ratio, the first information entropy, and the second information entropy. The weighted entropy is normalized to obtain the evaluation result of the content generated by the language model to be evaluated.

8. An evaluation device for content generated by a language model, characterized in that, include: The dialogue data acquisition module is used to acquire the target dialogue data; The target dialogue corpus expansion set acquisition module is used to expand the diversity of the target dialogue corpus data to obtain the target dialogue corpus expansion set; The first generated content data acquisition module is used to input the target dialogue corpus into the language model to be evaluated, and obtain the corresponding first generated content data. The second generated content data acquisition module is used to input the target dialogue corpus into a preset auxiliary evaluation language model to obtain the corresponding second generated content data; The third generated content data acquisition module is used to input the target dialogue corpus expansion set into the auxiliary evaluation language model to obtain the corresponding third generated content data. The data calculation module is used to calculate the first similarity between the first generated content data and the second generated content data, the category ratio of the second generated content data, the first information entropy of the second generated content data, and the second information entropy of the third generated content data; An evaluation module is used to obtain an evaluation result of the content generated by the language model to be evaluated based on the first similarity, the category ratio, the first information entropy, and the second information entropy. The evaluation result of the generated content is used to detect the credibility of the content generated by the language model to be evaluated.

9. An electronic device, characterized in that, include: A memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, the processor, when executing the one or more computer programs, causing the electronic device to perform the method as described in any one of claims 1 to 7.

10. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer-readable storage medium stores computer-executable instructions that, when executed by an electronic device, cause the electronic device to perform the method according to any one of claims 1 to 7.