Automatic evaluation method of large model generation content, electronic equipment and storage medium
Through the automated evaluation method, multiple test questions and preset indicators are used to select target test questions and evaluate the content generated by the large model, which solves the problem of high cost and low efficiency of large model evaluation, and achieves efficient and reliable evaluation results, which is suitable for Large-scale scenes and improved production efficiency of large models.
Patent Information
- Application Number
- CN202410949681.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-18
AI Technical Summary
The evaluation cost of content generated by large models is high and inefficient, making it difficult to apply in large-scale scenarios.
Provide an automated evaluation method that generates multiple test questions, selects target test questions based on preset indicators, evaluates the content generated by the large model, repeats the evaluation until the preset conditions are met, generates evaluation results, and uses correlation, aggressiveness and Richness metrics improve the reliability of test questions.
It realizes automatic and efficient content evaluation of large model generation, reduces evaluation costs, improves the reliability and accuracy of evaluation results, is suitable for large-scale scenarios, and improves large model production and iteration efficiency.
Smart Images

Figure CN118798170A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to an automated evaluation method, electronic device, and storage medium for large model-generated content. Background Art
[0002] With the continuous development of big models, especially generative big models, they are widely used in scenarios such as question-answering systems, intelligent customer service, and text generation, bringing great convenience to people's lives. In the production and iteration process of big models, it is particularly important to conduct security assessments on their generated content, such as determining whether the content generated by the big model contains harmful information. At present, it is generally common for professionals with certain literacy to imitate users to have continuous conversations with the big model to be tested to evaluate the content generated by the big model. The above method has high evaluation costs and low efficiency, and is difficult to apply in large-scale scenarios.
[0003] Accordingly, the art needs a new automated evaluation solution for large model generated content to solve the above problems. Summary of the invention
[0004] In order to overcome the above-mentioned defects, the present application is proposed to solve or at least partially solve the technical problems that large models are expensive and inefficient in generating content evaluation and are difficult to apply in large-scale scenarios.
[0005] In a first aspect, an automated evaluation method for content generated by a large model is provided, the method comprising: step S102, generating a plurality of test questions according to pre-acquired evaluation requirement information; step S104, selecting a target test question from the plurality of test questions based on the evaluation requirement information and a plurality of preset indicators; step S106, evaluating the content generated by the large model under the target test question to obtain evaluation data; step S108, repeating steps S102 to S106 until a preset end condition is met; step S110, generating an evaluation result according to the preset evaluation indicators and the evaluation data obtained from multiple evaluations.
[0006] In a technical solution of the above-mentioned method for automated evaluation of content generated by a large model, step S110 includes: taking steps S102 to S108 as one test, and performing multiple tests on the large model; generating evaluation results based on preset evaluation indicators and all evaluation data obtained from multiple tests.
[0007] In a technical solution of the above-mentioned large model-generated content automated evaluation method, the evaluation requirement information includes preset topics, historical target test questions, and corresponding generated content, and the step S102 includes: using the benchmark large model to generate multiple test questions according to preset generation requirements, preset topics, historical target test questions, and corresponding generated content.
[0008] In a technical solution of the above-mentioned automatic evaluation method for large model generated content, multiple preset indicators include at least: relevance indicator, offensiveness indicator and richness indicator, and the evaluation requirement information includes historical target test questions, historical generated content and attack corpus, and the step S104 includes: determining the relevance scores corresponding to multiple test questions based on the relevance indicator according to the historical generated content and the multiple test questions generated; determining the offensiveness scores corresponding to multiple test questions based on the offensiveness indicator according to the attack corpus and the multiple test questions generated; determining the richness scores corresponding to multiple test questions based on the richness indicator according to the historical target test questions and the multiple test questions generated; determining the fusion scores corresponding to the multiple test questions according to the first fusion weight, the relevance scores, offensiveness scores and richness scores corresponding to the multiple test questions; selecting the target test question from the multiple test questions according to the fusion score.
[0009] In a technical solution of the above-mentioned automatic evaluation method of large model generated content, the correlation scores corresponding to multiple test questions are determined based on the correlation index according to the historically generated content and the multiple test questions generated, including: determining the correlation scores corresponding to the multiple test questions based on the similarity of the first features of the historically generated content and the multiple test questions.
[0010] In a technical solution of the above-mentioned method for automatic evaluation of content generated by the large model, the attack corpus includes multiple corpora and corresponding offensive scores, and the method based on the offensive index determines the offensive scores corresponding to multiple test questions according to the attack corpus and the generated multiple test questions, including: selecting a preset number of corpora according to the second feature similarity between the multiple corpora and the multiple test questions; determining the offensive scores corresponding to the multiple test questions according to the selected preset number of corpora and the corresponding offensive scores.
[0011] In a technical solution of the above-mentioned automatic evaluation method for generating content based on the large model, the richness scores corresponding to multiple test questions are determined based on the richness index according to the historical target test questions and the generated multiple test questions, including: determining a first richness score based on the third feature similarity between the historical target test questions of a single test and the multiple test questions; determining a second richness score based on the third feature similarity between the historical target test questions of multiple tests and the multiple test questions, the third feature similarity being determined by the maximum similarity and the average similarity between the test question and the historical target test question; determining the richness scores corresponding to the multiple test questions based on the second fusion weight, the first richness score and the second richness score.
[0012] In a technical solution of the above-mentioned automatic evaluation method for generating content using a large model, the evaluation data includes classification results and test data, the classification results include at least a first label, the test data includes the number of tests and the number of rounds in which steps S102 to S106 are repeated for each test, and the evaluation results are generated based on all the evaluation data obtained from preset evaluation indicators and multiple tests, including at least: determining a first proportion based on the ratio of the number of first labels in multiple tests to the number of tests; determining a second proportion based on the ratio of the number of first labels in multiple tests to the total number of rounds in multiple tests; and generating the evaluation results based on the first proportion and the second proportion.
[0013] In a second aspect, an automated evaluation system for content generation using a large model is provided, the system comprising: a test question generation module, for generating a plurality of test questions based on pre-acquired evaluation requirement information; a question selection module, for selecting a target test question from the plurality of test questions based on the evaluation requirement information and a plurality of preset indicators; a content evaluation module, for evaluating the content generated by the large model under the target test question to obtain evaluation data; a loop module, for repeating steps S102 to S106 of the automated evaluation method for content generation using a large model until a preset end condition is met; and an evaluation result generation module, for generating an evaluation result based on preset evaluation indicators and evaluation data obtained from multiple evaluations.
[0014] In a technical solution of the above-mentioned large model-generated content automated evaluation system, the evaluation result generation module includes: a repeated testing unit, used to take steps S102 to S108 of the above-mentioned large model-generated content automated evaluation method as one test, and perform multiple tests on the large model; an evaluation result generation unit, used to generate evaluation results based on preset evaluation indicators and all evaluation data obtained from multiple tests.
[0015] In a technical solution of the automated evaluation system for generating content using the above-mentioned large model, the evaluation requirement information includes preset topics, historical target test questions, and corresponding generated content, and the test question generation module includes: a test question generation unit, which is used to generate multiple test questions using a benchmark large model according to preset generation requirements, preset topics, historical target test questions, and corresponding generated content.
[0016] In a technical solution of the above-mentioned automatic evaluation system for large model-generated content, multiple preset indicators include at least: a relevance indicator, an aggressiveness indicator and a richness indicator, the evaluation requirement information includes historical target test questions, historical generated content and an attack corpus, and the question selection module includes: a relevance score determination unit, which is used to determine the relevance scores corresponding to multiple test questions based on the relevance indicator according to the historical generated content and the multiple test questions generated; an aggressiveness score determination unit, which is used to determine the aggressiveness scores corresponding to multiple test questions based on the aggressiveness indicator according to the attack corpus and the multiple test questions generated; a richness score determination unit, which is used to determine the richness scores corresponding to multiple test questions based on the richness indicator according to the historical target test questions and the multiple test questions generated; a fusion score determination unit, which is used to determine the fusion scores corresponding to multiple test questions according to the first fusion weight, the relevance scores, aggressiveness scores and richness scores corresponding to the multiple test questions; and a question selection unit, which is used to select a target test question from multiple test questions according to the fusion score.
[0017] In a technical solution of the above-mentioned large model generated content automatic evaluation system, the relevance score determination unit includes: a relevance score determination subunit, which is used to determine the relevance scores corresponding to multiple test questions based on the similarity of the first features of the historically generated content and the multiple test questions.
[0018] In a technical solution of the automatic evaluation system for the above-mentioned large model-generated content, the attack corpus includes multiple corpora and corresponding offensive scores, and the offensive score determination unit includes: a corpus selection subunit, used to select a preset number of corpora based on the second feature similarity between the multiple corpora and the multiple test questions; an offensive score determination subunit, used to determine the offensive scores corresponding to the multiple test questions based on the selected preset number of corpora and the corresponding offensive scores.
[0019] In a technical solution of the automatic evaluation system for the above-mentioned large model generated content, the richness score determination unit includes: a first richness score determination subunit, used to determine a first richness score based on the third feature similarity between a historical target test question of a test and multiple test questions; a second richness score determination subunit, used to determine a second richness score based on the third feature similarity between a historical target test question of multiple tests and multiple test questions, the third feature similarity being determined by the maximum similarity and the average similarity between the test question and the historical target test question; a richness score determination subunit, used to determine the richness scores corresponding to multiple test questions based on a second fusion weight, the first richness score and the second richness score.
[0020] In a technical solution of the automatic evaluation system for generating content using the above-mentioned large model, the evaluation data includes classification results and test data, the classification results include at least a first label, the test data includes the number of tests and the number of rounds in which steps S102 to S106 are repeated for each test, and the evaluation result generation unit includes at least: a first proportion determination subunit, for determining a first proportion based on a ratio of the number of first labels in multiple tests to the number of tests; a second proportion determination subunit, for determining a second proportion based on a ratio of the number of first labels in multiple tests to the total number of rounds in multiple tests; and an evaluation result determination subunit, for generating an evaluation result based on the first proportion and the second proportion.
[0021] In a third aspect, a smart device is provided, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method for automatically evaluating the content generated by the large model in the first aspect or any corresponding technical solution thereof is implemented.
[0022] In a fourth aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, wherein the program codes are suitable for being loaded and run by a processor to execute the method for automatically evaluating the content generated by a large model in the first aspect or any corresponding technical solution thereof.
[0023] The above one or more technical solutions of the present application have at least one or more of the following beneficial effects:
[0024] In the technical solution of the present application, multiple test questions are automatically generated according to the evaluation requirement information, and the target test question is selected based on multiple preset indicators. The evaluation data is obtained according to the large model generation content corresponding to the target test question, and the above steps are repeated to generate the evaluation results according to all the evaluation data and the preset evaluation indicators. This embodiment does not require professional personnel to participate in the evaluation, and achieves the purpose of automatically and efficiently evaluating the large model generation content. By automatically selecting the target test question that meets the requirements from multiple test questions, the purpose of ensuring the evaluation quality while reducing the evaluation cost is achieved. It is not only suitable for large-scale evaluation scenarios, but also achieves the purpose of improving the production and iteration efficiency of large models.
[0025] In implementing the technical solution of the present application, multiple tests are performed and evaluation results are generated based on all evaluation data obtained from the multiple tests, thereby achieving the purpose of improving the reliability and accuracy of the evaluation results.
[0026] In the technical solution for implementing the present application, multiple test questions are generated according to preset generation requirements, preset topics, historical target test questions and corresponding generated content, thereby achieving the purpose of evaluating the large model in a targeted manner based on historical evaluation data.
[0027] In implementing the technical solution of the present application, target test questions that meet the requirements are selected from multiple test questions based on relevance indicators, aggressiveness indicators and richness indicators, thereby achieving the purpose of improving the reliability of test questions and further improving the reliability and accuracy of content evaluation generated by large models.
[0028] In the technical solution for implementing the present application, the first proportion and the second proportion are determined according to the ratios of the number of first labels in multiple tests to the number of tests and the total number of rounds of multiple tests, and evaluation results are generated according to the first proportion and the second proportion, thereby achieving the purpose of multi-angle and multi-faceted evaluation of the content generated by the large model. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The disclosure of the present application will become easier to understand with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present application. Among them:
[0030] Figure 1 It is a flowchart of the main steps of the method for automatically evaluating content generated by a large model according to an embodiment of the present application;
[0031] Figure 2 It is a schematic diagram of the overall framework of an automated evaluation method for large model-generated content according to an embodiment of the present application;
[0032] Figure 3 It is a schematic diagram of the main structural block diagram of an automatic evaluation system for large model-generated content according to an embodiment of the present application;
[0033] Figure 4 It is a schematic diagram of the main structure of a smart device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.
[0035] In the description of the present application, the terms "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, it can be indirectly connected through an intermediate medium, it can also be the internal communication of two elements, it can be a wireless connection, or it can be a wired connection.
[0036] In addition, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Computer-readable storage media include any suitable media that can store program codes, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc.
[0037] In addition, if the meaning of "and / or" appears in this application, it includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or a solution that satisfies both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and can include only A, only B, or A and B. The singular terms "one" and "this" can also include plural forms.
[0038] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of an automated evaluation method for generating content using a large model according to an embodiment of the present application. Figure 1As shown, the automatic evaluation method of the large model generated content in the embodiment of the present application mainly includes the following steps S102 to S110.
[0039] Step S102: Generate multiple test questions according to the pre-acquired evaluation requirement information.
[0040] In this embodiment, the pre-acquired evaluation requirement information is information required for evaluating the generated content of the (to be tested) large model, such as test subject, reference information and requirements for generating test questions, etc. Based on the above evaluation requirement information, multiple test questions are generated using the benchmark large model.
[0041] In one implementation, the benchmark big model may be a third-party open source big model, or a big model trained using specific data.
[0042] In one implementation, any test question is recorded as a prompt, which can be either a question (interrogative sentence) or a description (declarative sentence).
[0043] In one implementation, the question may be, for example, “Regarding opinion A, do you agree with this opinion?”, and the description may be, for example, “Most people think that B is important.”
[0044] Step S104: selecting a target test question from multiple test questions based on the evaluation requirement information and multiple preset indicators.
[0045] In this embodiment, in order to improve the quality of test questions and test efficiency, target test questions that meet the requirements and are better are screened from the multiple test questions generated in step S102 according to the evaluation requirement information and multiple preset indicators. The screened target test questions are provided to the large model to be tested, simulating the dialogue between the user and the large model, so as to achieve the purpose of evaluating the content generated by the large model (the answers under the target test questions).
[0046] In one implementation, since the evaluation (question and answer) needs to be performed multiple times, the evaluation requirement information may also include relevant information of historical evaluations, such as target test questions of historical evaluations and corresponding generated content of the large model.
[0047] In one implementation, multiple preset indicators are used to screen the multiple test questions generated, and can be set according to needs, such as the degree of relevance between the current test question and the historical test question, the aggressiveness and richness of the current test question, etc.
[0048] Step S106: Evaluate the generated content of the large model under the target test problem to obtain evaluation data.
[0049] It is understandable that when the training data of the large model to be tested has factual errors, non-compliant sources, bias, security and other issues, it may cause the content generated by the large model to contain harmful information, affect user cognition and even produce harmful behavior. Therefore, this embodiment evaluates the content generated by the large model under the target test problem, such as classifying the generated content to determine whether it is harmful.
[0050] In one implementation, the evaluation data may be a classification result, such as using a binary classification model (classifier) to classify the generated content under the target test question as “harmful” / “harmless”.
[0051] In one implementation, methods such as performing multiple classifications or generating evaluation scores are also conceivable, and this embodiment does not limit the method for generating content evaluation.
[0052] In one implementation, the classifier may be a binary classification label model trained using a smaller network model, such as a binary classification model trained using BERT-base-Chinese, or a large model with a larger parameter scale may be used to implement binary classification.
[0053] Step S108, repeat steps S102 to S106 until a preset end condition is met.
[0054] In this embodiment, the above steps S102 to S106 are repeated multiple times, that is, the large model is evaluated (question and answer) multiple times, and the preset end condition may be that the number of evaluations exceeds a preset threshold or the generated content is classified as harmful, etc.
[0055] In one implementation, the preset threshold is generally the maximum number of rounds set in the actual deployment of the large model to be tested, ranging from 15 to 25, and preferably, can be set to 20.
[0056] Step S110: Generate evaluation results according to preset evaluation indicators and evaluation data obtained from multiple evaluations.
[0057] In this embodiment, the evaluation data obtained from multiple evaluations can be binary / multi-classification results, evaluation scores, etc. The preset evaluation indicators, such as pre-set indicators for evaluating the security of large models, can be set according to the evaluation data and evaluation requirements.
[0058] In one implementation, the evaluation result is, for example, a binary classification of the content generated by the large model to be tested, and the ratio of the obtained "harmful" labels to the number of evaluations (questions and answers).
[0059] Based on the method described in steps S102 to S110 above, multiple test questions are automatically generated according to the evaluation requirement information, and a target test question is selected from the test questions based on multiple preset indicators. Evaluation data is obtained according to the large model generation content corresponding to the target test question, and the above steps are repeated to generate evaluation results according to all the evaluation data and preset evaluation indicators. This embodiment does not require professional personnel to participate in the evaluation, and achieves the purpose of automatically and efficiently evaluating the large model generation content. By automatically selecting target test questions that meet the requirements from multiple test questions, the purpose of ensuring the evaluation quality while reducing the evaluation cost is achieved. It is not only suitable for large-scale evaluation scenarios, but also achieves the purpose of improving the production and iteration efficiency of large models.
[0060] Step S102 , step S104 , and step S110 are further described below.
[0061] In one implementation of the embodiment of the present application, step S110 may further include the following steps a1 and a2:
[0062] Step a1: Take steps S102 to S108 as one test and perform multiple tests on the large model.
[0063] In this embodiment, Figure 1 Steps S102 to S108 are shown as a (session) test of the large model. It can be understood that a test may have multiple evaluations (multiple rounds of questions and answers) before the preset end condition is met, that is, multiple target test questions and corresponding large model generated content will be obtained (one target test question and the corresponding generated content are one round of questions and answers). Assuming that the generated content of the first question and answer of the large model is "harmful", the preset end condition is met. If the evaluation is terminated at this time, there is less data and the reliability of the test is difficult to guarantee. Therefore, this embodiment tests the large model multiple times to obtain more evaluation data to improve the reliability and accuracy of the evaluation results.
[0064] Step a2: Generate evaluation results based on preset evaluation indicators and all evaluation data obtained from multiple tests.
[0065] In this embodiment, the evaluation data includes classification results (such as binary classification) and test data, the classification results include at least a first label (such as a "harmful" label), and the test data includes the number of tests and the number of rounds of each test step S102 to step S106 (the number of evaluation / question-and-answer rounds for each test). The above step a2 may further include the following steps a21 to a23:
[0066] Step a21, determining a first proportion according to a ratio of the number of first tags tested multiple times to the number of tests.
[0067] In this embodiment, the first proportion is the ratio of the "harmful" label to the number of tests. Assuming that three tests are performed and only the evaluation data of the second test contains the "harmful" label, the first proportion is 1 / 3.
[0068] Step a22: determine the second proportion according to the ratio of the number of first tags in the multiple tests to the total number of rounds of the multiple tests.
[0069] In this embodiment, the second proportion is the ratio of the "harmful" label to the total number of rounds of multiple tests. Assuming that three tests are conducted, the number of (question and answer) rounds of each test are 5, 20, and 6 respectively, and the fifth round of the first test and the sixth round of the third test evaluation data contain the "harmful" label, then the second proportion is 2 / 31.
[0070] Step a23: Generate an evaluation result according to the first proportion and the second proportion.
[0071] In this embodiment, the evaluation result of the content generated by the large model is determined according to the first proportion and the second proportion calculated in step a21 and step a22.
[0072] In one implementation, the evaluation results also include the total number of tests, the total number of evaluations (total number of question-and-answer rounds), the number of rounds of this test, and the total number of harmful times. Among them, the total number of tests is the total number of (session) tests of the large model to be tested; the total number of evaluations (total number of question-and-answer rounds) is the total number of evaluations (number of question-and-answer rounds) of the large model to be tested. It should be noted that one test may include multiple rounds of questions and answers, and one question and one answer is one evaluation; the number of rounds of this test is the cumulative number of question-and-answer rounds in this test of the large model to be tested, which is mainly used to determine the termination conditions of this test; the total number of harmful times is the number of times the large model to be tested is judged to be labeled "harmful" during the test. It should be noted that this embodiment does not specifically limit the content included in the evaluation results.
[0073] In the technical solution for implementing the present application, the evaluation results are jointly generated based on the first proportion, the total of the second proportion, the number of tests, the total number of evaluations, the number of test rounds this time, and the total number of harmful times, thereby achieving the purpose of multi-dimensional and reliable evaluation of the content generated by the large model.
[0074] In one implementation of the embodiment of the present application, the assessment requirement information includes a preset topic, a historical target test question, and corresponding generated content, and step S102 may further include the following step b:
[0075] The benchmark big model is used to generate multiple test questions according to preset generation requirements, preset topics, historical target test questions and corresponding generation content.
[0076] In this embodiment, the preset generation requirements, for example, require the benchmark big model to act as a media person / critic to generate test questions for the big model to be tested. The preset generation requirements and preset topics can be set as needed. The historical target test questions and corresponding generated content include the target test questions and answers (big model generated content) of all rounds before the current question-and-answer round of this test.
[0077] In one implementation, during the first test, ie, when there are no historical target test questions and corresponding generated content, multiple test questions may be generated according to preset generation requirements and preset themes.
[0078] In one implementation of the embodiment of the present application, the plurality of preset indicators at least include: a relevance indicator, an offensiveness indicator, and a richness indicator, the evaluation requirement information includes historical target test questions, historical generated content, and an attack corpus, and step S104 may further include the following steps c1 to c5:
[0079] Step c1: determining correlation scores corresponding to the multiple test questions based on the correlation index according to the historical target test questions and the multiple test questions generated.
[0080] In this embodiment, the relevance score can be calculated using a sentence feature model, which is a model that converts indefinite length sentences into fixed-length numerical features (such as feature vectors), mainly completing the characterization of sentences. For sentences with similar semantics and sentence structures, the cosine distance score of the converted features is higher. It should be noted that the features in this embodiment are all normalized features, that is, the cosine distance of the feature itself is 1, and the sentence feature model is, for example, Seq2Vec.
[0081] Specifically, the above step c1 may further include the following step c11:
[0082] Step c11: Determine correlation scores corresponding to the multiple test questions based on the similarity between the historically generated content and the first features of the multiple test questions.
[0083] In this embodiment, the first feature represents semantic and sentence features. Assume that the historical generated content is the previous round of answer content r of the large model to be tested, and the generated multiple test questions are p1…p N , the features corresponding to the previous round of answers of the big model and the N new questions (prompts) generated by the benchmark big model are f r , f p1 , f p2 , f p3 …, f pN (The above features can be generated by the sentence feature model). The following formulas are used to calculate the features f of the previous round of answers of the model to be tested: rThe correlation degree (correlation score) c of the features of N new prompts generated by the benchmark large model i :
[0084] c i =Φ(f r ,f pi ),i∈[1,N]
[0085] Among them, Φ(·) represents the cosine distance. Since the features are all normalized features, the cosine distance is consistent with the normalized Euclidean distance (L2 distance); the correlation degree c i The bigger the prompt, the better.
[0086] In one implementation, if the answer of the previous round of the model to be tested does not exist, that is, it is the first round of this multi-round dialogue, then all the relevance values are c i =0,i∈[1,N].
[0087] Step c2: determining the offensiveness scores corresponding to the multiple test questions based on the offensiveness index according to the attack corpus and the generated multiple test questions.
[0088] In this embodiment, the offensive index (intensity) is used to evaluate the sharpness of the N new prompts generated by the benchmark large model and the attack intensity on the large model to be tested. As an example, the attack intensity can be calculated on a labeled offensive evaluation standard set, namely the attack corpus. The offensive evaluation standard set includes a rich variety of conversational questions collected and sorted, and each conversational question has a corresponding offensive score according to the degree of attack. For example, 1-10 points are used as the offensive score (attack intensity value) of the conversational question, 10 points correspond to the conversational question with the strongest attack intention and skills, and 1 point corresponds to the conversational question with the weakest attack intention and skills. In order to improve the reliability and accuracy of the offensive score, it is necessary to ensure that the offensive evaluation standard set is distributed on each score of 1-10, and the number is roughly equal.
[0089] Specifically, the above step c2 may further include the following steps c21 and c22:
[0090] Step c21: selecting a preset number of corpora according to the second feature similarities between the multiple corpora and the multiple test questions.
[0091] In this embodiment, the second feature represents semantic and sentence features. Since the N new prompts and the offensiveness evaluation standard set are all text content, the sentence feature model can be used to extract the second feature. For each new prompt feature, search on the offensiveness evaluation standard set to obtain a preset number of topk corpus samples with the highest cosine distance scores and their corresponding offensiveness scores.
[0092] Step c22: Determine the offensiveness scores corresponding to the multiple test questions according to the selected preset number of corpora and the corresponding offensiveness scores.
[0093] In this embodiment, based on the top k search results (corpus samples) above, the following formula is used to calculate the offensiveness score (attack intensity value) of the i-th new prompt: i :
[0094]
[0095] in, is the cosine distance between the i-th prompt and the j-th corpus sample in the topk search results, is the offensiveness score (attack intensity value) of the jth corpus sample, through Normalize it to between 0 and 1. i The closer it is to 1, the higher the attack intensity. When asking questions to the large model, the higher the attack intensity, the greater the probability that the large model will answer with harmful content. Therefore, test questions with high attack intensity are selected for evaluation.
[0096] Step c3: determining richness scores corresponding to the multiple test questions based on the richness index according to the historical target test questions and the multiple test questions generated.
[0097] In this embodiment, the test richness index is used to ensure that the content of the entire test data is rich enough, including the current test richness index and the historical test richness index. Among them, the current test richness index is used to evaluate the difference between the N new prompts and the historical target test questions in the current test, and the calculated result is the first richness score; the historical test richness index is used to evaluate the difference between the N new prompts and all the target test questions in the historical test of the large model to be tested, and the calculated result is the second richness score.
[0098] Specifically, the above step c3 may further include the following steps c31 to c33:
[0099] Step c31: determine a first richness score according to the similarity between the historical target test question of a test and the third features of multiple test questions.
[0100] In this embodiment, the third feature similarity is determined by the maximum similarity and average similarity between the test question and the historical target test question. Taking the richness index of this test as an example, the smaller the maximum correlation and average correlation between the N new prompts and the historical target test questions in multiple rounds of question-answering in this test, the better. Specifically, the first richness score d of the i-th new prompt is local,i The calculation formula is as follows:
[0101]
[0102] Among them, f i Represents the features of the i-th new prompt, i∈[1,N], q i represents the features of the jth historical target test question in multiple rounds of question-answering in this test, K is the number of historical target test questions in multiple rounds of question-answering in this test, and α is the weighting, which can be taken as 0.7.
[0103] Step c32: determine a second richness score according to the similarity between the historical target test questions of multiple tests and the third features of multiple test questions.
[0104] In this embodiment, the second richness score d of the i-th new prompt total,i The calculation formula is as follows:
[0105]
[0106] in, represents the features of the jth historical target test question in the tth historical test multi-round question and answer, and M is the number of historical target test questions in all historical test multi-round question and answer.
[0107] Step c33: determine the richness scores corresponding to the multiple test questions according to the second fusion weight, the first richness score and the second richness score.
[0108] In this embodiment, the first richness score d is calculated using the following formula: local,i and the second richness score d total,i Fusion, get the total richness score d i :
[0109] d i =λ·d local,i +(1-λ)·d total,i ,i∈[1,N]
[0110] Among them, λ is the fusion coefficient, which can be taken as 0.6.
[0111] Step c4: determining fusion scores corresponding to the multiple test questions according to the first fusion weight, the relevance scores, the aggressiveness scores, and the richness scores corresponding to the multiple test questions.
[0112] In this embodiment, the fusion score is calculated as follows:
[0113] score i =ω c ·c i +ω a ·a i +ωd ·d i ,i∈[1,N]
[0114] Among them, c i 、a i ,d i are relevance score, aggressiveness score, and richness score, respectively. The above scores are all decimals between 0 and 1. c ,ω a ,ω d are the weights corresponding to each score, i.e., the first fusion weight. According to experiments, the weights can be selected as 0.5, 0.3, and 0.2.
[0115] Step c5: Select a target test question from multiple test questions based on the fusion score.
[0116] In one implementation of the present application, the fusion score score is selected. i The highest prompt is used as the target test question for the large model to be tested. In the technical solution of the present application, target test questions that meet the requirements are selected from multiple test questions based on the relevance index, aggressiveness index, and richness index, thereby improving the reliability of the test questions and achieving the effect of improving the reliability and accuracy of the content evaluation generated by the large model.
[0117] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These adjusted schemes are equivalent to the technical schemes described in this application, and therefore will also fall within the scope of protection of this application.
[0118] In an application scenario according to an embodiment of the present application, with the development of large model capabilities, especially generative large models (such as Transformer, GPT), they have initially possessed a certain level of intelligence, and in some professional fields have even reached or even surpassed the human level. In the production and iteration process of large models, the evaluation of model performance is multifaceted, among which the security assessment of the content generated by the generative large model is particularly important, such as judging whether the content generated by the model is legal and whether it conforms to the mainstream socialist values. The current security assessment of large models is generally: for a given test question, the large model to be tested is used to generate the answer content, and then a professional conducts a harmful assessment, or a professional with a certain literacy imitates the user to conduct a continuous dialogue with the large model, and then conducts a harmful assessment on the generated content of the large model during the dialogue. The above method requires the participation of trained professionals, the evaluation cost is high and the efficiency is low, which is not conducive to the evaluation of large-scale scenarios (such as a large number of models to be tested and many test subject categories).
[0119] In response to the above-mentioned problems, this embodiment provides an automated evaluation method for large model generated content. Through this method, the manual participation link is eliminated, and the purpose of fully automatic and efficient security evaluation of the large model generated content to be tested and output of evaluation indicators is achieved, which greatly improves the efficiency of large model production and iteration.
[0120] Specifically, Figure 2 As shown, the input of the benchmark big model is the topic of this multi-round dialogue and the target test questions and corresponding big model generated content (historical dialogue) before this multi-round dialogue. The benchmark big model understands the historical dialogue according to the set requirements (preset generation requirements) and generates multiple test questions such as N related questions or descriptions (prompt). Then select the target test question from the multiple test questions, that is, for the N new prompts generated by the benchmark big model, combine all the dialogues of this and historical tests, and use the sentence feature model to select a prompt according to the relevance score, offensive score and richness score. For details, please refer to the steps of other embodiments, which will not be repeated here. After selecting the target test question, based on the target test question and the big model to be tested, the answer (generated content) of the big model to be tested is obtained. The generated content of the big model to be tested is classified, such as "harmful" \ "harmless". Repeat the above steps and statistical data are collected during the execution of the above steps, including: the target test questions selected for each evaluation, the generated content of the big model, the classification results of the generated content, the number of tests, the number of rounds of each test, etc., and judge whether to end this (multi-round) test according to the statistical data and the preset end conditions. After multiple tests, the evaluation results of the content generated by the large model are given. For details, please refer to the steps of other embodiments, which will not be repeated here.
[0121] This embodiment has the following advantages: high automation and high evaluation efficiency; it eliminates the need for manual participation, improves the consistency of evaluation indicators, and reduces interference errors introduced by human factors.
[0122] Another aspect of the present application is to provide an automated evaluation system for large model generated content, such as Figure 3 As shown, the system includes: a benchmark large model conversation module 301, which is used to generate multiple test questions; a question selector module 302, which is used to select a target test question from multiple test questions; a large model conversation module 303 to be tested, which is used to communicate with the large model to be tested based on the target test question; a classifier module 304, which is used to classify the content generated by the large model to be tested; a scheduling module 305, which is used to determine whether to end the current multiple rounds of testing; a data statistics module 306, which is used to record and count the data during the test and generate evaluation results.
[0123] The automated evaluation system for the content generated by the above large model is used to perform Figure 2 The embodiment of the automated evaluation method for generating content using a large model shown in the figure has similar technical principles, technical problems solved and technical effects produced. Technical personnel in this technical field can clearly understand that for the convenience and brevity of description, the specific working process and related instructions of the system can refer to the contents described in the embodiment of the method and will not be repeated here.
[0124] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.
[0125] Another aspect of the present application also provides a computer-readable storage medium.
[0126] In an embodiment of a computer-readable storage medium according to the present application, the computer-readable storage medium may be configured to store a program for executing the method for automatically evaluating the content generated by the large model of the above-mentioned method embodiment, and the program may be loaded and run by the processor to implement the method for automatically evaluating the content generated by the large model. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium may be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.
[0127] Another aspect of the present application also provides a smart device.
[0128] In an embodiment of an intelligent device according to the present application, the intelligent device may include at least one processor; and a memory connected to the at least one processor in communication; wherein a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any of the above embodiments is implemented. Figure 4 , Figure 4 FIG. 4 exemplarily shows that the memory 11 and the processor 12 are communicatively connected via a bus.
[0129] In some embodiments of the present application, the smart device may further include at least one sensor for sensing information. The sensor is connected to any type of processor mentioned in the present application. Optionally, the smart device described in the present application may be, but is not limited to, a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR)\virtual reality (virtual reality, VR) device, etc., and the embodiments of the present application are not limited to this.
[0130] So far, the technical solution of the present application has been described in conjunction with an embodiment shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.
Claims
1. An automated evaluation method for content generated by a large model, characterized in that: The method comprises: Step S102: generating a plurality of test questions according to the pre-acquired evaluation requirement information; Step S104: selecting a target test question from the multiple test questions based on the evaluation requirement information and multiple preset indicators; Step S106, evaluating the generated content of the large model under the target test problem to obtain evaluation data; Step S108, repeating steps S102 to S106 until a preset end condition is met; Step S110: Generate evaluation results according to preset evaluation indicators and evaluation data obtained from multiple evaluations.
2. The method for automatically evaluating content generated by a large model according to claim 1, characterized in that: The step S110 includes: Take steps S102 to S108 as one test and perform multiple tests on the large model; The evaluation results are generated based on the preset evaluation indicators and all the evaluation data obtained from multiple tests.
3. The method for automatically evaluating content generated by a large model according to claim 1, characterized in that: The assessment requirement information includes a preset topic, historical target test questions and corresponding generated content. Step S102 includes: The benchmark big model is used to generate multiple test questions according to preset generation requirements, preset topics, historical target test questions and corresponding generation content.
4. The method for automatically evaluating content generated by a large model according to claim 2, characterized in that: The plurality of preset indicators at least include: a relevance indicator, an offensiveness indicator and a richness indicator, and the evaluation requirement information includes historical target test questions, historical generated content and an attack corpus. The step S104 includes: Determine, based on the relevance index, relevance scores corresponding to the plurality of test questions according to the historically generated content and the plurality of generated test questions; Determining, based on the offensiveness index, offensiveness scores corresponding to the plurality of test questions according to the offensive corpus and the plurality of test questions generated; Determine, based on the richness index, richness scores corresponding to the multiple test questions according to the historical target test question and the multiple test questions generated; Determine fusion scores corresponding to the multiple test questions according to the first fusion weight, the relevance scores, the aggressiveness scores, and the richness scores corresponding to the multiple test questions; A target test question is selected from the plurality of test questions according to the fusion score.
5. The method for automatically evaluating content generated by a large model according to claim 4, characterized in that: The determining, based on the relevance index and according to the historically generated content and the generated multiple test questions, the relevance scores corresponding to the multiple test questions includes: Determine correlation scores corresponding to the multiple test questions based on similarities between the historically generated content and the first features of the multiple test questions.
6. The method for automatically evaluating content generated by a large model according to claim 4, characterized in that: The attack corpus includes a plurality of corpora and corresponding offensiveness scores, and the method of determining offensiveness scores corresponding to a plurality of test questions based on the offensiveness index according to the attack corpus and the generated plurality of test questions includes: Selecting a preset number of corpora according to the similarity between the second features of the plurality of corpora and the plurality of test questions; The offensiveness scores corresponding to the plurality of test questions are determined according to the selected preset number of corpora and the corresponding offensiveness scores.
7. The method for automatically evaluating content generated by a large model according to claim 4, characterized in that: The determining, based on the richness index and according to the historical target test question and the generated multiple test questions, the richness scores corresponding to the multiple test questions includes: Determining a first richness score based on a third feature similarity between a historical target test question of a test and a plurality of test questions; Determine a second richness score according to a third feature similarity between a historical target test question of multiple tests and a plurality of test questions, wherein the third feature similarity is determined by a maximum similarity and an average similarity between the test question and the historical target test question; Richness scores corresponding to multiple test questions are determined according to the second fusion weight, the first richness score, and the second richness score.
8. The method for automatically evaluating content generated by a large model according to claim 2, characterized in that: The evaluation data includes classification results and test data, the classification results at least include a first label, the test data includes the number of tests and the number of rounds of each test step S102 to step S106, and the evaluation results are generated according to the preset evaluation indicators and all the evaluation data obtained from multiple tests, including at least: Determine a first proportion according to a ratio of the number of first tags tested multiple times to the number of tests; Determine the second proportion according to the ratio of the number of first labels in the multiple tests to the total number of rounds of the multiple tests; An evaluation result is generated according to the first proportion and the second proportion.
9. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method for automatically evaluating the content generated by the large model described in any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the automatic evaluation method for content generated by a large model according to any one of claims 1 to 8.
