Model instruction quality detection method, device, equipment and storage medium
By automatically detecting the benchmark performance and task execution accuracy of model instructions, the problem of low efficiency and misjudgment in the existing technology is solved, and high-precision quality inspection of model instructions is achieved.
Patent Information
- Application Number
- CN202411110913.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-14
AI Technical Summary
The quality detection efficiency of model instructions in the existing technology is low and easily affected by manual experience, leading to misjudgments and affecting detection accuracy.
By obtaining the attribute information of the model instructions, detecting its baseline performance, and calling the media model to perform tasks on the sample, it generates quality information to achieve automated quality detection and multi-dimensional evaluation.
It improves the efficiency and accuracy of model instruction quality detection, avoids manual misjudgments, and realizes multi-dimensional quality assessment of model instructions.
Smart Images

Figure CN118643307B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, specifically to the field of artificial intelligence technology, and in particular to a quality detection method, device, equipment and storage medium for model instructions. Background Art
[0002] With the development of artificial intelligence (AI), media models such as large language models and AIGC (AI-Generated Content) models have been proven to have good model effects on many media data processing tasks (such as text processing / image processing, etc.). In practical applications, the expression form of model instructions has a significant impact on the effect of model output results; therefore, after constructing a large number of task-related model instructions, how to detect the quality of these model instructions to select high-quality model instructions, so as to put high-quality model instructions into production, so as to guide media models to complete related tasks more accurately through these high-quality model instructions, is of great practical value.
[0003] At present, it is usually the practitioners in the industry who make subjective judgments and evaluations on the quality of model instructions based on their manual experience, thereby obtaining quality information of model instructions. This processing method not only requires practitioners to spend a lot of time to understand and evaluate model instructions, resulting in low efficiency of instruction quality detection; it is also easy to misjudge the quality of model instructions due to the lack of personal experience or errors of practitioners, thereby affecting the accuracy of instruction quality detection. Summary of the invention
[0004] The embodiments of the present application provide a model instruction quality detection method, apparatus, device and storage medium, which can automatically perform quality detection on model instructions and improve the accuracy and efficiency of quality detection.
[0005] In one aspect, an embodiment of the present application provides a method for quality detection of a model instruction, the method comprising:
[0006] Acquire attribute information of a target model instruction to be detected, where the target model instruction is generated based on a media data processing task;
[0007] According to the attribute information of the target model instruction, the benchmark performance of the target model instruction is detected to obtain a first detection result; wherein the benchmark performance is used to influence the correctness of the media model performing the media data processing task based on the target model instruction;
[0008] Calling the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detecting the task execution accuracy of the target model instruction on the media model to obtain a second detection result;
[0009] Based on the first detection result and the second detection result, quality information of the target model instruction is generated.
[0010] On the other hand, an embodiment of the present application provides a quality detection device for a model instruction, the device comprising:
[0011] An acquisition unit, used for acquiring attribute information of a target model instruction to be detected, wherein the target model instruction is generated based on a media data processing task;
[0012] A detection unit, configured to detect a benchmark performance of the target model instruction according to the attribute information of the target model instruction, and obtain a first detection result; wherein the benchmark performance is used to influence the correctness of the media model performing the media data processing task based on the target model instruction;
[0013] The detection unit is further used to call the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detect the task execution accuracy of the target model instruction on the media model to obtain a second detection result;
[0014] The detection unit is further configured to generate quality information of the target model instruction based on the first detection result and the second detection result.
[0015] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising an input interface and an output interface, the computer device further comprising:
[0016] processor and computer storage media;
[0017] The processor is suitable for implementing one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are suitable for the processor to load and execute the quality detection method of the model instruction mentioned above.
[0018] On the other hand, an embodiment of the present application provides a computer storage medium, which stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the quality detection method of the model instructions mentioned above.
[0019] On the other hand, an embodiment of the present application provides a computer program product, which includes one or more instructions; when one or more instructions in the computer program product are executed by a processor, the quality detection method of the model instructions mentioned above is implemented.
[0020] The embodiment of the present application can realize automatic quality detection of model instructions, which can avoid the problem of low efficiency of instruction quality detection caused by manual detection, and can also avoid the situation of misjudgment of instruction quality caused by insufficient or incorrect manual experience, thereby improving the accuracy and efficiency of instruction quality detection. In addition, in the process of automated instruction quality detection, by detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction, the benchmark performance is used to affect the correctness of the media model performing media data processing tasks based on the target model instruction, and calling the media model to perform media data processing tasks on media data samples based on the target model instruction, and detecting the task execution accuracy of the target model instruction on the media model based on the actual task execution results, thereby generating quality information of the target model instruction based on the detection results of the benchmark performance and the detection results of the task execution accuracy, it is possible to realize multi-dimensional quality detection of the target model instruction, thereby further improving the accuracy of instruction quality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 It is a schematic diagram of the principle of a quality detection method of a model instruction provided in an embodiment of the present application;
[0023] Figure 2 It is a flow chart of a quality detection method of a model instruction provided in an embodiment of the present application;
[0024] Figure 3a It is a schematic diagram of a composition structure of a semantic accuracy provided in an embodiment of the present application;
[0025] Figure 3b It is a schematic diagram of the composition structure of grammatical and pragmatic correctness provided by an embodiment of the present application;
[0026] Figure 3c It is a schematic diagram of a structural complexity provided by an embodiment of the present application;
[0027] Figure 4aIt is a schematic diagram of generating a semantic vector provided in an embodiment of the present application;
[0028] Figure 4b is a structural diagram of a semantic encoder provided in an embodiment of the present application;
[0029] Figure 4c It is a schematic diagram of a task execution effect evaluation process of a model instruction provided in an embodiment of the present application;
[0030] Figure 4d It is a schematic diagram of a scoring evaluation process of a model instruction on a single large model provided in an embodiment of the present application;
[0031] Figure 4e It is a schematic diagram of a framework of a model instruction quality evaluation system provided in an embodiment of the present application;
[0032] Figure 5 It is a schematic diagram of an application scenario of a model instruction quality evaluation system provided in an embodiment of the present application;
[0033] Figure 6 It is a structural schematic diagram of a quality detection device for a model instruction provided in an embodiment of the present application;
[0034] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0036] The present application embodiment proposes a quality detection method for a model instruction, such as Figure 1 As shown: When a model instruction is generated based on a media data processing task and the model instruction needs to be quality tested, the method can detect the benchmark performance of the corresponding model instruction, which can affect the correctness of the media model executing the media data processing task based on the model instruction, and detect the task execution accuracy generated by the media model executing the corresponding task based on the corresponding model instruction, which can reflect the task execution effect, thereby determining the quality of the model instruction based on the test results of the benchmark performance and the test results of the task execution accuracy, thereby realizing automatic multi-dimensional quality testing of the model instruction, thereby improving the accuracy and efficiency of instruction quality testing. Among them:
[0037] (1) The media data processing tasks mentioned above refer to: model processing tasks related to media data; the media data mentioned here may include any of the following: text, image, audio and video, etc. For example, the media data processing task may be a text processing task (or called natural language processing (NLP) task), and the text processing task may include but is not limited to any of the following: sentiment classification task, topic classification task, summary extraction task, text translation task, positive and negative information identification task, problem solving task, etc.; for another example, the media data processing task may be an image processing task, and the image processing task may include but is not limited to any of the following: image generation task, image understanding task, image classification task, image segmentation task, image beautification task, target recognition task, etc.; for another example, the media data processing task may be an audio and video processing task, and the audio and video processing task may include but is not limited to any of the following: video frame sequence generation task, audio and video classification task, key frame recognition task, video dubbing task, etc.
[0038] (2) The model instructions mentioned above can be referred to as instructions or prompts. In the fields of computer science and natural language processing, they usually refer to a piece of text given to the model to guide the model to generate corresponding output content. Specifically, the model instruction can be a question, a sentence, a paragraph of text, or a set of instructions. It provides context information and generation goals for the model, and its purpose is to guide the model to generate specific answers or output content related to it. For example, if the model instruction is given, "Please classify the input text into three types of emotions: positive, negative, and neutral, and tell me the sentiment classification results of this text", then the model may generate the text "This text contains positive emotions" as the output content according to the model instruction. For another example, if the model instruction is given, "Translate the following English sentence into Chinese: "I have an apple", then the model may generate the text "I have an apple" as the output according to the model instruction. For another example, if the model instruction is given, "Please generate a dancing game character", then the model may generate a video of the game character dancing according to the model instruction.
[0039] (3) The media model mentioned above refers to a model that can support input of model instructions and generate content related to the model instructions. It can be constructed based on artificial intelligence (AI) technology. When using media models to solve any media data processing task, model instructions play a key role. Among them, AI technology can mainly include: natural language processing (NLP) technology, and machine learning (ML) / deep learning and other major directions. Among them, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can enable effective communication between humans and computers using natural language. Natural language processing involves natural language, that is, the language used by people in daily life, and is closely related to linguistics research; it also involves computer science and mathematics. Specifically, natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies. Machine learning is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of AI and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Deep learning is a technology that uses deep neural network systems to perform machine learning.
[0040] In a specific implementation, the media model can be a large model. The so-called large model is a type of neural network model in the field of machine learning and artificial intelligence, which is characterized by a large number of parameters and a complex structure; the large model is usually composed of a multi-layer neural network, each layer containing a large number of neurons. Since the large model can usually capture the complex patterns and relationships in the data, it can achieve excellent performance in various tasks (such as image recognition tasks, natural language processing tasks, and speech recognition tasks). Based on the different types of data that can be processed, the large model can be divided into a large language model (LLM) and a multimodal language model (LMM); the so-called large language model can be referred to as a large language model or a language model, which is a model that can focus on processing language tasks (such as natural language generation, machine translation, text summarization, etc.), while the multimodal language model is a language model that can simultaneously process multiple types of data such as text, pictures, videos, and audio.
[0041] In another specific implementation, the media model can be an AIGC (AI-Generated Content) model. The so-called AIGC model is a type of neural network model built based on AIGC technology, and the core idea of AIGC technology is to use AI technology to generate content (such as images, video frame sequences) with certain creativity and quality. Among them, AI technology refers to the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science; it mainly produces a new intelligent machine that can respond in a similar way to human intelligence by understanding the essence of intelligence, so that the intelligent machine has multiple functions such as perception, reasoning and decision-making.
[0042] In a specific implementation, the quality detection method of the model instruction proposed in the embodiment of the present application can be executed by a computer device, which can be a terminal or a server. Alternatively, the quality detection method of the model instruction can also be jointly executed by the terminal and the server. For example, after the terminal obtains a model instruction to be detected, the terminal can be responsible for detecting the benchmark performance of the model instruction, and sending the model instruction to the server, and the server is responsible for detecting the task execution accuracy of the model instruction on the media model, so that the terminal or the server determines the quality of the model instruction based on the test results of the benchmark performance and the test results of the task execution accuracy; specifically, the server can return the test results of the task execution accuracy to the terminal, so that the terminal is responsible for determining the quality of the model instruction, or the terminal can send the test results of the benchmark performance to the server, and the server is responsible for determining the quality of the model instruction, which is not limited.
[0043] Among them, the terminal can be a smart phone, a computer (such as a tablet, a laptop, a desktop computer, etc.), a smart wearable device (such as a smart watch, smart glasses), an intelligent voice interaction device, a smart home appliance (such as a smart TV), a vehicle terminal or an aircraft, etc.; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc. Further, the terminal and server can be located inside or outside the blockchain network, without limitation; further, the terminal and server can also upload any data stored inside to the blockchain network for storage to prevent the data stored inside from being tampered with and improve data security.
[0044] The following uses computer equipment as the execution subject and combines Figure 2 The flowchart shown in FIG. 1 illustrates the specific implementation process of the quality detection method of the model instruction proposed in the embodiment of the present application. Figure 2 As shown, the quality detection method of the model instruction proposed in the embodiment of the present application may include the following steps S201-S205:
[0045] S201, obtaining attribute information of the target model instruction to be detected.
[0046] The target model instruction may be any model instruction to be detected. Moreover, the target model instruction may be generated based on a media data processing task, and the media data processing task mentioned here may be any of the tasks mentioned above, such as sentiment classification tasks, summary extraction tasks, text translation tasks, problem solving tasks and other text processing tasks, or image generation tasks, image understanding tasks, image classification tasks and other image processing tasks, or video frame sequence generation tasks, audio and video classification tasks and other audio and video processing tasks, and so on.
[0047] The attribute information of the target model instruction refers to: information used to detect the benchmark performance of the target model instruction, and the benchmark performance is used to affect the correctness of the media model in performing media data processing tasks based on the target model instruction. The embodiments of the present application are based on a large number of research and tests, and it is found that factors such as the semantic accuracy, grammatical and pragmatic correctness, and structural complexity of the model instruction can affect the correctness of the media model in performing media data processing tasks based on the corresponding model instruction; based on this, the benchmark performance of the target model instruction mentioned here may include at least one of the following factors: the semantic accuracy of the target model instruction, the grammatical and pragmatic correctness of the target model instruction, and the structural complexity of the target model instruction. Among them:
[0048] (1) The semantic accuracy of model instructions refers to the degree of accuracy of the semantic expression of model instructions in the task context of media data processing tasks.
[0049] For example, see Figure 3a As shown, semantic accuracy may specifically include at least one of the following sub-factors (or levels):
[0050] A. Information expression accuracy / information element integrity. The information expression accuracy is used to reflect whether the model instruction includes all the complete instruction information required to instruct the media model to complete the media data processing task. The instruction information may include instruction words used to instruct each action in the media data processing task; the information element integrity is used to reflect whether the information elements about the media data processing task conveyed by the model instruction are missing, that is, whether the model instruction lacks the information elements required to convey the media data processing task.
[0051] For example, suppose there is a media data processing task that requires the media model to classify the sentiment of a piece of text, including positive, negative, and neutral sentiments; then:
[0052] ① A model instruction with inaccurate information expression can be Example 1: "Perform sentiment analysis on this text". Since the instruction word in Example 1 is "analysis", and the instruction word used to indicate the action in the media data processing task is "classification", there is a gap between the instruction word in the model instruction shown in Example 1 and the classification of the expected target. Therefore, it can be considered that the information expressed by the model instruction shown in Example 1 is biased and its information expression is inaccurate, which is likely to cause the task execution result actually generated by the media model based on the model instruction to perform the media data processing task to deviate from the task execution result that should be generated.
[0053] ② A model instruction with incomplete information elements can be Example 2: "Classify the sentiment of this text". Although Example 2 expresses the theme and contains the instruction word "classify" used to indicate the action in the media data processing task, it does not explicitly require specific categories of classification, such as positive, negative and neutral. Therefore, the model instruction shown in Example 2 lacks the information elements required to convey the media data processing task (i.e., the three categories of positive, negative and neutral). Therefore, it can be considered that the information elements conveyed by the model instruction shown in Example 2 are incomplete, which may cause the media model to classify according to its own understanding, such as classification based on the two categories of positive and negative, or classification based on other classification standards, which is likely to cause the task execution results actually generated by the media model based on the model instruction to perform the media data processing task to deviate from the task execution results that should be generated.
[0054] ③ A model instruction with accurate information expression and complete information elements can be Example 3: "Please classify the sentiment of this text into three types: positive, negative, and neutral." Since the model instruction shown in Example 3 explicitly includes the instruction word "classification" used to indicate the action in the media data processing task, as well as the information elements required to convey the media data processing task (i.e., the three categories of positive, negative, and neutral), the information expressed by the model instruction shown in Example 3 is accurate and the information elements conveyed are complete. The media model is more likely to obtain accurate sentiment classification results (i.e., task execution results) when executing the media data processing task based on such a model instruction.
[0055] B. Logical correctness / logical consistency. Logical correctness is used to reflect whether the logic expressed by the model instruction is correct, and logical consistency is used to reflect whether there is a conflict in the logic expressed by the model instruction; that is, logical correctness and logical consistency can reflect whether there is a problem with the logic expressed by the model instruction.
[0056] For example, suppose there is a media data processing task that requires the media model to classify the sentiment of a piece of text, including positive, negative, and neutral sentiments; then:
[0057] ① A logically incorrect / logically inconsistent model instruction can be Example 4: "Please classify the sentiment of this text, including positive, negative and neutral sentiments. Just tell me whether this text is positive." Since the model instruction shown in Example 4 requires a comprehensive sentiment classification, including positive, negative and neutral sentiments, but it only requires information on whether the text is positive, these two requirements conflict, making the logic expressed before and after the model instruction inconsistent. Therefore, it can be considered that there is a problem with the logic expressed by the model instruction shown in Example 4, which is likely to cause the media model to fail to perform media data processing tasks based on such model instructions. If you only care about whether the text is positive, then you should instruct like this: "Please tell me whether this text is positive", that is, the model instruction should not contain information used to instruct the media model to perform a comprehensive sentiment analysis.
[0058] ② A logically correct / logically consistent model instruction can be Example 5: "Please classify the sentiment of this text into three types: positive, negative, and neutral. Tell me the sentiment classification result of this text." Since there is no conflict in the logic expressed by the model instruction shown in Example 5, and the logic before and after is consistent, it can be considered that there is no problem with the logic expressed by the model instruction shown in Example 5. This allows the media model to accurately understand the logic expressed by the model instruction, and thus clearly instruct the media model to complete the media data processing task through the model instruction.
[0059] Based on the relevant description of the above part (1), the embodiment of the present application further proposes a measurement method based on semantic vector distance to comprehensively judge the semantic accuracy of the model instruction (including the above-mentioned information expression accuracy / information element integrity and the logical correctness / logical consistency of the model instruction). The principle of this method is: take the task description text of the media data processing task (i.e., the text used to describe the media data processing task) as the target instruction to be expressed, and represent all the element information of the target instruction to be expressed with a semantic vector, that is, the language information of the language element can be numerically calculated; in addition, obtain the semantic vector representation of the model instruction to be evaluated (i.e., the model instruction to be quality tested); in this way, the distance between the two semantic vectors can be calculated, and the semantic accuracy of the model instruction to be evaluated is measured based on the calculated distance. If the semantic vector of the model instruction to be evaluated is farther away from the semantic vector of the target instruction to be expressed, it means that the model instruction to be evaluated is farther away from the target instruction to be expressed in terms of semantics, and it is considered that this is a deviation caused by whether the information expression is accurate, whether the information elements are complete, or whether the logic is correct, so that the semantic accuracy of the model instruction to be evaluated is considered to be low.
[0060] Based on the above-mentioned method for comprehensively judging the semantic accuracy of model instructions based on semantic vector distance, when the benchmark performance of the target model instruction includes the semantic accuracy of the target model instruction, the computer device can encode the target model instruction when executing step S201 to obtain a first semantic vector (i.e., the semantic vector of the target model instruction), thereby adding the first semantic vector to the attribute information of the target model instruction, so that when the benchmark performance of the target model instruction is subsequently detected based on the attribute information of the target model instruction, the above-mentioned method for comprehensively judging the semantic accuracy of the model instruction based on semantic vector distance can be used to detect the semantic accuracy of the target model instruction based on the first semantic vector. Since this method does not need to be specifically refined to the detection of information expression accuracy / information element integrity, and the detection of logical correctness / logical consistency when judging the semantic accuracy of the model instruction, by using this method to judge the semantic accuracy of the target model instruction, the judgment efficiency of the semantic accuracy can be effectively improved and the computing resources required for judging the semantic accuracy can be saved.
[0061] It should be noted that the above is only an exemplary description of a method for judging semantic accuracy, and does not limit this. For example, in other embodiments, the information expression accuracy / information element integrity of the corresponding model instruction can also be obtained by calculating the comparison between the keywords in the model instruction to be evaluated and the keywords in the target instruction to be expressed; and the probability of the existence of logical problems in the model instruction to be evaluated can be identified by the logic recognition model as the logical correctness / logical consistency of the corresponding model instruction; thus, the information expression accuracy / information element integrity and logical correctness / logical consistency of the corresponding model instruction are integrated (such as summation) to obtain the semantic accuracy of the corresponding model instruction. Among them, the logic recognition model can be obtained by model training using labeled training data based on a machine learning method; the labeled training data includes example texts with logical errors or logical contradictions, so that when the training data is used for model training, the model can learn the patterns and rules in these example texts, so that it can be used to identify whether there are logical problems such as logical errors and logical contradictions in any other text based on the learned knowledge, and output the probability of the corresponding problem having logical problems.
[0062] In this case, when executing step S201, the computer device can identify the keywords in the target model instruction and add the identified keywords to the attribute information of the target model instruction. Specifically, the target model instruction can be segmented, and invalid words (such as stop words, modal particles, etc.) in the segmentation results can be filtered out to obtain the keywords in the target model instruction (i.e., words other than invalid words). The target model instruction can also be logically identified using a logical recognition model to obtain the probability that the target model instruction has a logical problem, and the obtained probability is added to the attribute information of the target model instruction, so that when the benchmark performance of the target model instruction is subsequently detected based on the attribute information of the target model instruction, the semantic accuracy of the target model instruction can be detected based on the keywords in the target model instruction and the probability that the target model instruction has a logical problem.
[0063] (2) The grammatical and pragmatic correctness of a model instruction refers to at least one of the grammatical correctness of the model instruction and the pragmatic correctness of the model instruction.
[0064] Grammar is a system of language rules that involves the structure and composition of words, phrases, and sentences. Grammatical rules guide users on how to correctly combine vocabulary and morphological changes to form meaningful and structurally correct sentences. Grammar can include at least the following aspects:
[0065] i. Phonology: the study of speech systems and patterns;
[0066] ii. Morphology: the study of word formation and the structure of morphemes;
[0067] iii. Syntax: studies the structure of sentences and how words are combined into sentences;
[0068] iiii. Lexicon: involves the choice and meaning of words;
[0069] iiiii. Tense and Aspect: involves the time and state expression of verbs.
[0070] Grammatical correctness means that the user follows these grammatical rules, making the language expression clear and accurate.
[0071] Pragmatics is a discipline that studies how language is used in actual communication. It focuses on the social function of language and its meaning in context. Pragmatics can include at least the following contents:
[0072] i. Context: The specific situation in which language is used, including the speaker's intention, the listener's expectations, the time and place of communication, etc.
[0073] ii. Implicature: the speaker's implicit meaning and suggestion;
[0074] iii. Speech Acts: actions performed through language, such as requests, commands, inquiries, promises, etc.;
[0075] iiii. Discourse Analysis: studies the coherence and organization of language communication;
[0076] iiiii. Politeness Principle: the role and expression of politeness in language communication;
[0077] Pragmatic correctness means that language is used in a way that takes into account the context, social norms, and expectations of both parties, making the communication effective and appropriate.
[0078] In general, grammar is the basic rules for constructing language expressions, while pragmatics is the practice of ensuring that these expressions effectively convey intentions and information in specific situations. The two complement each other and together constitute a complete picture of language communication.
[0079] For example, see Figure 3b As shown in Figure 2, grammatical-pragmatic correctness can specifically include at least one of the following sub-factors (or levels):
[0080] A. No typos. Example a: The high-quality instruction without typos is "Please print out a copy of the document in this folder", while the low-quality instruction with typos is "Please print out a copy of the document in this folder". Since the low-quality instruction in Example a has the error of writing "copy" as "powder", it can be considered that the low-quality instruction in Example a has a typo and is likely to not be executed accurately (that is, the media model is likely to be unable to correctly execute the corresponding task according to the low-quality instruction in Example a).
[0081] B. No syntax errors (i.e., correct syntax). Example b: A high-quality instruction without syntax errors is "If you know python, can you help me read this file into memory?", while a low-quality instruction with syntax errors is "If you know python, can you help me read this file into memory?"; Since the low-quality instruction in example b has English syntax, which is inconsistent with the syntax of the language (Chinese) actually used in the instruction, it can be considered that the low-quality instruction in example b has syntax errors, and the instruction is likely not to be executed accurately, resulting in poor execution of the corresponding task.
[0082] C. No tense error (i.e. correct tense). Example c: The high-quality instruction without tense error is "you execute this code", while the low-quality instruction with tense error is "you executed this code"; since the low-quality instruction in example c expresses the command intention of requiring the media model to execute the code as the meaning of executing this code, it can be considered that the low-quality instruction in example c has a tense error, resulting in a large semantic deviation in the corresponding instruction, which may cause the expected intention (i.e. the intention to execute the code) to fail to be correctly recognized by the media model, resulting in the corresponding task failing to be correctly executed.
[0083] D. Conform to language and cultural habits. Example d: The high-quality instruction that conforms to the expression habits of the language used in the model instruction (i.e., language and cultural habits) is "Please help me check the weather tomorrow", while the low-quality instruction that does not conform to the expression habits of the language used in the model instruction is "Please forgive me, help me check the weather tomorrow"; since the low-quality instruction in Example d is in Chinese, but the "Please forgive me" it contains is based on the English expression habit of "please" (i.e., "Excuse me"), that is, the low-quality instruction in Example d has English expression habits ("Excuse me"), which does not conform to the expression habits of the language used (i.e., Chinese language and cultural habits). Therefore, it can be considered that the low-quality instruction in Example d does not conform to language and cultural habits, which may cause the media model to produce unnecessary responses to this part when responding to the instruction, or even misunderstand the core instruction content, resulting in the instruction being very likely not to be accurately executed.
[0084] In summary, if a model instruction input into the media model contains typos / grammatical errors / tense errors / inconsistency with language and cultural habits, etc., then the task execution effect based on this model instruction will be greatly reduced (i.e., the correct task execution result may not be obtained).
[0085] Based on the relevant description of the above part (2), the embodiment of the present application further proposes a method for measuring the grammatical and pragmatic correctness of the model instruction based on the instruction similarity between the model instruction to be evaluated and the correct model instruction. The principle of the method is: obtain the semantic vector representation of the correct model instruction and the correct model instruction; in addition, obtain the semantic vector representation of the model instruction to be evaluated (i.e., the model instruction to be quality tested); in this way, the instruction similarity between the model instruction to be evaluated and the correct model instruction can be calculated based on the two semantic vectors, so as to measure the grammatical and pragmatic correctness of the model instruction to be evaluated based on the calculated instruction similarity. Among them, the number of correct model instructions mentioned here can be 1, and this 1 correct model instruction can have the above four factors (i.e., no typos, no grammatical errors, no tense errors, and conforming to language and cultural habits) at the same time; or, the number of correct model instructions mentioned here can be multiple, and the above factors possessed by different correct model instructions in these multiple correct model instructions may be different, such as correct model instruction 1 has the factor of no typos, correct model instruction 2 has the factor of no tense errors, or correct model instruction 3 has the two factors of no typos and no grammatical errors, and so on.
[0086] Based on the above-mentioned method for measuring the grammatical and pragmatic correctness of model instructions based on the instruction similarity between the model instructions to be evaluated and the correct model instructions, when the benchmark performance of the target model instructions includes the grammatical and pragmatic correctness of the target model instructions, the computer device can encode the target model instructions when executing step S201 to obtain a first semantic vector (i.e., the semantic vector of the target model instructions), thereby adding the first semantic vector to the attribute information of the target model instructions, so that when the benchmark performance of the target model instructions is subsequently detected based on the attribute information of the target model instructions, the above-mentioned method for measuring the grammatical and pragmatic correctness of model instructions based on the instruction similarity between the model instructions to be evaluated and the correct model instructions can be used to detect the grammatical and pragmatic correctness of the target model instructions based on the first semantic vector.
[0087] It should be noted that the above is only an exemplary description of a method for judging grammatical pragmatic correctness, and does not limit this. For example, in other embodiments, the spelling error rate, grammatical error rate, tense error rate and language and cultural habit conformity rate of the model instruction to be evaluated can also be identified respectively, so as to judge the grammatical pragmatic correctness of the model instruction based on the identified information. Among them, the spelling error rate can be calculated based on the number of typos in the model instruction and the total number of characters of the corresponding model instruction, the grammatical error rate can be calculated based on the number of incorrect grammars in the model instruction and the total number of grammars of the corresponding model instruction, the tense error rate can be calculated based on the consistency rate between the tense words in the model instruction and the tense words in the correct model instruction, and the language and cultural habit conformity rate can be obtained by predicting the probability that the model instruction conforms to the language and cultural habits through the language recognition model.
[0088] In this case, when executing step S201, the computer device can perform at least one of the following operations: calling a typo recognition model to identify typos in the target model instructions, and adding the number of identified typos to the attribute information of the target model instructions; calling a grammar recognition model to identify incorrect grammar in the target model instructions, and adding the number of identified incorrect grammar to the attribute information of the target model instructions; calling a tense word recognition model to identify tense words in the target model instructions, and adding the identified tense words to the attribute information of the target model instructions; calling a language recognition model to predict the probability that the target model instructions conform to language and cultural habits, and adding the predicted probability as the language and cultural habit conformity rate of the target model instructions to the attribute information of the target model instructions, so that when the benchmark performance of the target model instructions is subsequently detected based on the attribute information of the target model instructions, at least one of the typo rate, grammatical error rate, tense error rate and language and cultural habit conformity rate of the target model instructions can be determined based on the relevant information, thereby detecting the grammatical and pragmatic correctness of the target model instructions based on the determined relevant information. It should be noted that any of the models mentioned here, such as the typo recognition model, grammar recognition model, tense word recognition model, and language recognition model, can be obtained by model training based on machine learning methods.
[0089] (3) The structural complexity of a model instruction refers to the complexity of the text structure of the model instruction. For the same task, a model instruction with a higher text structure complexity is usually longer than a model instruction with a lower text structure complexity. Moreover, the higher the complexity of the text structure of a model instruction, the more uncertain the media model may be in understanding the model instruction and the effect of executing the model instruction, thereby increasing the possibility of failure in executing the corresponding task or the possibility of inaccurate execution results; therefore, for the same task, if a simple model instruction (i.e. a model instruction with a low text structure complexity) can be used to indicate it, then this model instruction will be given priority. For example:
[0090] Example 1:
[0091] Complex instructions (i.e., model instructions with a higher level of text structure complexity) are: “I need you to go to the supermarket to buy some groceries before this afternoon, including but not limited to fresh fruits and vegetables, some whole-wheat bread, and lactose-free milk, and then go to the express delivery point to pick up my express delivery. Remember to check whether the address and recipient on the express delivery slip are correct. Finally, on the way home, stop by the post office to mail a letter. The envelope and stamps are in the drawer in the living room. Don’t forget to put the stamp on the envelope and write the correct address”;
[0092] Simple instructions (i.e., model instructions with less complex text structures) were: “Please run a few errands for me this afternoon: go to the supermarket to buy some groceries, including fruits, vegetables, whole-wheat bread, and lactose-free milk; go to the delivery point to pick up a package; then mail a letter at the post office. The envelope and stamps are in the living room drawer.”
[0093] The above example 1 demonstrates an actual task in daily life. Since both complex instructions and simple instructions express similar meanings and task contents, the simple instructions in the above example 1 can be used preferentially to indicate the corresponding task.
[0094] Example 2:
[0095] The complex instructions (i.e., the model instructions with a higher degree of text structure complexity) are: "If you want to check why your computer cannot access the Internet, you need to first confirm that all cables are properly connected to your router and computer. Then you should check your local network connection settings to make sure that your IP address is obtained automatically. Next, open the command prompt and run a ping test to check whether your computer can successfully send data packets to your default gateway. If this test fails, you may need to restart your router and computer and then test again. If the problem persists, you may need to contact your Internet service provider or seek a professional technician to help you solve the problem."
[0096] Simple instructions (i.e., model instructions with a less complex text structure) are: "If your computer cannot connect to the Internet, first check that all cables are connected. Then check the network settings and make sure the IP address is set to automatic. Try restarting the router and computer. If that still doesn't work, you may need to contact your Internet service provider."
[0097] The above example 2 shows a network inspection task. Since the information density of complex instructions is low, the core content can be covered in simple instructions. Therefore, the simple instructions in the above example 2 can be used to indicate the corresponding task.
[0098] Example 3:
[0099] Complex instructions (i.e., model instructions with a high degree of text structure complexity) are: "Please build a program that first needs to obtain data from an online API, then parse the data into JSON format, then filter out all records of people older than 30, and finally output the names and email addresses of these records into a CSV file, and ensure that this file does not have any format errors or missing data";
[0100] Simple instructions (i.e., model instructions with less complex text structures) are: “Please write a script to get data from the API, extract the names and email addresses of people older than 30, and save them to a CSV file.”
[0101] The above example 3 shows a programming implementation task. Since the complex instructions contain more information, but the key information has been covered in the simple instructions, the simple instructions in the above example 3 can be used first to indicate the corresponding task.
[0102] For example, see Figure 3c As shown, structural complexity can be determined based on at least one of the following sub-factors (or levels):
[0103] A. Instruction length. The instruction length can be counted with a single character as the statistical unit, so that the instruction length is the number of characters in the model instruction. Taking the above example three as an example, the complex instruction contains 117 characters, and the simple instruction contains 45 characters, so the instruction length of the complex instruction in example three is 117, and the instruction length of the simple instruction in example three is 45.
[0104] B. Number of concepts. Concepts refer to words used to distinguish different actions and different objects, that is, the number of concepts can be the sum of the number of words used to represent actions and the number of words used to represent objects. Taking the above example 3 as an example, the complex instructions include words such as "build" / "program" / "get" / "data" / "parse" / "format" / "filter" / "name and email" / "output" / "file" / "ensure" etc. used to represent actions and objects. Therefore, the number of concepts in the complex instructions in this example 3 is 11; similarly, the number of concepts in the simple instructions in example 3 is 8.
[0105] C. Number of clauses. The number of clauses is a complexity value of a sentence structure, which can be counted with a single clause as the statistical unit, and a clause refers to a sentence obtained by splitting the target model instruction; the embodiment of the present application does not limit the way of splitting the model instruction, for example, the model instruction can be split based on punctuation marks, that is, a clause in this case is composed of multiple consecutive characters in the target model instruction that are not separated by punctuation marks. Taking the above example three as an example, the complex instruction contains 6 clauses such as "Please build a program" / "The program first needs to obtain data from an online API" / "Then parse the data into JSON format" / "Then filter out all records for people over 30 years old" / "Finally, output the names and email addresses of these records into a CSV file" / "And make sure that this file does not have any format errors or missing data", so the number of clauses of the complex instruction in Example 3 is 6; similarly, the number of clauses of the simple instruction in Example 3 is 4.
[0106] D. Number of professional terms. The number of professional terms is the professional value of a term, which can be counted with a single professional term as the statistical unit. Professional terms refer to specialized words or terms used in a specific research field. Taking the above example 3 as an example, the complex instruction contains professional terms such as ["program", "online API", "data analysis", "JSON format", "CSV file"], so the number of professional terms in the complex instruction in this example 3 is 5; and since the simple instruction in example 3 only contains professional terms such as ["script", "API", "CSV file"], the number of professional terms in the simple instruction in this example 3 is 3.
[0107] Based on the relevant description in the above section (3), when the benchmark performance of the target model instruction includes the structural complexity of the target model instruction, when executing step S201, the computer device can respectively count the structural parameter values of the target model instruction under at least one structural dimension, and add the counted structural parameter values to the attribute information of the target model instruction, so that when the benchmark performance of the target model instruction is subsequently detected based on the attribute information of the target model instruction, the structural complexity of the target model instruction can be determined based on the structural parameter values of the target model instruction under at least one structural dimension. Among them, at least one structural dimension may include at least one of the following: length dimension, concept number dimension, clause number dimension, and term number dimension. It can be understood that the structural parameter value of the target model instruction under the length dimension is: the instruction length of the target model instruction (that is, the number of characters in the target model instruction); the structural parameter value of the target model instruction under the concept number dimension is: the number of concepts in the target model instruction; the structural parameter value of the target model instruction under the clause number dimension is: the number of clauses in the target model instruction; the structural parameter value of the target model instruction under the term number dimension is: the number of professional terms in the target model instruction.
[0108] It should be noted that the above is only an exemplary description of a method for determining structural complexity and does not limit this. For example, in other embodiments, the structural recognition model can also be called to identify the structural complexity of the model instruction to be evaluated to obtain the structural complexity of the corresponding model instruction. Among them, the structural recognition model can be obtained by model training using training samples based on a machine learning method. The training sample may include at least one sample model instruction and the structural complexity annotated for each sample model instruction, so that during the model training process, the structural model can be called to identify the structural complexity of each sample model instruction, thereby optimizing the model parameters of the preset model based on the difference between the identified structural complexity and the structural complexity annotated for the corresponding model instruction, thereby obtaining a structural recognition model.
[0109] In this case, when executing step S201, the computer device can directly add the target model instruction to the attribute information of the target model instruction, so that when the benchmark performance of the target model instruction is subsequently detected based on the attribute information of the target model instruction, the structure recognition model can be called to directly identify the structural complexity of the target model instruction.
[0110] S202, detecting a benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain a first detection result.
[0111] (1) The benchmark performance of the target model instructions includes: the semantic accuracy of the target model instructions.
[0112] In a specific implementation, if the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model, the specific implementation of step S202 may include: obtaining a task description text of the media data processing task, and encoding the task description text to obtain a second semantic vector. Based on the first semantic vector and the second semantic vector, the semantic distance between the target model instruction and the task description text is calculated; specifically, the vector distance between the first semantic vector and the second semantic vector can be calculated based on a vector distance calculation function (such as a cosine distance function, a Euclidean distance function, etc.), and the calculated vector distance is used as the semantic distance between the target model instruction and the task description text. Further, the computer device can detect the semantic accuracy of the target model instruction according to the calculated semantic distance, and add the detected semantic accuracy to the first detection result. Among them, the semantic accuracy can be proportional to the calculated semantic distance. For example, the method of detecting the semantic accuracy of the target model instruction according to the calculated semantic distance can be: directly using the calculated semantic distance as the semantic accuracy of the target model instruction; or scaling the calculated semantic distance, and using the scaled semantic distance as the semantic accuracy of the target model instruction, and so on.
[0113] It should be noted that the semantic distance between the target model instruction and the task description text can range from [-1, 1]. If the value of the semantic distance is a negative number, it means that the semantic direction of the target model instruction is opposite to that of the task description text, and the closer the value of the semantic distance is to -1, the more serious the degree of the opposite is. At this time, it can be considered that the target model instruction may have logical problems or serious deviations in information expression. It can be considered that the target model instruction may lack logical correctness / logical consistency, or the information expression of the target model instruction may not be accurate enough / the information elements are not complete enough. If the value of the semantic distance is a positive number, it means that the semantic direction of the target model instruction is the same as that of the task description text, and the closer the value of the semantic distance is to 1, the closer the semantic accuracy of the target model instruction is to the task requirements (no logical contradiction) and the clearer the element information is covered, the closer it is to the requirements of the task background (i.e., the task description text).
[0114] Based on this, optionally, if the process of detecting the benchmark performance of the target model instruction includes: calculating the semantic distance between the target model instruction and the task description text of the media data processing task, the computer device can also detect the directional consistency between the semantic direction of the target model instruction and the semantic direction of the task description text based on the positive or negative value of the semantic distance; specifically, if the value of the semantic distance is positive, it can be determined that the semantic direction of the target model instruction and the semantic direction of the task description text are consistent, that is, it can be determined that the directional consistency is detected; if the value of the semantic distance is negative, it can be determined that the semantic direction of the target model instruction and the semantic direction of the task description text are inconsistent, that is, it can be determined that the directional consistency is not detected. Further, if the directional consistency is detected, the quality detection process of the target model instruction continues to be executed (that is, the benchmark performance of the target model instruction and the subsequent steps S203-S205 are continued to be detected); if the directional consistency is not detected, the target model instruction is determined to be an unusable model instruction, and the quality detection process of the target model instruction ends (that is, the benchmark performance of the target model instruction is stopped and the subsequent steps S203-S205 are no longer executed). It can be seen that this method can avoid wasting processing resources for quality inspection when the target model instructions and the task description text have opposite semantics, thereby saving processing resources and improving the effective use of processing resources.
[0115] In another specific implementation, if the attribute information of the target model instruction includes: the keywords in the target model instruction and the probability that the target model instruction has logical problems; then the specific implementation method of step S202 may include: obtaining the keywords in the task description text, and calculating the ratio between the keywords in the target model instruction and the keywords in the task description text as the information expression accuracy / information element integrity of the target model instruction; and, taking the probability that the target model instruction has logical problems as the logical correctness / logical consistency of the target model instruction; thereby, the information expression accuracy / information element integrity and logical correctness / logical consistency of the target model instruction are integrated (such as summed) to obtain the semantic accuracy of the target model instruction.
[0116] Among them, the above-mentioned matching degree can be: the ratio between the number of identical keywords between the keywords in the target model instruction and the keywords in the task description text and the number of keywords in the task description text; or, it can also be equal to the intersection-and-union ratio between the keywords in the target model instruction and the keywords in the task description text, where the intersection-and-union ratio refers to the ratio between the number of intersecting keywords (i.e., identical keywords) and the number of combined keywords (i.e., total keywords), and there is no limitation on this. For example, assuming that the target model instruction includes three keywords, "analysis", "positive", and "negative", and the task description text includes four keywords, "classification", "positive", "negative", and "neutral", then the identical keywords between the keywords in the target model instruction and the keywords in the task description text include "positive" and "negative", that is, the number of identical keywords is 2, then the matching degree can be equal to 2 / 4 (the number of keywords in the task description text) = 0.5, or the matching degree can be equal to 2 / 5 (the total number of keywords) = 0.4.
[0117] (2) The benchmark performance of the target model instructions includes: the grammatical and pragmatic correctness of the target model instructions.
[0118] In a specific implementation, if the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model, the specific implementation of step S202 may include: obtaining a correct model instruction under the grammatical pragmatic correctness index, the correct model instruction refers to a model instruction generated based on the media data processing task and meeting the corresponding index requirements; encoding the correct model instruction to obtain a third semantic vector; based on the first semantic vector and the third semantic vector, calculating the instruction similarity between the target model instruction and the correct model instruction, specifically, the vector similarity between the first semantic vector and the third semantic vector may be calculated based on a vector similarity calculation function (such as a cosine similarity function), and the calculated vector similarity is used as the instruction similarity between the target model instruction and the correct model instruction. Furthermore, the grammatical pragmatic correctness of the target model instruction may be detected based on the calculated instruction similarity, and the detected grammatical pragmatic correctness may be added to the first detection result.
[0119] Among them, the grammatical and pragmatic correctness index mentioned above may include at least one of the following sub-indicators: a spelling error sub-indicator, a grammatical quality sub-indicator, a tense correctness sub-indicator, and a language and cultural habit sub-indicator. In addition, the index requirements of the spelling error sub-indicator include: there are no spelling errors in the model instructions; the index requirements of the grammatical quality sub-indicator include: there are no grammatical errors in the model instructions; the index requirements of the tense correctness sub-indicator include: there are no tense errors in the model instructions; the index requirements of the language and cultural habit sub-indicator include: the expression of the model instructions conforms to the expression habits of the language used by the corresponding model instructions.
[0120] It should be noted that the number of correct model instructions mentioned above can be 1; in this case, the correct model instruction obtained by the computer device is a model instruction that simultaneously meets the index requirements of each sub-indicator in the grammatical pragmatic correctness index. Then in this case, the number of calculated instruction similarities is also 1, and the grammatical pragmatic correctness can be proportional to the calculated 1 instruction similarity; for example, the method of detecting the grammatical pragmatic correctness of the target model instruction based on the calculated instruction similarity can be: directly using the calculated instruction similarity as the grammatical pragmatic correctness of the target model instruction; or, scaling the calculated instruction similarity, and using the scaled instruction similarity as the grammatical pragmatic correctness of the target model instruction, and so on.
[0121] Alternatively, the number of correct model instructions mentioned above can be multiple; in this case, there is a correct model instruction under each sub-indicator in the grammatical pragmatic correctness index, and the correct model instruction under each sub-indicator is encoded separately to obtain the third semantic vector corresponding to each sub-indicator, and the third semantic vector corresponding to each sub-indicator is used to calculate the instruction similarity between the target model instruction and the correct model instruction under the corresponding sub-indicator, so that the number of calculated instruction similarities is multiple, so that the quality detection of the target model instruction can be carried out in a fine-grained manner based on each sub-indicator, thereby improving the accuracy of quality detection. In this case, the specific implementation method of detecting the grammatical pragmatic correctness of the target model instruction according to the calculated instruction similarity can be any of the following:
[0122] Implementation method 1: traverse each sub-indicator in the grammatical pragmatic correctness index, and determine the kth sub-indicator currently traversed, where k is a positive integer and is not greater than the number of sub-indicators in the grammatical pragmatic correctness index. According to the instruction similarity between the target model instruction and the correct model instruction under the kth sub-indicator, score the target model instruction under the kth sub-indicator to obtain the score of the target model instruction under the kth sub-indicator; specifically, the instruction similarity between the target model instruction and the correct model instruction under the kth sub-indicator can be directly used as the score of the target model instruction under the kth sub-indicator, or the instruction similarity between the target model instruction and the correct model instruction under the kth sub-indicator can be scaled, and the scaled instruction similarity can be used as the score of the target model instruction under the kth sub-indicator. Further, after all sub-indicators in the grammatical pragmatic correctness index are traversed, the grammatical pragmatic correctness of the target model instruction can be determined based on the scores of the target model instruction under each sub-indicator.
[0123] Specifically, when the computer device determines the grammatical and pragmatic correctness of the target model instruction based on the score of the target model instruction under each sub-indicator, it can perform weighted summation on the score of the target model instruction under each sub-indicator to obtain the grammatical and pragmatic correctness of the target model instruction. Alternatively, considering the task context of a media data processing task of a given media model, a serious defect in one aspect of the model instruction may directly lead to the low quality of the corresponding model instruction and poor task execution effect; for example, assuming that a model instruction performs well in the three sub-indicators of typos, grammatical quality, and language and cultural habits, but it expresses incorrect information in the sub-indicator of tense correctness (such as expressing the present tense as the past tense), then the task execution direction indicated by the model instruction will be completely wrong. Therefore, it can be seen that the defect with the lowest score is the key to reflecting the grammatical pragmatic correctness index; based on this, when the computer device determines the grammatical pragmatic correctness of the target model instruction based on the score of the target model instruction under each sub-indicator, it can select the smallest score from the score of the target model instruction under each sub-indicator as the grammatical pragmatic correctness of the target model instruction, thereby improving the accuracy of the grammatical pragmatic correctness.
[0124] Implementation method 2: Integrate the instruction similarity between the target model instruction and the correct model instruction under each sub-indicator (such as summing or averaging) to obtain the integrated instruction similarity; score the target model instruction based on the integrated instruction similarity to obtain the grammatical pragmatic correctness of the target model instruction, which may be proportional to the integrated instruction similarity. Specifically, the integrated instruction similarity may be directly used as the grammatical pragmatic correctness of the target model instruction, or the integrated instruction similarity may be scaled to obtain the grammatical pragmatic correctness of the target model instruction; or, based on the preset correspondence between instruction similarity and grammatical pragmatic correctness, the grammatical pragmatic correctness corresponding to the integrated instruction similarity may be used as the grammatical pragmatic correctness of the target model instruction.
[0125] In another specific implementation, if the attribute information of the target model instruction includes at least one of the following: the number of wrong characters in the target model instruction, the number of incorrect grammars in the target model instruction, the tense words in the target model instruction, and the probability that the target model instruction conforms to the language and cultural habits, then the specific implementation of step S202 may include: calculating the ratio between the number of wrong characters in the target model instruction and the total number of characters in the target model instruction as the wrong character rate of the target model instruction; calculating the ratio between the number of incorrect grammars in the target model instruction and the total number of grammars in the target model instruction as the grammatical error rate of the target model instruction; obtaining the tense words in the correct model instruction, and calculating the consistency rate between the tense words in the correct model instruction and the tense words in the target model instruction, according to the principle that the consistency rate is inversely proportional to the tense error rate, determining the tense error rate of the target model instruction based on the calculated consistency rate; and taking the probability that the target model instruction conforms to the language and cultural habits as the language and cultural habit conformity rate of the target model instruction. Further, according to at least one of the wrong character rate, grammatical error rate, tense error rate, and language and cultural habit conformity rate of the target model instruction, the grammatical and pragmatic correctness of the target model instruction is determined.
[0126] Among them, the calculation method of the consistency rate between the tense words in the correct model instructions mentioned above and the tense words in the target model instructions is similar to the calculation method of the intersection and union ratio between the keywords in the target model instructions and the keywords in the task description text mentioned above, and will not be repeated here. In addition, according to at least one of the typo rate, grammatical error rate, tense error rate and language and cultural habit conformity rate of the target model instructions, the specific implementation method of determining the grammatical pragmatic correctness of the target model instructions can be: taking the minimum value of at least one item as the grammatical pragmatic correctness of the target model instructions, or performing an average or sum operation on at least one item to obtain the grammatical pragmatic correctness of the target model instructions.
[0127] (3) The benchmark performance of the target model instruction includes: the structural complexity of the target model instruction.
[0128] In a specific implementation, if the attribute information of the target model instruction includes: the structural parameter value of the target model instruction in at least one structural dimension, the specific implementation of step S202 may include: obtaining the weight coefficient of each structural dimension in the at least one structural dimension. The weight coefficient of each structural dimension is used to weight the structural parameter value of the target model instruction in at least one structural dimension to obtain a parameter value summation result; specifically, the weight coefficient of each structural dimension is used to weight the structural parameter value of the target model instruction in the corresponding structural dimension to obtain the weighted structural parameter value of the target model instruction in each structural dimension, and the weighted structural parameter values of the target model instruction in each structural dimension are summed to obtain a parameter value summation result. Further, the computer device can detect the structural complexity of the target model instruction based on the parameter value summation result, and add the detected structural complexity to the first detection result.
[0129] Among them, the method of detecting the structural complexity of the target model instruction based on the parameter value summation result can be: using a normalization function, normalizing the parameter value summation result to obtain a normalized parameter value, and using the normalized parameter value as the structural complexity of the target model instruction. By obtaining the structural complexity of the target model instruction through normalization, it can be ensured that the structural complexity is within the range of [0, 1]. This can not only improve the accuracy of the structural complexity, but also ensure that the structural complexity and other benchmark performances (such as semantic accuracy, grammatical and pragmatic correctness, etc.) are at the same numerical level, which is beneficial to the subsequent generation of quality information.
[0130] It should be noted that the weight coefficient of each structural dimension determines the structural parameter value under the corresponding structural dimension of the target model instruction. These weight coefficients can be adjusted according to the specific situation to reflect the relative importance of different structural dimensions for the contribution to the overall structural complexity of the target model instruction. For example, if the target model instruction contains many professional terms, it can be considered that it increases the complexity. At this time, it can be reflected by increasing the weight coefficient of the term quantity dimension, thereby enhancing the contribution of the structural parameter value of the target model instruction under the term quantity dimension to the overall structural complexity, so that the final determined structural complexity is more in line with the actual situation. It can be seen that determining the structural complexity of the target model instruction by weighted summation can improve the accuracy of the structural complexity of the target model instruction.
[0131] In addition, the above is only an exemplary description of a specific detection method of the structural complexity of the target model instruction, and does not limit this. For example, in other embodiments, the computer device may also directly sum or average the structural parameter values of the target model instruction in at least one structural dimension to obtain an operation result, thereby detecting the structural complexity of the target model instruction based on the operation result, and adding the detected structural complexity to the first detection result. Alternatively, the computer device may also directly use the structural parameter values of the target model instruction in at least one structural dimension to generate the structural complexity of the target model instruction, and add the generated structural complexity to the first detection result; in this case, the structural complexity includes the structural parameter values of the target model instruction in at least one structural dimension.
[0132] In another specific implementation, if the attribute information of the target model instruction includes the target model instruction, the specific implementation of step S202 may include: calling the structure recognition model to perform structural complexity recognition on the target model instruction, obtaining the structural complexity of the target model instruction, and adding the obtained structural complexity to the first detection result.
[0133] S203, calling the media model to perform the media data processing task on the media data sample based on the target model instruction, and obtaining an actual task execution result.
[0134] Wherein, the media data sample refers to: media data preset based on the media data processing task and used to perform quality detection on the target model instruction. For example, when the media data processing task is a text sentiment classification task, the media data sample can be a text, such as the text "Today's test score is not good, it's terrible". When the media data processing task is a text translation task, the media data sample can be a text based on a certain language, such as the text "I have an apple" based on English. When the media data task is a video frame sequence generation task, the media data sample can be an image required for reference when generating a video frame sequence, such as an image containing a game character; or, the media data sample can be a text used to indicate the video content of the video frame sequence to be generated, such as a text containing words such as "dance" and "game character", which indicates that the video content of the video frame sequence to be generated is a game character dancing.
[0135] In a specific implementation, the number of media data samples is M, where M is a positive integer; that is, the number of media data samples can be one or more (i.e., at least two). When the number of media data samples is one, the specific way in which the computer device performs step S203 can be: calling the media model based on the target model instruction, performing the media data processing task on the media data sample, and obtaining an actual task execution result; when the number of media data samples is multiple, the specific way in which the computer device performs step S203 can be: calling the media model based on the target model instruction, performing the media data processing task on each media data sample respectively, and obtaining the actual task execution result corresponding to each media data sample, that is, obtaining multiple actual task execution results.
[0136] It should be noted that the number of media models can be 1. Alternatively, considering that the model instructions must eventually be input into the media model to perform the corresponding media data processing tasks, it is meaningful to discuss the quality of the model instructions based on a given media model. If the model instruction can only produce a better task execution effect on a specified media model, it means that the effect brought by this model instruction is accidental, indicating that the model instruction is adapted and debugged for the specified model and may not necessarily achieve better results on other media models. In fact, the task execution effect of this model instruction is not robust / unstable; based on this, the number of media models can be multiple.
[0137] Furthermore, considering that in an actual production environment, the model is updated iteratively and will be changed to a higher version with better effect, multiple model versions of the same media model can be used to check the quality of the model instructions to measure whether the corresponding model instructions can produce better results on different versions of the media model, that is, to reflect the comprehensive performance of the task execution effect generated by the model instructions on different versions of the daily model. In addition, considering that there are differences between different media models (i.e., media models with different parameter scales and model structures), the task execution results generated by the model instructions on different media models can also be tested to evaluate the quality of the model instructions. Based on this, the multiple media models can include multiple model versions of X models, one media version is one media model, and X is a positive integer. Of course, it is understandable that in other embodiments, the multiple media models can also include one model version of X models, without limitation.
[0138] It should be noted that, when there are multiple media models, the computer device may execute steps S203 - S204 for each media model to obtain the second detection result corresponding to each media model.
[0139] S204: Based on the actual task execution result, detect the task execution accuracy of the target model instruction on the media model to obtain a second detection result.
[0140] Based on the relevant description of step S203, it can be known that the number of media data samples is M, and the media model can perform the media data processing task on each media data sample based on the target model instruction to obtain the actual task execution result corresponding to each media data sample. Based on this, the specific implementation of step S204 can include the following steps s11-s14:
[0141] s11, obtain the preset task execution result corresponding to each media data sample. The so-called preset task execution result refers to: the preset task execution result that should be obtained when the expected media model performs the media data processing task on the corresponding media data sample. For example, when the media data processing task is a text sentiment classification task, and the media data sample is "Today's test score is not good, it's terrible", the preset task execution result corresponding to the media data sample can be "negative". When the media data processing task is a text translation task, and the media data sample is "I have an apple", the preset task execution result corresponding to the media data sample can be "I have an apple". When the media data task is a video frame sequence generation task, and the media data sample is a text indicating that the video content of the video frame sequence to be generated is a game character dancing, the preset task execution result corresponding to the media data sample can be a dancing video of a game character.
[0142] s12, evaluate the score of each media data sample on the media model according to the preset task execution result and the corresponding actual task result corresponding to each media data sample. In a specific implementation, the computer device may perform step s12 in a two-level scoring manner to obtain the score of each media data sample on the media model. Specifically, for the mth media data sample (m∈[1,M]), the computer device may determine whether the preset task execution result corresponding to the mth media data sample is the same as the corresponding actual task execution result. If they are the same, the score of the mth media data sample on the media model may be determined as the first score; if they are different, the score of the mth media data sample on the media model may be determined as the second score; the first score here is greater than the second score, such as the first score is 1 and the second score is 0. In another specific implementation, the computer device may also perform step s12 in a similarity calculation manner to obtain the score of each media data sample on the media model. Specifically, for the mth media data sample, the computer device can calculate the similarity between the preset task execution result corresponding to the mth media data sample and the corresponding actual task execution result, and directly use the calculated similarity as the score of the mth media data sample on the media model to determine the first score, or perform a linear change (such as scaling) on the calculated similarity to obtain the score of the mth media data sample on the media model to determine the first score.
[0143] s13, integrating the scores of the M media data samples on the media model to obtain the score of the target model instruction on the media model. The integration mentioned here may be a mean operation, a sum operation, etc. That is, the specific implementation method of step s13 may be: performing a mean operation or a sum operation on the scores of the M media data samples on the media model to obtain the score of the target model instruction on the media model.
[0144] s14, based on the score of the target model instruction on the media model, detect the task execution accuracy of the target model instruction on the media model to obtain a second detection result. The second detection result includes the task execution accuracy of the target model instruction on the media model, and the task execution accuracy of the target model instruction on the media model can be proportional to the score of the target model instruction on the media model. For example, based on the score of the target model instruction on the media model, the way to detect the task execution accuracy of the target model instruction on the media model can be: directly use the score of the target model instruction on the media model as the task execution accuracy of the target model instruction on the media model; or, linearly change the score of the target model instruction on the media model (such as scaling processing) to obtain the task execution accuracy of the target model instruction on the media model, and so on.
[0145] S205: Generate quality information of the target model instruction based on the first detection result and the second detection result.
[0146] In a specific implementation of step S205, when the number of media models is 1, the number of second detection results is 1; then, the specific implementation of step S205 may include the following steps s21-s23:
[0147] s21, scoring the target model instruction according to each numerical value in the first detection result to obtain multiple performance scores of the target model instruction.
[0148] As can be seen from the above, the first test result includes at least one of the following numerical values: semantic accuracy, grammatical pragmatic correctness, and structural complexity. Considering that from the perspective of semantic accuracy, the more semantically accurate the model instruction is, the better the task execution effect may be. Therefore, if the first test result includes semantic accuracy, the computer device can directly use the semantic accuracy as the performance score of the target model instruction under the semantic accuracy index. Considering that from the perspective of grammatical pragmatic correctness, the more grammatically pragmatically correct the model instruction is, the better the task execution effect may be. Therefore, if the first test result includes grammatical pragmatic correctness, the computer device can directly use the grammatical pragmatic correctness as the performance score of the target model instruction under the grammatical pragmatic correctness index.
[0149] Considering that from the perspective of structural complexity, the structurally complex model instructions are much more complex than the simple model instructions, which will place higher requirements on the media model in terms of the ability to understand the semantics of the model instructions and follow the model instructions. Overly complex model instructions are not necessary and should be simplified in the direction of structural simplicity. Therefore, the computer device can penalize the quality score of the model instruction, that is, add a penalty term so that the model instruction with higher structural complexity is penalized more and its quality score is lower. On the contrary, the model instruction with lower structural complexity is penalized less and its quality score is higher. Based on this, if the first detection result includes structural complexity, the computer device follows the principle that structural complexity is inversely proportional to performance score, and determines the performance score of the target model under the structural complexity measurement index based on the structural complexity of the target model instruction. For example, the opposite number of the structural complexity of the target model instruction can be used as the performance score of the target model under the structural complexity measurement index, or the difference between the benchmark value (such as value 1) and the structural complexity of the target model instruction is obtained, and the obtained difference is used as the performance score of the target model under the structural complexity measurement index, and so on.
[0150] s22, taking the task execution accuracy in the second detection result as the task execution effect score of the target model instruction.
[0151] s23, summing up (such as direct summing up or weighted summing up) the multiple performance scores of the target model instructions and the task execution effect scores of the target model instructions to obtain the quality score of the target model instructions, and then using the quality score of the target model to construct the quality information of the target model instructions, so that the quality information includes the quality score.
[0152] In another specific implementation of step S205, when there are multiple media models, one media model corresponds to one second detection result; then, the specific implementation of step S205 may include the following steps s31-s32:
[0153] s31, based on the task execution accuracy in the second detection results corresponding to the multiple media models, the task execution effect of the target model instruction is scored to obtain a task execution effect score.
[0154] Specifically, if the multiple media models include a model version of X models, the specific implementation method of step s31 may be: directly integrating (such as averaging or summing) the task execution accuracy in the second detection result corresponding to each model to obtain the task execution effect score.
[0155] If the multiple media models include multiple model versions of X models, the specific implementation of step s31 can be: traverse each model in the X models to determine the currently traversed x-th model, x∈[1,X]; perform mean calculation on the task execution accuracy in the second detection result corresponding to each model version of the x-th model to obtain the accuracy mean; based on the accuracy mean, score the task execution effect of the target model instruction on the x-th model to obtain the score of the target model instruction on the x-th model; after each model in the X models is traversed, integrate (such as mean or sum) the scores of the target model instruction on each model to obtain the task execution effect score. It can be seen that in this way, not only can the execution effect of the target model instruction on different model versions of the same model be verified, but also the execution effect of the target model instruction on different models can be verified, which can improve the accuracy of the task execution effect score of the target model instruction.
[0156] Among them, based on the accuracy mean, the task execution effect of the target model instruction on the x-th model is scored, and the specific implementation method for obtaining the score of the target model instruction on the x-th model can be: respectively calculate the difference between the task execution accuracy and the accuracy mean in the second detection result corresponding to each model version of the x-th model to obtain multiple differences. Based on multiple differences, the accuracy stability of the target model instruction on the x-th model is calculated, and the accuracy stability is used to indicate: the stability between the task execution accuracy of the target model instruction on each model version of the corresponding model; specifically, the multiple differences can be directly averaged to obtain the accuracy stability of the target model instruction on the x-th model, or the square of each difference can be averaged to obtain the accuracy stability of the target model instruction on the x-th model. Furthermore, based on the accuracy and stability of the target model instruction on the xth model, the task execution effect of the target model instruction on the xth model can be scored to obtain the score of the target model instruction on the xth model; specifically, the accuracy and stability of the target model instruction on the xth model can be directly used as the score of the target model instruction on the xth model, or the score S of the target model instruction on the xth model can be calculated using the following formula 1.1:
[0157] S=μ-ρ 2 Formula 1.1
[0158] Among them, μ represents the mean accuracy corresponding to the x-th model, and ρ represents the accuracy stability of the target model instruction on the x-th model. It can be seen that the embodiment of the present application can comprehensively consider the stability of the task execution accuracy of the target model instruction on different model versions of the x-th model to determine the score of the target model instruction on the x-th model, so as to avoid the accidental high score caused by the target model instruction just matching a single model version, thereby improving the accuracy of the score of the target model instruction on the x-th model.
[0159] It is understandable that the above is only an exemplary example of a specific implementation method for determining the score of the target model instruction on the xth model based on the accuracy mean, and is not exhaustive. For example, in other embodiments, when the computer device scores the task execution effect of the target model instruction on the xth model based on the accuracy mean and obtains the score of the target model instruction on the xth model, the accuracy mean can be directly used as the score of the target model instruction on the xth model, or the accuracy mean can be linearly changed to obtain the score of the target model instruction on the xth model, or based on the corresponding relationship between the accuracy value and the score, the score corresponding to the accuracy mean value can be used as the score of the target model instruction on the xth model, and so on.
[0160] s32, using the first detection result and the task execution effect score to generate quality information of the target model instruction.
[0161] As can be seen from the above, the first detection result includes at least one of the following values: semantic accuracy, grammatical and pragmatic correctness, and structural complexity. Based on this, the specific implementation method of step s32 can be: obtain the weighting coefficient of each value in the first detection result, and the weighting coefficient of the task execution effect score. Any weighting coefficient mentioned here can be pre-set based on experience or business needs, and there is no limitation on this. Based on the obtained weighting coefficients, each value in the first detection result and the task execution effect score, calculate the quality score of the target model instruction; use the quality score of the target model instruction to construct the quality information of the target model instruction.
[0162] Among them, based on the obtained weighting coefficients, each numerical value in the first detection result and the task execution effect score, the specific implementation method of calculating the quality score of the target model instruction can be: scoring the target model instruction according to each numerical value in the first detection result, and obtaining multiple performance scores of the target model instruction; wherein the multiple performance scores include at least one of the following: the performance score under the semantic accuracy index determined based on the numerical value of semantic accuracy, the performance score under the grammatical pragmatic correctness index determined based on the numerical value of grammatical pragmatic correctness, and the performance score under the structural complexity measurement index determined based on the numerical value of structural complexity. Further, based on the obtained weighting coefficients, the performance score corresponding to each numerical value in the first detection result and the task execution effect score are weighted summed or weighted averaged to obtain the quality score of the target model instruction. Specifically, the weighting coefficients of each numerical value in the first detection result are used to weight the performance points determined based on the corresponding numerical values to obtain multiple weighted performance scores, and the task execution effect scores are weighted using the weighting coefficients of the task execution effect scores to obtain weighted task execution effect scores; the multiple weighted performance scores and the weighted task execution effect scores are summed to obtain a total score, and the total score is used as the quality score of the target model instruction (i.e., the quality score in this case is obtained by weighted summation), or the total score is divided by the sum of the weighting coefficients to obtain the quality score of the target model instruction (i.e., the quality score in this case is obtained by weighted averaging).
[0163] Based on the above, the quality score of the target model instruction obtained by weighted average is used as an example for illustration: Assume that the first detection result includes the following three values: semantic accuracy 0.8, grammatical pragmatic correctness 0.6 and structural complexity 0.4, then the multiple performance scores may include: a performance score of 0.8 determined based on semantic accuracy 0.8 (that is, semantic accuracy is directly used as the performance score), a performance score of 0.6 determined based on grammatical pragmatic correctness (that is, grammatical pragmatic correctness is directly used as the performance score) and a performance score of 0.8 determined based on structural complexity The performance score determined by the degree is 0.6 (that is, the difference between the benchmark value 1 and the structural complexity is taken as the performance score); if the weighting coefficients of the three values in the first detection result are 0.2, 0.3 and 0.4 respectively, and the task execution effect score is 0.5 and its weighting coefficient is 0.5, then the quality score of the target model instruction is: (0.2×0.8+0.3×0.6+0.4×0.6+0.5×0.5) / (0.2+0.3+0.4+0.5)=0.83 / 1.4≈0.59.
[0164] The embodiment of the present application can realize automatic quality detection of model instructions, which can avoid the problem of low efficiency of instruction quality detection caused by manual detection, and can also avoid the situation of misjudgment of instruction quality caused by insufficient or incorrect manual experience, thereby improving the accuracy and efficiency of instruction quality detection. In addition, in the process of automated instruction quality detection, by detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction, the benchmark performance is used to affect the correctness of the media model performing media data processing tasks based on the target model instruction, and calling the media model to perform media data processing tasks on media data samples based on the target model instruction, and detecting the task execution accuracy of the target model instruction on the media model based on the actual task execution results, thereby generating quality information of the target model instruction based on the detection results of the benchmark performance and the detection results of the task execution accuracy, it is possible to realize multi-dimensional quality detection of the target model instruction, thereby further improving the accuracy of instruction quality detection.
[0165] Based on the description of the above method embodiment, the embodiment of the present application proposes an evaluation system for the quality of model instructions of a large-scale language model (hereinafter referred to as a large model). The evaluation system can evaluate the quality of any model instruction from various dimensions of natural language interaction, which can be used to replace the subjective judgment evaluation of the quality of model instructions based on human experience, and improve the accuracy and efficiency of instruction quality evaluation.
[0166] Specifically, the evaluation system proposed in the embodiment of the present application may include the following evaluation indicators:
[0167] 1. Semantic accuracy indicators used to evaluate the quality of model instructions:
[0168] In the evaluation system, the semantic accuracy index is used to evaluate the semantic expression accuracy of model instructions in the specified task context (i.e., semantic accuracy), which may include but is not limited to the following sub-indicators:
[0169] a. Accuracy of information expression / completeness of information elements, which is used to measure whether the model instructions include all the instruction information needed to instruct the large model to complete the specified task, and whether the information elements about the specified task to be conveyed by the model instructions are missing;
[0170] b. Logical correctness / logical consistency, which is used to measure whether the logic of the model instructions is consistent, that is, whether the logic of the model instructions has no conflicts and whether it can clearly instruct the model to complete the corresponding tasks.
[0171] Under the semantic accuracy index, the evaluation system proposes a measurement method based on semantic vector distance to comprehensively judge the semantic accuracy of model instructions (including the above two levels a and b). The specific measurement method may include the following steps:
[0172] Step 1: Prepare a semantic encoder so that the model instruction or task description text can be converted into a feature vector (semantic vector) based on the semantic encoder. That is, after the text is input into the semantic encoder, the corresponding encoded feature vector representation (i.e., semantic vector representation) can be obtained. Figure 4a As shown. A feature vector is a mathematical representation used to convert natural language text into a set of numerical values that can be processed by computers. In NLP, these vectors capture key information about the text, such as word importance, context, grammatical structure, and semantic content. This conversion enables machine learning models to analyze and understand text and perform tasks such as classification, search, and sentiment analysis. Feature vectors can be generated in a variety of ways, including but not limited to bag-of-words models, TF-IDF (term frequency-inverse document frequency) statistics, and more complex word embedding techniques such as Word2Vec or BERT, etc.
[0173] For example, the structure of the semantic encoder mentioned in the embodiment of the present application can be found in Figure 4b As shown, it may include multiple network layers such as self-attention mechanism layer, summing and normalization layer, feedforward network, summing and normalization layer, etc. Among them, the self-attention mechanism layer applies the self-attention mechanism, and the calculation method of the self-attention mechanism is as follows:
[0174]
[0175] Among them, Q represents the query vector, K represents the key vector, and V represents the numerical vector. Specifically, Q can be the input vector representation of the text. For example, if the text is "Please classify the text", then Q is the input vector representation of the text. In the self-attention mechanism, K=Q, V=Q; that is, Q, V and K in the above formula can all be the input vector representation of the text. k is a parameter in the self-attention mechanism.
[0176] Specifically, the working principle of the semantic encoder is as follows: ① The self-attention mechanism layer processes the input vector representation of the text based on the self-attention mechanism, and inputs the output of the self-attention mechanism and the original input vector representation into the first summing and normalizing layer; ② The first summing and normalizing layer adds the output of the self-attention mechanism layer and the original input vector representation to enhance the original information, and performs normalization to obtain the normalized result x1, that is, x1=Norm(Q+Attention(Q, K, V)), where Norm is the normalization function, and the normalized result x1 is Input to the feedforward network; ③ The feedforward network uses its calculation unit (Feed_forward) to further calculate the normalized result x1 to fully integrate the information, and inputs the calculation result Feed_forward(x1) and the normalized result x1 to the second addition and normalization layer; ④ The second addition and normalization layer adds and normalizes the calculation result Feed_forward(x1) of the feedforward network and the normalized result x1 to obtain the normalized result x2, that is, x2=Norm(x1+Feed_forward(x1)). It can be understood that the normalized result x2 obtained by the second addition and normalization layer is the final output of the semantic encoder (that is, the semantic vector).
[0177] Step 2: Collect the task description text of the target task, which contains the elements and task background of the corresponding task. The target task refers to the media data processing task involved in the model instruction i to be evaluated, such as the sentiment classification task of the text mentioned above. In this case, the task description text can be "sentiment classification of a piece of text (positive / negative / neutral)".
[0178] Step 3: Encode the task description text in step 2 through the semantic encoder prepared in step 1 to obtain the semantic vector e.
[0179] Step 4: Encode the model instruction i to be evaluated through the semantic encoder prepared in step 1 to obtain the semantic vector e i .
[0180] Step 5: Calculate the semantic vector e and the semantic vector e iThe semantic distance between them can be calculated as shown in the following formula 2.1-2.2:
[0181] Formula 2.1
[0182] Formula 2.2
[0183] in, is vector multiplication, is the semantic vector e i The length of the vector, is the vector length of the semantic vector e. f1 (model instruction i) is the semantic vector e and the semantic vector e i The semantic distance between them is in the range of [-1, 1]. If the value of f1 (model instruction i) is a negative number, it means that the semantic direction of model instruction i is opposite to the semantic direction of the task description text of the target task, and the closer it is to -1, the more serious the degree of opposition. At this time, there may be problems such as logical inconsistency of model instruction i or serious deviation in information expression; if the value of f1 (model instruction i) is a positive number, it means that the semantic direction of model instruction i is close to the semantic direction of the task description text of the target task, and the closer it is to 1, the closer the semantic accuracy of model instruction i is to the task requirements (no logical contradiction), the clearer the element information is, and the closer it is to the requirements of the target task.
[0184] Taking the model instruction i as the aforementioned example 4 "Please classify the sentiment of this text, including positive, negative and neutral sentiments. Just tell me whether this text is positive" as an example, the semantic distance between the first half of Example 4 "Please classify the sentiment of this text, including positive, negative and neutral sentiments" and the task description text will be close to 1, but the second half "Just tell me whether this text is positive" is completely deviated from the semantic direction of the task description text, resulting in the semantic distance between the model instruction i and the task description text being less than zero. At this time, the semantic distance has a negative polarity and this negative polarity can indicate that the model instruction i is completely unusable. It can be seen that the value of f1 (model instruction i) can reflect the polarity of the model instruction i under the premise of the task background. If the polarity is positive (consistent with the task description text in the semantic direction), the quality of the model instruction i can continue to be evaluated. If the polarity is negative, it can be directly determined that the model instruction i is completely unusable, and the subsequent quality evaluation process will no longer be executed.
[0185] Step 6: Combine the semantic vector e and the semantic vector e i The semantic distance between them is taken as the semantic accuracy of model instruction i.
[0186] 2. Grammatical and pragmatic correctness indicators for evaluating the quality of model instructions:
[0187] In the evaluation system, the grammatical-pragmatic correctness index is used to evaluate the linguistic correctness of the model instructions from the perspectives of grammar and pragmatics. Specifically, it may include but is not limited to the following sub-indicators:
[0188] A. Typographical sub-indicator (Ty), which is used to reflect the typos and rare characters in the model instructions. The value range is [0, 1]. The larger the value, the higher the quality of the model instructions in this sub-indicator dimension, and vice versa.
[0189] B. Grammatical quality (Grammatical) sub-indicator (Gr), which is used to reflect the grammatical rule compliance and comprehensibility of the model instructions. The value range is [0, 1]. The larger the value, the higher the quality of the model instructions in this sub-indicator dimension, and vice versa.
[0190] C. Tense sub-index (Te), which is used to reflect the tense correctness of the model instructions and the clarity of the action instructions. The value range is [0, 1]. The larger the value, the higher the quality of the model instructions in this sub-index dimension, and vice versa.
[0191] D. Cultural Appropriateness sub-indicator (Cu) is used to reflect whether the expression of the model instruction is consistent with the cultural background of the language used to avoid misunderstandings. The value range is [0, 1]. The larger the value, the higher the quality of the model instruction in this sub-indicator dimension, and vice versa.
[0192] Under the grammatical and pragmatic correctness index, the evaluation system proposes a method for scoring four sub-indicators based on the semantic encoder. The principle of this method is: if the semantic vectors encoded by the semantic encoder, such as the semantic vectors of the grammatically and pragmatically correct model instructions and the semantic vectors of the model instructions to be evaluated, have a larger spatial distance difference, it indicates that the model instructions deviate further from the correct instruction intention, and based on this, the model instructions calculated by cosine similarity have a lower score under this indicator dimension. The specific formula design can be shown in the following formulas 2.3-2.6:
[0193] Formula 2.3
[0194] Formula 2.4
[0195] Formula 2.5
[0196] Formula 2.6
[0197] Among them, score2 (model instruction i, sub-indicator j) is the score obtained by model instruction i under the indicator dimension of sub-indicator j, and its value range is [0,1]. The closer the value is to 1, the higher the score of model instruction i under this indicator dimension. f2 (model instruction i) is the final score of model instruction i under the grammatical and pragmatic correctness indicator. is the semantic vector obtained after the semantic encoder encodes the model instruction i, is the vector length of the semantic vector obtained after encoding the model instruction i, is the semantic vector obtained after the semantic encoder encodes the correct model instruction under sub-indicator j, is the vector length of the semantic vector obtained after encoding the correct model instruction under sub-indicator j, min(score2(model instruction i, Ty), score2(model instruction i, Gr), score2(model instruction i, Te), score2(model instruction i, Cu)) means taking the minimum value of the scores under each sub-indicator.
[0198] For example:
[0199] Suppose the model instruction i to be evaluated is "Please print out the documents in this folder", and its corresponding semantic vector (the vector obtained after the semantic encoder encodes the model instruction i) is ;
[0200] Take "print out the documents in this folder" as the correct model instruction under the wrong character sub-indicator (Ty), take "please print out the documents in this folder" as the correct model instruction under the grammatical quality sub-indicator (Gr), take "please print out the documents in this folder" as the correct model instruction under the tense correctness sub-indicator (Te), and take "please print out the documents in this folder" as the correct model instruction under the language and cultural habits sub-indicator (Cu). These correct model instructions indicate the real intention of the model instruction i, and the semantic vectors corresponding to each correct model instruction (the vectors obtained after the semantic encoder encodes the correct model instruction) can be expressed as ;
[0201] Assume that after calculation:
[0202] score2(model instruction i, Ty) = 0.12;
[0203] score2(model instruction i, Gr)=0.81;
[0204] score2(model instruction i,Te)=0.95;
[0205] score2(model instruction i, Cu)=0.88;
[0206] Then the final score of model instruction i under the grammatical and pragmatic correctness index is:
[0207] f2(model instruction i)=min(0.12, 0.81, 0.95, 088)=0.12.
[0208] (III) Structural complexity metrics for evaluating model instruction quality:
[0209] In the evaluation system, this structural complexity measurement index is used to evaluate the structural complexity of the model instruction itself, which may include but is not limited to the following sub-indicators:
[0210] A. Instruction length sub-index (L), whose value is the number of characters in the model instruction.
[0211] B. Concept quantity sub-index (U), whose value is the sum of the number of words used to represent actions and the number of words used to represent objects in the model instructions.
[0212] C. Clause number sub-index (S), whose value is the number of clauses in the model instruction.
[0213] D. The sub-indicator of the number of professional terms (T) is the number of professional terms in the model instructions.
[0214] Under this structural complexity measurement indicator, the evaluation system uses the following formulas 2.7-2.8 to calculate the structural complexity of the model instructions:
[0215] Formula 2.7
[0216] Formula 2.8
[0217] Among them, f3 (model instruction i) is the final score of model instruction i under the structural complexity index, and its value range is [0,1]. The larger the value, the more complex the structure of model instruction i is. Conversely, the smaller the value, the simpler the structure of model instruction i is. g(x) is a normalization function used to normalize x to a value in the interval [0,1]. x= , is a weight coefficient, which determines the contribution of each sub-indicator (factor) to the structural complexity of the model instruction. These weight coefficients can be adjusted according to the specific situation to reflect the relative importance of different sub-indicators. For example, if a model instruction contains a lot of professional terms, the value of T will be very high. If it is considered that it increases the structural complexity of the model instruction, it can be increased by increasing to reflect this.
[0218] (IV) Execution effect indicators used to evaluate the quality of model instructions:
[0219] In the evaluation system, this execution effect indicator is used to evaluate the quality of the task execution effect generated by the model instructions.
[0220] Under this execution effect indicator, the quality evaluation method proposed by the evaluation system can be found in Figure 4c As shown, it is roughly as follows:
[0221] 1) Select X different large models (X is a positive integer), where different large models refer to large models with at least one different parameter scale and model structure. It can be seen that the selected large models 1, 2, ... X are large models with different parameter scales (e.g. 20B and 60B are different model parameter scales, 20B means 20 billion parameters) or different model structures, such as GPT4 of "openAI" / ERNIE4 of "Wenxin" are models with different model structures, while GPT4 and GPT3.5 of "openAI" are models with different parameter amounts. Among them, each of the X large models can have multiple model versions; different model versions of the same model refer to different versions of models obtained by fine-tuning and iterating the model with data updates, with the same parameter scale and model structure. For example, the large model developed by an organization (such as OpenAI) has early versions 20230613, and later versions 20240126 and 20240409. These versions are obtained by fine-tuning the model with new data on the previous version, and the parameter scale (such as the number of parameters) and model structure have not changed. Among them, model fine-tuning is a common strategy in deep learning, usually based on pre-trained models; pre-trained models are trained on large-scale datasets to learn general feature representations, and then fine-tuned on small-scale datasets for specific tasks to adapt to specific tasks; the fine-tuning process usually involves updating the parameters of the last few layers of the model so that the model can better adapt to new tasks.
[0222] 2) Given the data to be processed, the data to be processed is the data that needs to be processed by the large model in actual production by executing tasks. Taking the sentiment analysis task of text as an example, the model instruction i can be "Please analyze the sentiment polarity of the data to be processed. There are three types of sentiment polarity, namely positive / neutral / negative. Please directly give the corresponding polarity"; in this case, the data to be processed can include the following data, for example:
[0223] Data 1: "Today's test results are bad, terrible." Correct answer: "Negative";
[0224] Data m: "The sky is clear and cloudless, and the air is bright and clear." Correct answer: "Positive";
[0225] Data M: "Data Structure is a computer basic course." Correct answer: "Neutral."
[0226] Among them, the parameter M can be set in combination with the large model evaluation computing resources, that is, each model version evaluates M data. For example, M=5, that is, each model version evaluates the same 5 data to calculate the task effect index of model instruction i on the model version. The evaluation adopts two-pole scoring, that is, 0 or 1; that is, if a certain model version predicts data m (1≤m≤M) correctly (that is, the output answer (actual task execution result) is the same as the preset correct answer (preset task execution result)), then the score of data k on the model version can be recorded as 1, otherwise the score of data k on the model version is recorded as 0. For example, for data 1, if the prediction result of a certain model version on data 1 is "negative" (the correct answer is "neutral"), the score of data 1 on the model version can be recorded as 0.
[0227] 3) For any large model x (1≤x≤X) among the selected X large models, execute the evaluation method of stage one to obtain the score of model instruction i on large model x.
[0228] Among them, the first stage is to verify the model instruction i on different model versions of the large model with the same parameter scale and model structure, aiming to detect the stability of the task execution effect generated by the model instruction i on different model versions.
[0229] See also Figure 4d As shown, the following are the evaluation steps for implementing the score of model instruction i on large model x in stage one:
[0230] Step 1: Take out M data from the data to be processed (corresponding to the media data samples mentioned above). Use these M data to evaluate the model instruction i.
[0231] Step 2: The execution cycle flow is as follows:
[0232] For j in range(n): # Take each model version of the n model versions of the large model x
[0233] For m in range(M): #Take each of the M data
[0234] For model version j (1≤j≤n), call model version j of large model x to execute the corresponding task on the retrieved data m (1≤m≤M) according to model instruction i, and obtain the actual task execution result of data k on model version j;
[0235] ① Calculate the score of data k on model version j based on the following formula 3.1:
[0236] Formula 3.1
[0237] Among them, r(data m, model version j, model instruction i) represents the score of data m on model version j; if the result is correct, it means that the actual task execution result of data m on model version j is the same as the preset task execution result of data m; if the result is wrong, it means that the actual task execution result of data m on model version j is different from the preset task execution result of data m.
[0238] ② Calculate the score j of model instruction i on model version j based on the following formula 3.2:
[0239] Formula 3.2
[0240] Phrase1 (model instruction i, model version j) represents the score j of model instruction i on model version j (corresponding to the task execution accuracy mentioned above).
[0241] ③ Calculate the score of model instruction i in stage 1 on the large model x based on the following formula 3.3;
[0242] Formula 3.3
[0243] Among them, f4 (model instruction i, large model x) represents the score of model instruction i on large model x calculated in stage 1, which reflects the comprehensive task execution effect of model instruction i on different model versions of the same large model x. The better the average performance and the more stable the effect, the higher the score; (model instruction i, large model x) represents the mean score of model instruction i on n model versions (corresponding to the accuracy mean mentioned above), which reflects the average performance of model instruction i on different model versions of the same large model x. The larger the value, the better the average performance. Its value range is [0,1]; (model instruction i, large model x) represents the score stability of model instruction i on n model versions (corresponding to the accuracy stability mentioned above), which reflects the stability / robustness of the task execution effect of model instruction i on different model versions of the same large model x. The larger the value, the more unstable it is, and its value range is in the interval [0,1]. Specifically:
[0244]
[0245] 4) After obtaining the score of model instruction i on each large model, execute the evaluation method of stage 2 to obtain the task execution effect score of model instruction i.
[0246] Among them, stage two is to evaluate the task execution effect of model instruction i on all large models on the basis of stage one, so as to obtain the task execution effect score of model instruction i.
[0247] Specifically, the evaluation method for implementing the task execution effect score of model instruction i in stage 2 can be: perform an average operation on the scores of model instruction i on each large model to obtain the task execution effect score of model instruction i, as shown in the following formula 3.4:
[0248] Formula 3.4
[0249] Among them, f5 (model instruction i) represents the task execution effect score of model instruction i (that is, the final score of the execution effect of model instruction i). It is calculated by statistically averaging the scores (that is, execution effects) of model instruction i on different large models based on the evaluation method of stage one. Its value is in the range of [0, 1], and the larger the value, the better the task execution effect of model instruction i.
[0250] Based on the relevant description of each evaluation index in the above evaluation system, it should be noted that: the above-mentioned semantic accuracy index, grammatical pragmatic correctness index and structural complexity measurement index used to evaluate model instructions can be used in the stage before model instruction i is put into production, and the execution effect index used to evaluate model instructions can be used in the stage after model instruction i is put into production. Model instruction i put into production means that model instruction i is applied to the large model to execute the corresponding task of the large model. It can be seen that the evaluation system proposed in the embodiment of the present application includes evaluation indicators for two stages (the stage before the instruction is put into production and the stage after the instruction is put into production).
[0251] Furthermore, by integrating the evaluation indicators of the two stages included in the evaluation system proposed in the embodiment of the present application, the following can be established: Figure 4e The overall evaluation framework of the evaluation system for the quality of model instructions of large models is shown in the figure. The architecture of the framework is a four-dimensional architecture, as shown below:
[0252] [f1(model instruction i), f2(model instruction i), f3(model instruction i), f5(model instruction i)]
[0253] in:
[0254] If f1(model instruction i)≤0, it indicates that the model instruction i is unavailable, so it can be determined that the model instruction i needs to be discarded before the instruction is produced; based on this, in this case, in order to save processing resources, no subsequent evaluation can be performed;
[0255] If f1(model instruction i)>0, the quality of model instruction i can be comprehensively measured by combining the evaluation results under the four evaluation indicators to obtain the quality score f of model instruction i. all (Model instruction i); For example, the comprehensive measurement formula can be shown in the following formula 3.5:
[0256] Formula 3.5
[0257] Among them, mean() is the weighted calculation formula:
[0258]
[0259] It should be noted that: F1(i) is the performance score obtained by scoring model instruction i based on f1(model instruction i), and F1(i) can be equal to f1(model instruction i); F2(i) is the performance score obtained by scoring model instruction i based on f2(model instruction i), and F2(i) can be equal to f2(model instruction i); F3(i) is the performance score obtained by scoring model instruction i based on f1(model instruction i), and F3(i) can be equal to 1-f3(model instruction i); F4(i) is the task execution effect score f5(model instruction i) of model instruction i.
[0260] In addition, f all (Model instruction i) ∈ [0,1], that is, the closer to 1, the better the quality of model instruction i under the evaluation system, and vice versa. , that is, treat these evaluation indicators equally, so that these evaluation indicators are placed at the same level of importance; of course, multi-dimensional evaluation can also be performed according to specific application requirements. For example, if more attention is paid to the quality of model instructions after they are put into production, the corresponding weights can be Set larger, such as setting , so that the final mass fraction f all The value of (model instruction i) pays more attention to the task execution effect under this dimension.
[0261] Based on the above description, it can be seen that the evaluation system proposed in the embodiment of the present application may include but is not limited to the following technical key points:
[0262] 1) Evaluation indicators: Multiple evaluation indicators and at least one sub-indicator under an evaluation indicator are proposed to evaluate the quality of model instructions on specific evaluation indicators or sub-indicators respectively.
[0263] 2) Evaluation algorithm: the calculation method of each evaluation indicator (i.e., evaluation method). The calculation method of each evaluation indicator can reflect the quality of the model instruction under the corresponding evaluation indicator in the large model task.
[0264] 3) From the stage before production to the stage after production, build an evaluation system to jointly evaluate the quality of model instructions, so as to improve the accuracy of quality evaluation of model instructions.
[0265] 4) This evaluation system has compatibility, scalability and modular design. By setting multiple sub-indicators under at least one evaluation indicator, it can support the expansion or reduction of evaluation indicators or sub-indicators, as well as the expansion or reduction of sub-indicators, and support the expansion of sub-indicators for the dimensions of concern.
[0266] It can be seen that the evaluation system proposed in the embodiment of the present application can use multiple evaluation indicators to jointly evaluate the quality of model instructions from two perspectives: before the model instructions are put into production (i.e., before they are applied to the model) and after the model instructions are put into production (after they are applied to the model). This evaluation system can bring many application values, including but not limited to the following points:
[0267] 1. Improve model performance: The evaluation system can optimize the model instruction design by accurately evaluating the effects of different model instructions, thereby improving the response quality and accuracy of large models.
[0268] 2. User experience optimization: The evaluation system can help developers understand which types of model instructions are easier to be understood by large models, so as to design more intuitive interaction methods and improve user experience.
[0269] 3. Automated instruction generation: The evaluation system can serve as a feedback mechanism for the automated instruction generation tool, helping to generate more effective model instructions and reducing the workload of manual writing and testing instructions.
[0270] 4. Education and Training: The evaluation system can be used for education and training. By outputting the score of model instructions under at least one evaluation dimension, it can help learners understand how to interact with large models more effectively and improve their ability to use these tools.
[0271] 5 Research and Development: The evaluation system can provide researchers with a standardized tool for measuring and comparing the effectiveness of different large models and instruction generation strategies.
[0272] 6. Quality Assurance: In commercial applications, the evaluation system can ensure that large models continue to provide high-quality outputs before and after going online, which helps maintain brand image and customer satisfaction.
[0273] 7. Personalized services: The evaluation system can help identify the different responses of different user groups to model instructions, thereby providing more personalized services.
[0274] 8 Resource optimization: By identifying model instructions with poor performance, we can avoid wasting computing resources on these model instructions, thereby optimizing operating costs.
[0275] 9. Safety and compliance: The evaluation system can help ensure that model instructions do not trigger inappropriate or harmful content and comply with laws, regulations and ethical standards.
[0276] 10 Cross-domain applications: The principles and methods of the evaluation system can be applied to various types of large models and application scenarios, including but not limited to chatbots, automatic writing, information retrieval, etc.
[0277] It should be noted that the application scenarios of the evaluation system proposed in the present application embodiment are not limited. For example, the application scenarios of the evaluation system may include but are not limited to the following:
[0278] (1) Evaluation, screening and classification of instruction sets for any business type in any business field in any modality such as text and images. Business fields may include but are not limited to: health / finance / scientific research / law / education, etc.; task types may include but are not limited to: sentiment classification / professional examinations / programming languages / software development and problem finding / mathematical and scientific problem solving / data comprehensive analysis / fact checking / games and entertainment, etc.
[0279] (2) It is widely used in the actual production of prompt engineering of large models. The so-called prompt engineering is a strategic task in large models, which mainly refers to how to design and optimize model instructions to guide the large model to generate the expected output; this strategy can include selecting specific vocabulary, grammatical structure, or providing some contextual information to help the large model better understand the task requirements and generate more accurate answers.
[0280] For example, see Figure 5 As shown: after obtaining at least one candidate model instruction through model instruction mining in a specified task context, the evaluation system can score and evaluate the quality of each candidate model instruction through an automated process, thereby screening out candidate model instructions with scores greater than a threshold, and storing the screened candidate model instructions in a large model instruction set, so that these candidate model instructions can be subsequently put into production applications for task execution of large models to obtain high-quality model instructions, and then use high-quality model instructions to execute tasks under any task type, so that the execution effect of the task can be improved by selecting and optimizing the quality of model instructions.
[0281] Taking the sentiment classification task of text as an example, suppose there are 3 candidate model instructions:
[0282] Model instruction 1: "Please perform sentiment analysis";
[0283] Model instruction 2: "Classify the sentiment of this text";
[0284] Model instruction 3: "Is the sentiment of this text positive, negative, or neutral?"
[0285] If it is necessary to select one candidate model instruction for production, the evaluation system proposed in the embodiment of the present application can be used to evaluate and score the quality of each of the above-mentioned candidate model instructions in the context of the text sentiment classification task, so as to obtain a quality ranking. For example, model instruction 3>model instruction 2>model instruction 1, then it can be determined that model instruction 3 will be selected for production, so that model instruction 3 can be used to perform the text sentiment classification task in the future, thereby improving the task execution effect.
[0286] It can be seen that the evaluation system proposed in the embodiment of the present application has the characteristics of a high degree of automation and less manual intervention in practical applications, and is suitable for large-scale production applications; it can improve the effect of automated evaluation of the quality of massive model instructions through an automated assembly line, and accurately quantify the quality of model instructions. By quantifying the quality of model instructions and then grading them, it replaces the inefficient and unstable method of manual debugging and manual evaluation to select high-quality model instructions.
[0287] Based on the description of the above-mentioned various method embodiments, the present application also discloses a model instruction quality detection device; the model instruction quality detection device may be a computer program (including one or more instructions) running in a computer device, and the model instruction quality detection device may execute each step in the above-mentioned method flow. Figure 6 , the quality detection device of the model instruction can run the following units:
[0288] An acquisition unit 601 is used to acquire attribute information of a target model instruction to be detected, where the target model instruction is generated based on a media data processing task;
[0289] A detection unit 602 is used to detect the benchmark performance of the target model instruction according to the attribute information of the target model instruction, and obtain a first detection result; wherein the benchmark performance is used to affect the correctness of the media model performing the media data processing task based on the target model instruction;
[0290] The detection unit 602 is further configured to call the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detect the task execution accuracy of the target model instruction on the media model to obtain a second detection result;
[0291] The detection unit 602 is further configured to generate quality information of the target model instruction based on the first detection result and the second detection result.
[0292] In one embodiment, the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: the semantic accuracy of the target model instruction;
[0293] Accordingly, when the detection unit 602 is used to detect the benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain the first detection result, it can be specifically used to:
[0294] Obtaining a task description text of the media data processing task, and encoding the task description text to obtain a second semantic vector;
[0295] Calculating a semantic distance between the target model instruction and the task description text based on the first semantic vector and the second semantic vector;
[0296] The semantic accuracy of the target model instruction is detected according to the calculated semantic distance, and the detected semantic accuracy is added to the first detection result.
[0297] In another embodiment, the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: grammatical and pragmatic correctness of the target model instruction;
[0298] Accordingly, when the detection unit 602 is used to detect the benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain the first detection result, it can be specifically used to:
[0299] Acquire a correct model instruction under a grammatical and pragmatic correctness index, wherein the correct model instruction refers to a model instruction generated based on the media data processing task and meeting the requirements of the corresponding index;
[0300] Encoding the correct model instruction to obtain a third semantic vector;
[0301] Calculating the instruction similarity between the target model instruction and the correct model instruction based on the first semantic vector and the third semantic vector;
[0302] The grammatical and pragmatic correctness of the target model instruction is detected according to the calculated instruction similarity, and the detected grammatical and pragmatic correctness is added to the first detection result.
[0303] In another embodiment, the grammatical and pragmatic correctness index includes at least one of the following sub-indicators: a spelling error sub-indicator, a grammatical quality sub-indicator, a tense correctness sub-indicator, and a language and cultural habit sub-indicator;
[0304] Among them, the indicator requirements of the typo sub-indicator include: there are no typos in the model instructions; the indicator requirements of the grammatical quality sub-indicator include: the model instructions have no grammatical errors; the indicator requirements of the tense correctness sub-indicator include: the model instructions have no tense errors; the indicator requirements of the language and cultural habits sub-indicator include: the expression of the model instructions conforms to the expression habits of the language used by the corresponding model instructions.
[0305] In another embodiment, there is a correct model instruction under each sub-indicator in the grammatical pragmatic correctness indicator;
[0306] The correct model instructions under each sub-indicator are encoded respectively to obtain the third semantic vector corresponding to each sub-indicator; and the third semantic vector corresponding to each sub-indicator is used to calculate the instruction similarity between the target model instruction and the correct model instruction under the corresponding sub-indicator.
[0307] In another implementation, when the detection unit 602 is used to detect the grammatical and pragmatic correctness of the target model instruction according to the calculated instruction similarity, it can be specifically used to:
[0308] Traversing each sub-indicator in the grammatical pragmatic correctness index, determining the kth sub-indicator currently traversed, where k is a positive integer and is not greater than the number of sub-indicators in the grammatical pragmatic correctness index;
[0309] According to the instruction similarity between the target model instruction and the correct model instruction under the k-th sub-indicator, the target model instruction is scored under the k-th sub-indicator to obtain the score of the target model instruction under the k-th sub-indicator;
[0310] After all sub-indicators in the grammatical-pragmatic correctness indicator are traversed, the grammatical-pragmatic correctness of the target model instruction is determined based on the scores of the target model instruction under the sub-indicators.
[0311] In another implementation manner, when the detection unit 602 is used to determine the grammatical and pragmatic correctness of the target model instruction based on the scores of the target model instruction under the various sub-indicators, it can be specifically used to:
[0312] From the scores of the target model instruction under the various sub-indicators, the smallest score is selected as the grammatical and pragmatic correctness of the target model instruction.
[0313] In another embodiment, the attribute information of the target model instruction includes: a structural parameter value of the target model instruction in at least one structural dimension; the benchmark performance of the target model instruction includes: a structural complexity of the target model instruction;
[0314] Accordingly, when the detection unit 602 is used to detect the benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain the first detection result, it can be specifically used to:
[0315] Obtaining a weight coefficient of each structural dimension in the at least one structural dimension;
[0316] Using the weight coefficient of each structural dimension, weighted summing is performed on the structural parameter values of the target model instruction under the at least one structural dimension to obtain a parameter value summing result;
[0317] The structural complexity of the target model instruction is detected based on the parameter value summation result, and the detected structural complexity is added to the first detection result.
[0318] In another embodiment, the at least one structural dimension includes at least one of the following: a length dimension, a concept quantity dimension, a clause quantity dimension, and a term quantity dimension; wherein:
[0319] The structural parameter value of the target model instruction in the length dimension is: the instruction length of the target model instruction, and the instruction length refers to the number of characters in the target model instruction;
[0320] The structural parameter value of the target model instruction under the concept quantity dimension is: the concept quantity in the target model instruction, where a concept refers to a word used to distinguish different actions and different objects;
[0321] The structural parameter value of the target model instruction in the dimension of the number of clauses is: the number of clauses in the target model instruction, where a clause refers to a sentence obtained by splitting the target model instruction;
[0322] The structural parameter value of the target model instruction under the dimension of the number of terms is: the number of professional terms in the target model instruction;
[0323] In another implementation manner, when the detection unit 602 is used to detect the structural complexity of the target model instruction based on the parameter value summation result, it can be specifically used to:
[0324] Using a normalization function, normalizing the sum of the parameter values to obtain a normalized parameter value;
[0325] The normalized parameter value is used as the structural complexity of the target model instruction.
[0326] In another implementation manner, the number of the media data samples is M, where M is a positive integer, and the media model executes the media data processing task on each media data sample based on the target model instruction to obtain an actual task execution result corresponding to each media data sample;
[0327] Accordingly, when the detection unit 602 is used to detect the task execution accuracy of the target model instruction on the media model based on the actual task execution result and obtain the second detection result, it can be specifically used to:
[0328] Obtaining a preset task execution result corresponding to each media data sample;
[0329] Evaluate the score of each media data sample on the media model according to the preset task execution result corresponding to each media data sample and the corresponding actual task result;
[0330] Integrating the scores of the M media data samples on the media model to obtain the score of the target model instruction on the media model;
[0331] Based on the score of the target model instruction on the media model, the task execution accuracy of the target model instruction on the media model is detected to obtain a second detection result.
[0332] In another implementation manner, the number of the media models is multiple, and one media model corresponds to one second detection result;
[0333] Accordingly, when the detection unit 602 is used to generate the quality information of the target model instruction based on the first detection result and the second detection result, it can be specifically used to:
[0334] Scoring the task execution effect of the target model instruction based on the task execution accuracy in the second detection results corresponding to the multiple media models to obtain a task execution effect score;
[0335] The first detection result and the task execution effect score are used to generate quality information of the target model instruction.
[0336] In another implementation manner, the multiple media models include multiple model versions of X models, one model version is one media model, and X is a positive integer;
[0337] Accordingly, when the detection unit 602 is used to score the task execution effect of the target model instruction based on the task execution accuracy in the second detection results corresponding to the multiple media models, and obtain the task execution effect score, it can be specifically used to:
[0338] Traverse each model in the X models to determine the xth model currently traversed, x∈[1,X];
[0339] Performing a mean operation on the task execution accuracy in the second detection results corresponding to each model version of the x-th model to obtain an accuracy mean;
[0340] Based on the accuracy mean, scoring the task execution effect of the target model instruction on the x-th model to obtain the score of the target model instruction on the x-th model;
[0341] After each model in the X models is traversed, the scores of the target model instructions on the various models are integrated to obtain the task execution effect score.
[0342] In another implementation manner, when the detection unit 602 is used to score the task execution effect of the target model instruction on the x-th model based on the accuracy mean and obtain the score of the target model instruction on the x-th model, it can be specifically used to:
[0343] respectively calculating the difference between the task execution accuracy in the second detection result corresponding to each model version of the x-th model and the accuracy mean, to obtain a plurality of difference values;
[0344] Based on the multiple differences, calculating the accuracy stability of the target model instruction on the x-th model; wherein the accuracy stability is used to indicate: the stability between the task execution accuracy of the target model instruction on each model version of the corresponding model;
[0345] Based on the accuracy stability of the target model instruction on the x-th model, the task execution effect of the target model instruction on the x-th model is scored to obtain the score of the target model instruction on the x-th model.
[0346] In another embodiment, the first detection result includes at least one of the following values: semantic accuracy, grammatical and pragmatic correctness, and structural complexity;
[0347] Accordingly, when the detection unit 602 is used to generate the quality information of the target model instruction by using the first detection result and the task execution effect score, it can be specifically used to:
[0348] Obtaining a weighting coefficient of each value in the first detection result and a weighting coefficient of the task execution effect score;
[0349] Calculate the quality score of the target model instruction based on the obtained weighting coefficients, each value in the first detection result and the task execution effect score;
[0350] The quality score of the target model instruction is used to construct quality information of the target model instruction.
[0351] In another embodiment, the process of detecting the benchmark performance of the target model instruction includes: calculating the semantic distance between the target model instruction and the task description text of the media data processing task;
[0352] Accordingly, the detection unit 602 may also be used for:
[0353] Based on the positive or negative value of the semantic distance, detecting the directional consistency between the semantic direction of the target model instruction and the semantic direction of the task description text;
[0354] If the directional consistency is detected, then continue to execute the quality detection process of the target model instruction;
[0355] If the directional consistency is not detected, the target model instruction is determined to be an unusable model instruction, and the quality detection process of the target model instruction is terminated.
[0356] According to another embodiment of the present application, Figure 6 The various units in the quality detection device of the model instruction shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the quality detection device based on model instructions can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0357] According to another embodiment of the present application, a computer program (including one or more instructions) capable of executing each step involved in any of the above methods can be constructed by running the computer program (including one or more instructions) on a general computing device such as a computer including a central processing unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM) and other processing elements and storage elements. Figure 6 The quality detection device of the model instruction shown in the embodiment of the present application is used to implement the quality detection method of the model instruction. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.
[0358] It is worth noting that in the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can contain a part of the overall module or unit of the module or unit function.
[0359] The embodiment of the present application can realize automatic quality detection of model instructions, which can avoid the problem of low efficiency of instruction quality detection caused by manual detection, and can also avoid the situation of misjudgment of instruction quality caused by insufficient or incorrect manual experience, thereby improving the accuracy and efficiency of instruction quality detection. In addition, in the process of automated instruction quality detection, by detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction, the benchmark performance is used to affect the correctness of the media model performing media data processing tasks based on the target model instruction, and calling the media model to perform media data processing tasks on media data samples based on the target model instruction, and detecting the task execution accuracy of the target model instruction on the media model based on the actual task execution results, thereby generating quality information of the target model instruction based on the detection results of the benchmark performance and the detection results of the task execution accuracy, it is possible to realize multi-dimensional quality detection of the target model instruction, thereby further improving the accuracy of instruction quality detection.
[0360] Based on the description of the above method embodiment and device embodiment, the present application embodiment also provides a computer device. Figure 7 , the computer device at least includes a processor 701, an input interface 702, an output interface 703 and a computer storage medium 704. The processor 701, the input interface 702, the output interface 703 and the computer storage medium 704 in the computer device can be connected via a bus or other means. The computer storage medium 704 can be stored in the memory of the computer device, the computer storage medium 704 is used to store a computer program, the computer program includes one or more instructions, and the processor 701 is used to execute one or more instructions in the computer program stored in the computer storage medium 704. The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function.
[0361] In one embodiment, the processor 701 described in the embodiment of the present application can be used to perform a series of quality tests on model instructions, specifically including: obtaining attribute information of a target model instruction to be tested, wherein the target model instruction is generated based on a media data processing task; detecting a benchmark performance of the target model instruction based on the attribute information of the target model instruction to obtain a first test result; wherein the benchmark performance is used to affect the correctness of the media model in executing the media data processing task based on the target model instruction; calling the media model to execute the media data processing task on a media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detecting the task execution accuracy of the target model instruction on the media model to obtain a second test result; generating quality information of the target model instruction based on the first test result and the second test result, and so on.
[0362] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a computer device for storing computer programs and data. It is understandable that the computer storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer storage medium provides a storage space, which stores the operating system of the computer device. In addition, a computer program is also stored in the storage space, and the computer program includes one or more instructions suitable for being loaded and executed by the processor 701, and these instructions can be one or more program codes. It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0363] In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by a processor to implement the corresponding steps in any of the above method embodiments; in a specific implementation, one or more instructions in a computer storage medium may be loaded and executed by a processor as follows:
[0364] Acquire attribute information of a target model instruction to be detected, where the target model instruction is generated based on a media data processing task;
[0365] According to the attribute information of the target model instruction, the benchmark performance of the target model instruction is detected to obtain a first detection result; wherein the benchmark performance is used to influence the correctness of the media model performing the media data processing task based on the target model instruction;
[0366] Calling the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detecting the task execution accuracy of the target model instruction on the media model to obtain a second detection result;
[0367] Based on the first detection result and the second detection result, quality information of the target model instruction is generated.
[0368] In one embodiment, the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: the semantic accuracy of the target model instruction;
[0369] Accordingly, when the benchmark performance of the target model instruction is detected according to the attribute information of the target model instruction to obtain a first detection result, the one or more instructions may be loaded and specifically executed by the processor:
[0370] Obtaining a task description text of the media data processing task, and encoding the task description text to obtain a second semantic vector;
[0371] Calculating a semantic distance between the target model instruction and the task description text based on the first semantic vector and the second semantic vector;
[0372] The semantic accuracy of the target model instruction is detected according to the calculated semantic distance, and the detected semantic accuracy is added to the first detection result.
[0373] In another embodiment, the attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: grammatical and pragmatic correctness of the target model instruction;
[0374] Accordingly, when the benchmark performance of the target model instruction is detected according to the attribute information of the target model instruction to obtain a first detection result, the one or more instructions may be loaded and specifically executed by the processor:
[0375] Acquire a correct model instruction under a grammatical and pragmatic correctness index, wherein the correct model instruction refers to a model instruction generated based on the media data processing task and meeting the requirements of the corresponding index;
[0376] Encoding the correct model instruction to obtain a third semantic vector;
[0377] Calculating the instruction similarity between the target model instruction and the correct model instruction based on the first semantic vector and the third semantic vector;
[0378] The grammatical and pragmatic correctness of the target model instruction is detected according to the calculated instruction similarity, and the detected grammatical and pragmatic correctness is added to the first detection result.
[0379] In another embodiment, when detecting the grammatical and pragmatic correctness of the target model instruction according to the calculated instruction similarity, the one or more instructions may be loaded and specifically executed by the processor:
[0380] Traversing each sub-indicator in the grammatical pragmatic correctness index, determining the kth sub-indicator currently traversed, where k is a positive integer and is not greater than the number of sub-indicators in the grammatical pragmatic correctness index;
[0381] According to the instruction similarity between the target model instruction and the correct model instruction under the k-th sub-indicator, the target model instruction is scored under the k-th sub-indicator to obtain the score of the target model instruction under the k-th sub-indicator;
[0382] After all sub-indicators in the grammatical-pragmatic correctness indicator are traversed, the grammatical-pragmatic correctness of the target model instruction is determined based on the scores of the target model instruction under the sub-indicators.
[0383] In another implementation, when determining the grammatical and pragmatic correctness of the target model instruction based on the scores of the target model instruction under the sub-indicators, the one or more instructions may be loaded and specifically executed by the processor:
[0384] From the scores of the target model instruction under the various sub-indicators, the smallest score is selected as the grammatical and pragmatic correctness of the target model instruction.
[0385] In another embodiment, the attribute information of the target model instruction includes: a structural parameter value of the target model instruction in at least one structural dimension; the benchmark performance of the target model instruction includes: a structural complexity of the target model instruction;
[0386] Accordingly, when the benchmark performance of the target model instruction is detected according to the attribute information of the target model instruction to obtain a first detection result, the one or more instructions may be loaded and specifically executed by the processor:
[0387] Obtaining a weight coefficient of each structural dimension in the at least one structural dimension;
[0388] Using the weight coefficient of each structural dimension, weighted summing is performed on the structural parameter values of the target model instruction under the at least one structural dimension to obtain a parameter value summing result;
[0389] The structural complexity of the target model instruction is detected based on the parameter value summation result, and the detected structural complexity is added to the first detection result.
[0390] In another implementation, when the structural complexity of the target model instruction is detected based on the parameter value summation result, the one or more instructions may be loaded and specifically executed by the processor:
[0391] Using a normalization function, normalizing the sum of the parameter values to obtain a normalized parameter value;
[0392] The normalized parameter value is used as the structural complexity of the target model instruction.
[0393] In another implementation manner, the number of the media data samples is M, where M is a positive integer, and the media model executes the media data processing task on each media data sample based on the target model instruction to obtain an actual task execution result corresponding to each media data sample;
[0394] Correspondingly, when the task execution accuracy of the target model instruction on the media model is detected based on the actual task execution result and a second detection result is obtained, the one or more instructions may be loaded and specifically executed by the processor:
[0395] Obtaining a preset task execution result corresponding to each media data sample;
[0396] Evaluate the score of each media data sample on the media model according to the preset task execution result corresponding to each media data sample and the corresponding actual task result;
[0397] Integrating the scores of the M media data samples on the media model to obtain the score of the target model instruction on the media model;
[0398] Based on the score of the target model instruction on the media model, the task execution accuracy of the target model instruction on the media model is detected to obtain a second detection result.
[0399] In another implementation manner, the number of the media models is multiple, and one media model corresponds to one second detection result;
[0400] Accordingly, when the quality information of the target model instruction is generated based on the first detection result and the second detection result, the one or more instructions may be loaded and specifically executed by the processor:
[0401] Scoring the task execution effect of the target model instruction based on the task execution accuracy in the second detection results corresponding to the multiple media models to obtain a task execution effect score;
[0402] The first detection result and the task execution effect score are used to generate quality information of the target model instruction.
[0403] In another implementation manner, the multiple media models include multiple model versions of X models, one model version is one media model, and X is a positive integer;
[0404] Correspondingly, when the task execution accuracy in the second detection results corresponding to the multiple media models is used to score the task execution effect of the target model instruction and obtain the task execution effect score, the one or more instructions can be loaded and specifically executed by the processor:
[0405] Traverse each model in the X models to determine the xth model currently traversed, x∈[1,X];
[0406] Performing a mean operation on the task execution accuracy in the second detection results corresponding to each model version of the x-th model to obtain an accuracy mean;
[0407] Based on the accuracy mean, scoring the task execution effect of the target model instruction on the x-th model to obtain the score of the target model instruction on the x-th model;
[0408] After each model in the X models is traversed, the scores of the target model instructions on the various models are integrated to obtain the task execution effect score.
[0409] In another implementation, when the task execution effect of the target model instruction on the x-th model is scored based on the accuracy mean to obtain the score of the target model instruction on the x-th model, the one or more instructions may be loaded and specifically executed by the processor:
[0410] respectively calculating the difference between the task execution accuracy in the second detection result corresponding to each model version of the x-th model and the accuracy mean, to obtain a plurality of difference values;
[0411] Based on the multiple differences, calculating the accuracy stability of the target model instruction on the x-th model; wherein the accuracy stability is used to indicate: the stability between the task execution accuracy of the target model instruction on each model version of the corresponding model;
[0412] Based on the accuracy stability of the target model instruction on the x-th model, the task execution effect of the target model instruction on the x-th model is scored to obtain the score of the target model instruction on the x-th model.
[0413] In another embodiment, the first detection result includes at least one of the following values: semantic accuracy, grammatical and pragmatic correctness, and structural complexity;
[0414] Accordingly, when the first detection result and the task execution effect score are used to generate the quality information of the target model instruction, the one or more instructions may be loaded and specifically executed by the processor:
[0415] Obtaining a weighting coefficient of each value in the first detection result and a weighting coefficient of the task execution effect score;
[0416] Calculate the quality score of the target model instruction based on the obtained weighting coefficients, each value in the first detection result and the task execution effect score;
[0417] The quality score of the target model instruction is used to construct quality information of the target model instruction.
[0418] In another embodiment, the process of detecting the benchmark performance of the target model instruction includes: calculating the semantic distance between the target model instruction and the task description text of the media data processing task;
[0419] Accordingly, the one or more instructions may be loaded and specifically executed by the processor:
[0420] Based on the positive or negative value of the semantic distance, detecting the directional consistency between the semantic direction of the target model instruction and the semantic direction of the task description text;
[0421] If the directional consistency is detected, then continue to execute the quality detection process of the target model instruction;
[0422] If the directional consistency is not detected, the target model instruction is determined to be an unusable model instruction, and the quality detection process of the target model instruction is terminated.
[0423] The embodiment of the present application can realize automatic quality detection of model instructions, which can avoid the problem of low efficiency of instruction quality detection caused by manual detection, and can also avoid the situation of misjudgment of instruction quality caused by insufficient or incorrect manual experience, thereby improving the accuracy and efficiency of instruction quality detection. In addition, in the process of automated instruction quality detection, by detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction, the benchmark performance is used to affect the correctness of the media model performing media data processing tasks based on the target model instruction, and calling the media model to perform media data processing tasks on media data samples based on the target model instruction, and detecting the task execution accuracy of the target model instruction on the media model based on the actual task execution results, thereby generating quality information of the target model instruction based on the detection results of the benchmark performance and the detection results of the task execution accuracy, it is possible to realize multi-dimensional quality detection of the target model instruction, thereby further improving the accuracy of instruction quality detection.
[0424] It should be noted that, according to one aspect of the present application, a computer program product or computer program is also provided, and the computer program product or computer program includes one or more instructions, and the one or more instructions are stored in a computer storage medium. The processor of the computer device reads one or more instructions from the computer storage medium, and the processor executes the one or more instructions, so that the computer device executes the method provided in various optional ways in any of the above-mentioned method embodiments. It should be understood that what is disclosed above is only a preferred embodiment of the present application, and of course it cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A quality detection method for model instructions, It is characterized in that include: Acquire attribute information of a target model instruction to be detected, where the target model instruction is generated based on a media data processing task; According to the attribute information of the target model instruction, the benchmark performance of the target model instruction is detected to obtain a first detection result; wherein the attribute information refers to: information used to detect the benchmark performance of the target model instruction, and the benchmark performance is used to affect the correctness of the media model in executing the media data processing task based on the target model instruction; when the attribute information includes: the structural parameter value of the target model instruction in at least one structural dimension, the benchmark performance includes: the structural complexity of the target model instruction, and the weight coefficient of each structural dimension in the at least one structural dimension is obtained; the weight coefficient of each structural dimension is used to perform weighted summation on the structural parameter values of the target model instruction in the at least one structural dimension to obtain a parameter value summation result; based on the parameter value summation result, the structural complexity of the target model instruction is detected, and the detected structural complexity is added to the first detection result; Calling the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detecting the task execution accuracy of the target model instruction on the media model to obtain a second detection result; Based on the first detection result and the second detection result, quality information of the target model instruction is generated.
2. The method according to claim 1, It is characterized in that The attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: the semantic accuracy of the target model instruction; The step of detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain a first detection result includes: Obtaining a task description text of the media data processing task, and encoding the task description text to obtain a second semantic vector; Calculating a semantic distance between the target model instruction and the task description text based on the first semantic vector and the second semantic vector; The semantic accuracy of the target model instruction is detected according to the calculated semantic distance, and the detected semantic accuracy is added to the first detection result.
3. The method according to claim 1, It is characterized in that The attribute information of the target model instruction includes: a first semantic vector obtained by encoding the target model instruction; the benchmark performance of the target model instruction includes: grammatical and pragmatic correctness of the target model instruction; The step of detecting the benchmark performance of the target model instruction according to the attribute information of the target model instruction to obtain a first detection result includes: Acquire a correct model instruction under a grammatical and pragmatic correctness index, wherein the correct model instruction refers to a model instruction generated based on the media data processing task and meeting the requirements of the corresponding index; Encoding the correct model instruction to obtain a third semantic vector; Calculating the instruction similarity between the target model instruction and the correct model instruction based on the first semantic vector and the third semantic vector; The grammatical and pragmatic correctness of the target model instruction is detected according to the calculated instruction similarity, and the detected grammatical and pragmatic correctness is added to the first detection result.
4. The method according to claim 3, It is characterized in that The grammatical and pragmatic correctness index includes at least one of the following sub-indicators: a spelling error sub-indicator, a grammatical quality sub-indicator, a tense correctness sub-indicator, and a language and cultural habit sub-indicator; Among them, the indicator requirements of the typo sub-indicator include: there are no typos in the model instructions; the indicator requirements of the grammatical quality sub-indicator include: the model instructions have no grammatical errors; the indicator requirements of the tense correctness sub-indicator include: the model instructions have no tense errors; the indicator requirements of the language and cultural habits sub-indicator include: the expression of the model instructions conforms to the expression habits of the language used by the corresponding model instructions.
5. The method according to claim 4, It is characterized in that There is a correct model instruction under each sub-indicator in the grammatical pragmatic correctness indicator; The correct model instructions under each sub-indicator are encoded respectively to obtain the third semantic vector corresponding to each sub-indicator; and the third semantic vector corresponding to each sub-indicator is used to calculate the instruction similarity between the target model instruction and the correct model instruction under the corresponding sub-indicator.
6. The method according to claim 5, It is characterized in that The detecting the grammatical and pragmatic correctness of the target model instruction according to the calculated instruction similarity comprises: Traversing each sub-indicator in the grammatical pragmatic correctness index, determining the kth sub-indicator currently traversed, where k is a positive integer and is not greater than the number of sub-indicators in the grammatical pragmatic correctness index; According to the instruction similarity between the target model instruction and the correct model instruction under the k-th sub-indicator, the target model instruction is scored under the k-th sub-indicator to obtain the score of the target model instruction under the k-th sub-indicator; After all sub-indicators in the grammatical-pragmatic correctness indicator are traversed, the grammatical-pragmatic correctness of the target model instruction is determined based on the scores of the target model instruction under the sub-indicators.
7. The method according to claim 6, It is characterized in that The determining the grammatical and pragmatic correctness of the target model instruction based on the scores of the target model instruction under the sub-indicators includes: From the scores of the target model instruction under the various sub-indicators, the smallest score is selected as the grammatical and pragmatic correctness of the target model instruction.
8. The method according to claim 1, It is characterized in that The at least one structural dimension includes at least one of the following: a length dimension, a concept quantity dimension, a clause quantity dimension, and a term quantity dimension; wherein: The structural parameter value of the target model instruction in the length dimension is: the instruction length of the target model instruction, and the instruction length refers to the number of characters in the target model instruction; The structural parameter value of the target model instruction under the concept quantity dimension is: the concept quantity in the target model instruction, where a concept refers to a word used to distinguish different actions and different objects; The structural parameter value of the target model instruction under the clause number dimension is: the number of clauses in the target model instruction, where a clause refers to a sentence obtained by splitting the target model instruction; The structural parameter value of the target model instruction under the term quantity dimension is: the number of professional terms in the target model instruction.
9. The method according to claim 1, It is characterized in that The detecting the structural complexity of the target model instruction based on the parameter value summation result includes: Using a normalization function, normalizing the sum of the parameter values to obtain a normalized parameter value; The normalized parameter value is used as the structural complexity of the target model instruction.
10. The method according to claim 1, It is characterized in that The number of the media data samples is M, where M is a positive integer. The media model executes the media data processing task on each media data sample based on the target model instruction to obtain an actual task execution result corresponding to each media data sample. The step of detecting the task execution accuracy of the target model instruction on the media model based on the actual task execution result to obtain a second detection result includes: Obtaining a preset task execution result corresponding to each media data sample; Evaluate the score of each media data sample on the media model according to the preset task execution result corresponding to each media data sample and the corresponding actual task result; Integrating the scores of the M media data samples on the media model to obtain the score of the target model instruction on the media model; Based on the score of the target model instruction on the media model, the task execution accuracy of the target model instruction on the media model is detected to obtain a second detection result.
11. The method according to claim 1, It is characterized in that There are multiple media models, and one media model corresponds to one second detection result; The generating, based on the first detection result and the second detection result, quality information of the target model instruction includes: Scoring the task execution effect of the target model instruction based on the task execution accuracy in the second detection results corresponding to the multiple media models to obtain a task execution effect score; The first detection result and the task execution effect score are used to generate quality information of the target model instruction.
12. The method according to claim 11, It is characterized in that The multiple media models include multiple model versions of X models, one model version is one media model, and X is a positive integer; Scoring the task execution effect of the target model instruction based on the task execution accuracy in the second detection results corresponding to the multiple media models to obtain the task execution effect score includes: Traverse each model in the X models to determine the xth model currently traversed, x∈[1,X]; Performing a mean operation on the task execution accuracy in the second detection results corresponding to each model version of the x-th model to obtain an accuracy mean; Based on the accuracy mean, scoring the task execution effect of the target model instruction on the x-th model to obtain the score of the target model instruction on the x-th model; After each model in the X models is traversed, the scores of the target model instructions on the various models are integrated to obtain the task execution effect score.
13. The method according to claim 12, It is characterized in that Scoring the task execution effect of the target model instruction on the x-th model based on the accuracy mean to obtain the score of the target model instruction on the x-th model includes: respectively calculating the difference between the task execution accuracy in the second detection result corresponding to each model version of the x-th model and the accuracy mean, to obtain a plurality of difference values; Based on the multiple differences, calculating the accuracy stability of the target model instruction on the x-th model; wherein the accuracy stability is used to indicate: the stability between the task execution accuracy of the target model instruction on each model version of the corresponding model; Based on the accuracy stability of the target model instruction on the x-th model, the task execution effect of the target model instruction on the x-th model is scored to obtain the score of the target model instruction on the x-th model.
14. The method according to claim 11, It is characterized in that The first detection result includes at least one of the following values: semantic accuracy, grammatical and pragmatic correctness, and structural complexity; The step of using the first detection result and the task execution effect score to generate the quality information of the target model instruction includes: Obtaining a weighting coefficient of each value in the first detection result and a weighting coefficient of the task execution effect score; Calculating the quality score of the target model instruction based on the acquired weighting coefficients, each value in the first detection result and the task execution effect score; The quality score of the target model instruction is used to construct quality information of the target model instruction.
15. The method of claim 1, It is characterized in that The benchmark performance of the target model instruction includes: the semantic accuracy of the target model instruction; the process of detecting the benchmark performance of the target model instruction includes: calculating the semantic distance between the target model instruction and the task description text of the media data processing task; The method further comprises: Based on the positive or negative value of the semantic distance, detecting the directional consistency between the semantic direction of the target model instruction and the semantic direction of the task description text; If the directional consistency is detected, then continue to execute the quality detection process of the target model instruction; If the directional consistency is not detected, the target model instruction is determined to be an unusable model instruction, and the quality detection process of the target model instruction is terminated.
16. A quality detection device for model instructions, It is characterized in that include: An acquisition unit, used for acquiring attribute information of a target model instruction to be detected, wherein the target model instruction is generated based on a media data processing task; A detection unit, used to detect the benchmark performance of the target model instruction according to the attribute information of the target model instruction, and obtain a first detection result; wherein the attribute information refers to: information used to detect the benchmark performance of the target model instruction, and the benchmark performance is used to affect the correctness of the media model performing the media data processing task based on the target model instruction; when the attribute information includes: the structural parameter value of the target model instruction in at least one structural dimension, the benchmark performance includes: the structural complexity of the target model instruction, and the weight coefficient of each structural dimension in the at least one structural dimension is obtained; the weight coefficient of each structural dimension is used to perform weighted summation on the structural parameter values of the target model instruction in the at least one structural dimension to obtain a parameter value summation result; the structural complexity of the target model instruction is detected based on the parameter value summation result, and the detected structural complexity is added to the first detection result; The detection unit is further used to call the media model to perform the media data processing task on the media data sample based on the target model instruction to obtain an actual task execution result; and based on the actual task execution result, detect the task execution accuracy of the target model instruction on the media model to obtain a second detection result; The detection unit is further configured to generate quality information of the target model instruction based on the first detection result and the second detection result.
17. A computer device comprising an input interface and an output interface, It is characterized in that Also includes: processor and computer storage media; The processor is suitable for implementing one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the quality detection method of the model instruction as described in any one of claims 1-15.
18. A computer storage medium, It is characterized in that The computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the quality detection method of the model instruction according to any one of claims 1-15.
19. A computer program product, It is characterized in that The computer program product includes one or more instructions; when the one or more instructions in the computer program product are executed by a processor, the quality detection method of the model instruction according to any one of claims 1 to 15 is implemented.
Citation Information
Patent Citations
Chip code optimization method based on user requirements
CN116126736A
Task instruction construction method and task processing method
CN117762499A
