Test method and device of language model, computer equipment and storage medium
By automating the language quality detection process of multilingual artificial intelligence models and utilizing decomposition rules and large language model analysis, the problem of easy omissions in manual detection is solved, and efficient and accurate language quality testing is achieved.
Patent Information
- Application Number
- CN202611433163.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-11-24
AI Technical Summary
In existing technologies, language quality testing of multilingual AI models relies on manual verification, which is prone to missed detections, resulting in low testing accuracy and efficiency.
By acquiring user input and target response information, and using preset decomposition rules to break them down into sub-information, prompt words are generated based on language and analysis requirements. A large language model is then used to perform language quality analysis, generate a test report, and achieve automated detection.
It significantly improves the comprehensiveness and accuracy of the language model's output responses, increases testing efficiency, and avoids the problem of missed detections caused by manual testing.
Smart Images

Figure CN123157601A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, computer device, and storage medium for testing a language model. Background Technology
[0002] With the rapid development of artificial intelligence (AI) technology, applications with multilingual AI models (i.e., language models) have been widely used in various scenarios such as intelligent question answering and human-computer interaction. Multilingual AI models usually have multilingual support capabilities and can automatically reply in the same language according to the language input by the user. They can adapt to the usage needs of users who speak different languages, such as intelligent customer service and chatbots. The language output quality of multilingual AI applications directly affects the user experience and the effectiveness of product implementation.
[0003] In existing technologies, the testing of the language quality of multilingual AI models mainly relies on manual verification of the language quality of the responses output by the multilingual AI models. This is prone to missing various language problems, resulting in low accuracy in the testing of the language quality of multilingual AI models, and consequently, low testing efficiency. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application provide a language model testing method, apparatus, computer equipment, and storage medium, which realizes an automated language quality detection testing process for a target language model, effectively avoiding the problem of missed detections that are prone to occur in manual detection, significantly improving the comprehensiveness and accuracy of detection of the response content output by the language model, thereby greatly improving the testing efficiency of the language model.
[0005] In a first aspect, embodiments of this application provide a method for testing a language model, comprising: The system acquires user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The target response information is decomposed based on a preset information decomposition rule to obtain at least one target response sub-information; Based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, the first prompt word for the language quality analysis task is generated; The language quality analysis task is performed by the first model based on the first prompt word to generate language quality analysis results for each of the target response sub-informations; Based on the language quality analysis results of each target response sub-information, a target test report is generated for the target language model.
[0006] Secondly, embodiments of this application provide a language model testing apparatus, comprising: An acquisition unit is used to acquire user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by a target language model based on the user input information in the first language. The disassembly unit is used to disassemble the target response information based on a preset information disassembly rule to obtain at least one target response sub-information; The first generation unit is used to generate the first prompt word for the language quality analysis task based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information. The processing unit is configured to perform the language quality analysis task based on the first prompt word using a first model, so as to generate language quality analysis results for each of the target response sub-informations; The second generation unit is used to generate a target test report for the target language model based on the language quality analysis results of each target response sub-information.
[0007] Thirdly, embodiments of this application also provide a computer device, including a memory storing multiple instructions; a processor loading instructions from the memory to execute the steps of a testing method for any language model provided in embodiments of this application.
[0008] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute the steps of any language model testing method provided in embodiments of this application.
[0009] Fifthly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the testing method of any language model provided in embodiments of this application.
[0010] The solution adopted in this application generates a first prompt word for the language quality analysis task based on the first language of the user input information, each target response sub-information of the target response information, and the analysis requirements of the language quality analysis task for the target response information. Then, the first model performs the language quality analysis task based on the first prompt word to generate the language quality analysis results of each target response sub-information. Based on the language quality analysis results of each target response sub-information, a target test report for the target language model is generated. This realizes an automated language quality detection test process for the target language model, effectively avoiding the problem of missed detections that are easy to occur in manual detection, significantly improving the detection comprehensiveness and test accuracy of the response content output by the language model, thereby greatly improving the testing efficiency of the language model. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic flowchart of an embodiment of the language model testing method provided in this application. Figure 2 This is a schematic flowchart of another embodiment of the language model testing method provided in this application; Figure 3 This is a schematic flowchart of another embodiment of the language model testing method provided in this application; Figure 4 This is a schematic flowchart of another embodiment of the language model testing method provided in this application; Figure 5 This is a schematic diagram of the structure of the language model testing device provided in the embodiments of this application; Figure 6 This is a schematic diagram of the internal structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0014] In one embodiment of this application, the language model testing method can run on a local terminal device or a server. When the language model testing method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0015] To better understand the language model testing method, apparatus, computer equipment, and storage medium provided in the embodiments of this application, the application environment applicable to the embodiments of this application is described below.
[0016] As one implementation method, the language model testing method provided in this application can be applied to terminal devices (or electronic devices), cloud platforms, and application devices. The terminal can be a mobile phone, tablet, desktop computer, or laptop computer, and can be connected to a resource library via a network. The network serves as the medium for providing a communication link between the terminal (or electronic device) and the resource library. The network can include various connection types, such as wired communication links, wireless communication links, etc., and this application does not limit this. Optionally, in other embodiments, the electronic device can also be a smartphone, laptop computer, etc.
[0017] It should be understood that the aforementioned terminals (or electronic devices) and resource libraries are merely illustrative. Depending on implementation needs, any number of terminals (or electronic devices), cloud platforms, and application devices can be included. It is also understood that embodiments of this application can allow multiple terminals to access the cloud platform simultaneously.
[0018] The following detailed description is provided in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.
[0019] The following detailed description is provided in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal. It should be noted that the order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.
[0020] Please see Figure 1 The following describes the testing methods for the language model provided in this application. Please refer to [link / reference needed] for details. Figure 1 , Figure 1 This is a schematic flowchart of an embodiment of the language model testing method provided in this application. The specific flow of the language model testing method can be as follows: steps 101 to 105, wherein: Step 101: Obtain user input information and target response information. The user input information is information in the first language, and the target response information is information generated and output by the target language model based on the user input information in the first language.
[0021] The target language model can be a multilingual artificial intelligence (AI) model. This multilingual AI model is jointly trained with multilingual corpora and is compatible with text input in multiple languages such as Chinese, English, Japanese, Korean, French, and German. It can generate corresponding language response text based on user input in different languages, adapting to globalized multilingual interaction scenarios. Alternatively, in other optional implementations, the target language model can also be a single-language large language model, an industry-specific multilingual dialogue model, etc., which can be flexibly selected according to actual testing business needs; there is no single limitation.
[0022] In this embodiment, both the user input information and the target response information are in the form of text. The user input information consists of plain text content such as questions and commands entered by the user through the interactive interface, while the target response information is a multilingual text reply generated by the target AI language model based on the aforementioned text input. Text-based data has the advantages of being easy to parse and convenient for feature extraction, facilitating subsequent multi-dimensional language defect identification, including vocabulary, grammar, language type, and honorific usage.
[0023] In other alternative implementations, user input information and target response information may also include text data obtained after speech-to-text or image recognition, without being the only one to include them.
[0024] In this embodiment of the application, user input information obtained from the target language model in real time and target response information corresponding to the user input information output by the target language model can be directly obtained; or, data pairs can be extracted from a pre-built test case library. A data pair may include the original question message sent by the user (i.e., user input information) and the multilingual response content generated by the artificial intelligence model based on the original question message, which is the target response information.
[0025] In one specific embodiment, user input information and target response information in the first language can be obtained from the test case library. The target response information is information generated and output by the multilingual AI model based on the user input information in the first language.
[0026] In one embodiment, prior to the step of obtaining user input information and target response information, the method further includes: The user input information in the first language is input into the target language model, and the target language model generates and outputs the target response information based on the user input information in the first language.
[0027] In one specific embodiment, user input information corresponding to the first language can be input into a pre-deployed target language model. The target language model then responds to the user input and performs an intelligent generation task. The target language model can adapt to the textual semantic logic, language features, and contextual rules of the first language. Based on the received user input information in the first language, it performs complete semantic understanding and reasoning operations, autonomously generates response content matching the user input information, and finally outputs the corresponding standardized target response information. This method can reliably obtain the actual response text of the target language model for input in a specified language, accurately reproducing the actual interactive output effect of the model, and providing real and effective original detection samples for subsequent multi-dimensional language quality decomposition, analysis, and detection.
[0028] Step 102: Decompose the target response information based on preset information decomposition rules to obtain at least one target response sub-information.
[0029] In this embodiment, standardized preset information decomposition rules can be pre-configured. These rules define elements such as sentence structure, paragraph separators, punctuation marks, sentence markers, and line breaks for multilingual texts, adapting to the decomposition logic of various language texts. After obtaining the complete target response information, the preset information decomposition rules are invoked to segment and decompose the entire target response information into segments and sentences. After decomposition, at least one independent target response sub-information can be output.
[0030] For example, if the target response is a long text containing multiple sentences and paragraphs, it can be split into multiple independent short sentences based on sentence punctuation and paragraph spacing rules, with each short sentence being a sub-information of the target response. If the target response is only a single short sentence, only one sub-information of the target response will be generated after splitting. By dividing the complete response into the smallest detection unit through the splitting operation, it is easier to conduct refined defect detection such as vocabulary, grammar, language mixing, and honorific standardization on a paragraph and sentence-by-sentence basis, thereby improving the accuracy of language problem localization. In other embodiments, the preset information splitting rules can also be combined with semantic boundaries and semantic pause markers to complete the splitting, etc., which will not be elaborated here.
[0031] In one specific embodiment, the target response information output by the AI model can be input into the statement decomposition module, which then decomposes the statement according to the following rules: (1) Use the sentence-ending punctuation (., !, ?, newline character) as the main dividing point; (2) Add full-width punctuation recognition for languages such as Chinese and Japanese (i.e., language types); (3) Filter out empty strings and pure symbol / number fragments, and retain statements containing actual semantics.
[0032] For example, the target response message output by the AI model could be, "Okay, your order has been shipped. It is expected to arrive within 3 days. By the way, you can also track it on our website." The result of breaking down the target response message according to the above rules is: Statement 1: Okay, your order has been shipped.
[0033] Statement 2: Expected delivery within 3 days.
[0034] Statement 3: By the way, you can also track it on our website. In summary, the embodiments of this application decompose the target response information output by the AI model into independent sentence units, and compare each sentence with the target language of the user input information one by one. Through sentence-level decomposition, any inconsistency in the language of any local sentences in the target response information can be captured, fundamentally eliminating missed detections.
[0035] Step 103: Based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, generate the first prompt word for the language quality analysis task.
[0036] In this embodiment of the application, the system is pre-configured with prompt word generation logic corresponding to multilingual quality analysis. After the target response information is decomposed to obtain each target response sub-information, the system can retrieve the known first language, all target response sub-information, and the analysis requirements corresponding to the language quality analysis task to be executed, and generate a first prompt word that is suitable for the current detection scenario by combining the three types of information.
[0037] The first language is used to define the benchmark language for verification, guiding the identification of issues such as the mixing of other languages or language mismatches in the target response sub-information. The target response sub-information is the main text to be verified sentence by sentence. The analytical requirements of the language quality analysis task are used to clarify the dimensions of this detection, such as checking for misuse of vocabulary, identifying grammatical flaws, verifying the standardization of honorifics, and investigating cross-language mixing. The generated first prompt word integrates the above three elements into standardized instructions to guide the analysis model to conduct targeted and refined language defect detection. In other implementations, auxiliary parameters such as language standardization standards and industry terminology standards can also be introduced when generating the first prompt word.
[0038] In one specific embodiment, the analysis requirements for a language quality analysis task can be as follows: "You are an experienced evaluator. Your task is to examine each sentence in the list and determine whether it uses the intended language."
[0039] Please strictly adhere to the following standards: The is_match property of a sentence is set to true when all words and grammatical structures in a sentence match the expected language.
[0040] If any word or grammatical structure in a sentence does not match the expected language, set the is_match property of that sentence to false.
[0041] If the expected language is unknown, set is_match to false for all sentences.
[0042] You must provide reasons for the judgment in each sentence.
[0043] The output format strictly follows JSON, containing a `results` array, where each array element contains: `sentence`, `is_match`, and `reason`.
[0044] Step 104: Perform the language quality analysis task based on the first prompt word using the first model to generate language quality analysis results for each of the target response sub-informations.
[0045] Specifically, the first model for performing the language quality analysis task can be a Large Language Model (LLM). This LLM, trained on massive multilingual text corpora, possesses powerful natural language understanding, text detail identification, and language compliance verification capabilities, accurately adapting to the business scenarios of multilingual text quality detection in this invention. This model can deeply understand the vocabulary norms, grammatical rules, sentence logic, and language-specific honorific usage systems of different languages. Based on the generated first prompt word, it can perform comprehensive and refined analysis of the segmented target response sub-information, accurately identifying various implicit language defects such as vocabulary misuse, grammatical flaws, language mixing, and improper use of honorifics, effectively compensating for the low accuracy and high false negative rate of manual detection. In practical applications, this LLM can be any of a general pre-trained LLM or a multilingual dedicated LLM. In addition, in other optional implementations, the first model can also employ a finely tuned dedicated language detection model, an AI model integrating multilingual discrimination capabilities, etc., depending on the requirements of detection accuracy and operational efficiency; these will not be elaborated upon here.
[0046] In this embodiment, a first prompt word is input into a first model, and the language quality analysis task is performed by the first model based on the first prompt word to generate language quality analysis results for each of the target response sub-informations.
[0047] Specifically, the language quality analysis results of each target response sub-information can be in JSON format, specifically containing a results array, where each array element contains: sentence, is_match (whether it matches), and reason (reason or defect description).
[0048] In summary, when comparing the target response information sentence by sentence, the embodiments of this application construct specific prompt words to drive the LLM to output a binary label of "consistent / inconsistent" and the reason for the judgment for each sentence. During the parsing process, the original sentence text and the explanation of the reason for the judgment of language defects will be completely retained to ensure that the defect information is complete and traceable.
[0049] Step 105: Generate a target test report for the target language model based on the language quality analysis results of each target response sub-information.
[0050] In this embodiment, after completing the language quality analysis of all target response sub-information, the system integrates and generates a target test report for the target language model based on the language quality analysis results corresponding to all target response sub-information. Specifically, the result assembly module parses the JSON-formatted structured data returned by the Large Language Model (LLM). During the parsing process, the original sentence text and the explanation of the reasons for the existence of language defects are completely retained, ensuring that the defect information is complete and traceable.
[0051] In one embodiment, the step of generating a target test report for the target language model based on the language quality analysis results of each of the target response sub-information includes: Based on the language quality analysis results of each target response sub-information, the target response sub-information is classified, and based on the language quality analysis results of the classified target response sub-information, a target test report is generated for the target response information output by the target language model.
[0052] In one embodiment, after the large language model completes the language quality analysis of each target response sub-information and outputs structured analysis results in JSON format, the result assembly module precisely parses the JSON data. Specifically, the result assembly module reads the label field from the JSON data and, based on the judgment label corresponding to the label field, automatically divides all the completed target response sub-information into two independent lists: a language quality compliance list (e.g., a list of language-consistent statements) and a speech quality defect list (e.g., a list of language-inconsistent statements), thus achieving the classification and organization of the detection results. Simultaneously, throughout the entire process of data parsing and classification storage, the module fully preserves the original text content of each target response sub-information, as well as the corresponding defect judgment reasons output by the large language model. This ensures that each detection result is traceable and verifiable, avoiding data loss or missing information, and providing complete and standardized data support for the subsequent generation of a complete and accurate model target test report.
[0053] For example, the specific output format of the target test report can be as follows: Language consistency check report Target language: Chinese; User input: Please help me check the order status.
[0054] Target reply: Okay, your order has been shipped. Expected delivery within 3 days. By the way... (1) List of language-consistent statements: [1] Okay, your order has been shipped.
[0055] Reason: Purely in Chinese, with no other languages mixed in.
[0056] [2] Expected delivery within 3 days.
[0057] Reason: The Chinese sentences conform to the target language.
[0058] (2) List of statements with language inconsistencies: [3] By the way, you can also track it on our website. Reason: The entire sentence is in English, which is inconsistent with the target language, Chinese.
[0059] Based on the above description, the following examples will further illustrate the testing method of the language model of this application. Specific embodiments are described below.
[0060] In one embodiment, after the step of obtaining user input information and target response information, the method further includes: Based on the user input information and the language recognition task requirements for the user input information, a second prompt word for the language recognition task is generated.
[0061] In this embodiment, a language recognition-specific prompt word generation logic can be pre-configured. After obtaining the user input information to be recognized, the logic retrieves the user input information and the recognition requirements corresponding to the current language recognition task, and generates a second prompt word adapted to the language recognition task by combining the two types of information. The user input information is the original text of the language to be identified, and the recognition requirements of the language recognition task specify the recognition output standards, such as the output language name, language confidence level, and whether there is multilingual mixing. The second prompt word integrates the user input text and the recognition requirements into a standardized instruction, guiding the second model to accurately distinguish the language of the text, providing a basis for subsequent verification of whether the language of the target response information is consistent with the input language.
[0062] In one specific embodiment, the language recognition task may have the following recognition requirements: "You are now an experienced evaluator. Your task is to determine the language (i.e., the language type) used by the user input information and perform language detection. Please strictly adhere to the following standards:" If the user explicitly specifies a language in their input, then that language is returned.
[0063] If the user does not explicitly specify a language in their input, the language will be determined based on the content of the user's input.
[0064] If the user input contains Chinese words and grammatical structures, it is judged as Chinese.
[0065] If the user input contains English words and grammatical structures, it is judged as English.
[0066] If the user input contains both Chinese and English, the primary language is determined based on the proportion of content exceeding 50%.
[0067] If multiple languages are represented equally, return the language used in the first sentence.
[0068] Please return directly to the detected language name, which must be 'Chinese' or 'English'.
[0069] Special note: Reasons for the judgment must be provided, and these reasons must be detailed and sufficient. The output format must strictly adhere to JSON format.
[0070] Furthermore, after the step of generating the second prompt word for the language recognition task based on the user input information and the recognition requirements of the language recognition task for the user input information, the method further includes: The second model performs the language recognition task based on the second prompt word to identify the language corresponding to the user input information.
[0071] In this embodiment, the second model can be a large language model. The large language model returns a recognition result based on the second prompt word, for example, the language (or linguistic type) is Chinese. This result serves as the target language benchmark for all subsequent consistency comparisons. If the user input contains multiple languages, the prompt word can request the return of the primary language and auxiliary information.
[0072] In summary, the language corresponding to the user input information (i.e., the target language) is not preset by humans, but is dynamically determined by the large language model after language recognition of the user input information, and serves as an objective benchmark for subsequent comparisons.
[0073] In one embodiment, the step of performing the language quality analysis task based on the first prompt word using a first model to generate language quality analysis results for each of the target response sub-informations includes: The language quality analysis task is performed by the first model based on the first prompt word to identify the matching results of words and / or grammatical structures of each target response sub-information with the first language; Based on the matching results of each target response sub-information, corresponding language quality analysis results are generated.
[0074] Specifically, in this embodiment, the first model loads the generated first prompt word and executes a preset language quality analysis task. The first model, in conjunction with the instructions of the first prompt word, verifies each target response sub-information one by one, determining whether the vocabulary and grammatical structure within each target response sub-information match the first language standard, and outputs the corresponding matching results. For each target response sub-information, based on its corresponding word matching results and grammatical structure matching results, a language quality analysis result specific to that target response sub-information is generated, fully recording various anomalies such as vocabulary misuse, grammatical errors, and language mismatches in the text, providing standardized raw detection data for subsequent result assembly module processing and target test report generation.
[0075] In summary, the judgment results are assembled into a list of language-consistent statements and a list of language-inconsistent statements, with each statement accompanied by the original text, a judgment label, and a judgment reason. This structured output allows testers who do not understand the target language to directly locate inconsistent statements and submit defects based on them without having to go back to the original response. Testers can also locate problematic statements and submit defects based on the target test report, significantly shortening the operation chain and achieving automated connection from testing to test report generation.
[0076] Based on the above description, the following examples will further illustrate the testing method of the language model in this application. Please refer to [link / reference]. Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the language model testing method provided in this application. The specific embodiment is described below: This embodiment of the application can receive user input text (i.e., user input information) through a target language determination module, call a Large Language Model (LLM) to identify the main language of the user input text, and output the language tag of the target language. Then, it receives the AI response text (i.e., target response information) output by the AI model based on the user input text, and decomposes it into a list of sentences based on sentence boundary rules through a sentence decomposition module. Then, a sentence-by-sentence consistency determination module combines the target language and the sentence list to construct a first prompt word, calls the Large Language Model to perform binary classification judgment on each sentence based on the first prompt word and provides reasons to obtain the judgment result. Finally, the result assembly and output module organizes the judgment results into a list of consistent sentence texts, a list of inconsistent sentence texts and reasons, and generates a target test report that can be directly used in this test.
[0077] Based on the above description, the following examples will further illustrate the testing method of the language model in this application. Please refer to [link / reference]. Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the language model testing method provided in this application. The specific embodiment is described below: (1) Obtain user input information and target response information in the first language from the test case library. The target response information is generated and output by the multilingual AI model based on the user input information in the first language. For example, the user input information can be "Please help me check the order status." and the target response information can be "Okay, your order has been shipped. It is expected to arrive within 3 days. By the way, you can also track it on our website."
[0078] (2) Determine the target language. The user input information is passed to the target language determination module, which calls the Large Language Model (LLM) and uses the following prompts for language recognition: "You are now an experienced evaluator. Your task is to determine the language used by the user based on their input and perform language detection. Please strictly adhere to the following standards:" If the user explicitly specifies a language in their input, then that language is returned.
[0079] If the user does not explicitly specify a language in their input, the language will be determined based on the content of the user's input.
[0080] If the user input contains Chinese words and grammatical structures, it is judged as Chinese.
[0081] If the user input contains English words and grammatical structures, it is judged as English.
[0082] If the user input contains both Chinese and English, the primary language is determined based on the proportion of content exceeding 50%.
[0083] If multiple languages are represented equally, return the language used in the first sentence.
[0084] Please return directly to the detected language name, which must be 'Chinese' or 'English'.
[0085] Special note: Reasons for the judgment must be provided, and these reasons must be detailed and sufficient. The output format must strictly adhere to JSON format.
[0086] Next, the large language model returns the recognition result, such as the language (or linguistic type) being Chinese. This result serves as the target language benchmark for all subsequent consistency comparisons. If the user input contains multiple languages, the prompt can request the return of the primary language and auxiliary information.
[0087] (3) Decompose the target response information and divide it into a statement list according to statement boundary rules. The target response information can be input into the statement decomposition module, which will then split it according to the following rules: 1) Use the sentence-ending punctuation (., !, ?, newline character) as the main delimiter; 2) Add full-width punctuation recognition for languages such as Chinese and Japanese (i.e., language types); 3) Filter out empty strings and pure symbol / number fragments, and retain statements containing actual semantics.
[0088] For example, the target response message output by the AI model could be, "Okay, your order has been shipped. It is expected to arrive within 3 days. By the way, you can also track it on our website." The result of breaking down the target response message according to the above rules is: Statement 1: Okay, your order has been shipped.
[0089] Statement 2: Expected delivery within 3 days.
[0090] Statement 3: By the way, you can also track it on our website. (4) Sentence-by-sentence consistency (or binary classification consistency) determination. The target language (Chinese) and the sentence list are combined to construct structured prompt words, which are then sent to the LLM to generate structured JSON results. The prompt words are designed as follows: "You are an experienced evaluator. Your task is to examine each sentence in the list and determine whether it uses the intended language."
[0091] Please strictly adhere to the following standards: The is_match property of a sentence is set to true when all words and grammatical structures in a sentence match the expected language.
[0092] If any word or grammatical structure in a sentence does not match the expected language, set the is_match property of that sentence to false.
[0093] If the expected language is unknown, set is_match to false for all sentences.
[0094] You must provide reasons for the judgment in each sentence.
[0095] The output format strictly follows JSON, containing a `results` array, where each array element contains: `sentence`, `is_match`, and `reason`.
[0096] (5) After the large language model completes the language quality analysis of each target response sub-information and outputs the structured analysis results in JSON format, the result assembly module performs precise parsing of the JSON data. Specifically, the result assembly module reads the label field in the JSON data and, based on the judgment label corresponding to the label field, automatically divides all the target response sub-information that has been detected into two independent lists: a language quality compliance list (such as a list of language-consistent statements) and a speech quality defect list (such as a list of language-inconsistent statements), thereby achieving the classification and standardization of the detection results. At the same time, throughout the entire process of data parsing and classification storage, the module completely retains the original text content of each target response sub-information and the corresponding defect judgment reasons output by the large language model, ensuring that each detection result is traceable and verifiable, avoiding data loss or missing information, and providing complete and standardized data support for the subsequent generation of a complete and accurate model target test report.
[0097] For example, the specific output format of the target test report can be as follows: Language consistency check report Target language: Chinese; User input: Please help me check the order status.
[0098] Target reply: Okay, your order has been shipped. Expected delivery within 3 days. By the way... 1) List of language-consistent statements: [1] Okay, your order has been shipped.
[0099] Reason: Purely in Chinese, with no other languages mixed in.
[0100] [2] Expected delivery within 3 days.
[0101] Reason: The Chinese sentences conform to the target language.
[0102] 2) List of statements with language inconsistencies: [3] By the way, you can also track it on our website. Reason: The entire sentence is in English, which is inconsistent with the target language, Chinese.
[0103] Testers can directly identify statement 3 as having a language quality defect without needing to understand different languages, and can then submit the defect: the target response information from the AI model is improperly switched between Chinese and English.
[0104] Based on the above description, the following examples will further illustrate the testing method of the language model in this application. Please refer to [link / reference]. Figure 4 , Figure 4 This is a flowchart illustrating another embodiment of the language model testing method provided in this application. The specific embodiment is described below: In this embodiment, the sentence-by-sentence consistency determination module can store the sentence list and target language into the prompt word constructor to form the first prompt word. The prompt word constructor returns the complete determination prompt word (i.e., the first prompt word) to the sentence-by-sentence consistency determination module, which may include instructions, lists, format requirements, etc. The sentence-by-sentence consistency determination module calls the API to send the first prompt word to the Large Language Model (LLM) so that the LLM can analyze the language attributes of the sentences one by one and return JSON results (specifically including index, text, label, reason) to the sentence-by-sentence consistency determination module. The sentence-by-sentence consistency determination module parses and verifies the JSON and transmits the structured determination data to the result assembly module so that the result assembly module can read the label field in the JSON data. Based on the determination label corresponding to the label field, all the target response sub-information that has been detected is automatically divided into two independent lists: a language quality compliance list (such as a language consistent sentence list) and a speech quality defect list (such as a language inconsistent sentence list), thereby realizing the classification and organization of the detection results and forming a target test report.
[0105] In summary, this application embodiment obtains user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by a target language model based on the user input information in the first language; then, the target response information is decomposed based on preset information decomposition rules to obtain at least one target response sub-information; next, based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, a first prompt word for the language quality analysis task is generated; then, the language quality analysis task is executed by a first model based on the first prompt word to generate language quality analysis results for each of the target response sub-information; finally, a target test report for the target language model is generated based on the language quality analysis results for each of the target response sub-information. This application embodiment generates a first prompt word for the language quality analysis task based on the first language of the user input information, each target response sub-information of the target response information, and the analysis requirements of the language quality analysis task for the target response information; then, a first model performs the language quality analysis task based on the first prompt word to generate the language quality analysis results of each target response sub-information; and generates a target test report for the target language model based on the language quality analysis results of each target response sub-information. This realizes an automated language quality detection testing process for the target language model, effectively avoiding the problem of missed detections that are prone to occur in manual detection, significantly improving the comprehensiveness and accuracy of the detection of the response content output by the language model, thereby greatly improving the testing efficiency of the language model.
[0106] It should be understood that although each step in the flowcharts of the above embodiments is shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0107] Based on the same inventive concept, this application also provides a language model testing apparatus for implementing the language model testing method described above, and a language model testing apparatus for implementing the language model testing method described above. The solution provided by this apparatus is similar to the solution described in the above method. Therefore, the specific limitations of the one or more language model testing apparatuses and language model testing apparatus embodiments provided below can be found in the limitations of the language model testing method and language model testing method described above, and the specific limitations will not be repeated here.
[0108] This embodiment also provides a language model testing device, which can be integrated into a terminal device. For example, such as... Figure 5 As shown, the testing apparatus for this language model may include: The acquisition unit 201 is used to acquire user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The disassembly unit 202 is used to disassemble the target response information based on a preset information disassembly rule to obtain at least one target response sub-information; The first generation unit 203 is used to generate the first prompt word for the language quality analysis task based on the first language, each of the target response sub-information, and the analysis requirements for the language quality analysis task of the target response information. Processing unit 204 is configured to perform the language quality analysis task based on the first prompt word using a first model, so as to generate language quality analysis results for each of the target response sub-informations; The second generation unit 205 is used to generate a target test report for the target language model based on the language quality analysis results of each target response sub-information.
[0109] In some embodiments, the language model testing apparatus further includes: The first generation subunit is used to generate a second prompt word for the language recognition task based on the user input information and the recognition requirements of the language recognition task for the user input information.
[0110] In some embodiments, the language model testing apparatus further includes: The first processing subunit is used to perform the language recognition task based on the second prompt word using the second model, so as to identify the language corresponding to the user input information.
[0111] In some embodiments, the language model testing apparatus further includes: The second processing subunit is used to perform the language quality analysis task based on the first prompt word using the first model, so as to identify the matching results of words and / or grammatical structures of each target response sub-information with the first language; The second generation subunit is used to generate corresponding language quality analysis results based on the matching results of each target response sub-information.
[0112] In some embodiments, the language model testing apparatus further includes: The third processing subunit is used to classify each target response sub-information based on the language quality analysis results of each target response sub-information, and generate a target test report for the target response information output by the target language model based on the language quality analysis results of each classified target response sub-information.
[0113] In some embodiments, the language model testing apparatus further includes: The fourth processing subunit is used to input user input information in the first language into the target language model, and generate and output target response information based on the user input information in the first language through the target language model.
[0114] In some embodiments, the language quality analysis results of each target response sub-information are in JSON format.
[0115] Using the device of this embodiment, the acquisition unit 201 acquires user input information and target response information. The user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The decomposition unit 202 decomposes the target response information based on preset information decomposition rules to obtain at least one target response sub-information. The first generation unit 203 generates a first prompt word for the language quality analysis task based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information. The processing unit 204 executes the language quality analysis task based on the first prompt word using a first model to generate language quality analysis results for each of the target response sub-information. The second generation unit 205 generates a target test report for the target language model based on the language quality analysis results for each of the target response sub-information. This embodiment of the application realizes an automated language quality detection test process for the target language model, effectively avoiding the problem of missed detections that are easy to occur in manual detection, significantly improving the detection comprehensiveness and test accuracy of the response content output by the language model, thereby greatly improving the testing efficiency of the language model.
[0116] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0117] Accordingly, this application also provides a computer device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.
[0118] like Figure 6 As shown, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. The computer device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored on the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0119] The processor 301 is the control center of the computer device 300. It connects various parts of the computer device 300 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 302, and by calling data stored in the memory 302, it executes various functions of the computer device 300 and processes data, thereby providing overall monitoring of the computer device 300. The processor 301 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic diagrams disclosed in the embodiments of this application.
[0120] In this embodiment, the processor 301 in the computer device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to realize various functions, such as: The system acquires user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The target response information is decomposed based on a preset information decomposition rule to obtain at least one target response sub-information; Based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, the first prompt word for the language quality analysis task is generated; The language quality analysis task is performed by the first model based on the first prompt word to generate language quality analysis results for each of the target response sub-informations; Based on the language quality analysis results of each target response sub-information, a target test report is generated for the target language model.
[0121] The computer device provided in this application embodiment can generate a first prompt word for a language quality analysis task based on the first language of user input information, each target response sub-information of the target response information, and the analysis requirements of the language quality analysis task for the target response information; then, a first model performs the language quality analysis task based on the first prompt word to generate language quality analysis results for each target response sub-information; and generate a target test report for the target language model based on the language quality analysis results of each target response sub-information. This realizes an automated language quality detection testing process for the target language model, effectively avoiding the problem of missed detections that are prone to occur in manual detection, significantly improving the comprehensiveness and accuracy of detection of the response content output by the language model, thereby greatly improving the testing efficiency of the language model.
[0122] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0123] Optional, such as Figure 6 As shown, the computer device 300 also includes: a touch screen display 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch screen display 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0124] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0125] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0126] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0127] The input unit 306 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0128] Power supply 307 is used to supply power to various components of computer device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0129] although Figure 6 As not shown in the diagram, computer equipment 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0130] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0131] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0132] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the language model testing methods provided in this application. The computer program can execute the steps of the language model testing method as follows: The system acquires user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The target response information is decomposed based on a preset information decomposition rule to obtain at least one target response sub-information; Based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, the first prompt word for the language quality analysis task is generated; The language quality analysis task is performed by the first model based on the first prompt word to generate language quality analysis results for each of the target response sub-informations; Based on the language quality analysis results of each target response sub-information, a target test report is generated for the target language model.
[0133] Because the computer program stored in this storage medium can generate a first prompt word for the language quality analysis task based on the first language of the user input information, each target response sub-information of the target response information, and the analysis requirements of the language quality analysis task for the target response information; then, the first model executes the language quality analysis task based on the first prompt word to generate the language quality analysis results of each target response sub-information; and generate a target test report for the target language model based on the language quality analysis results of each target response sub-information; this realizes an automated language quality detection test process for the target language model, effectively avoiding the problem of missed detections that are easy to occur in manual detection, significantly improving the comprehensiveness and accuracy of the detection of the answer content output by the language model, thereby greatly improving the testing efficiency of the language model.
[0134] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0135] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0136] Since the computer program stored in the computer-readable storage medium can execute the testing method of any language model provided in the embodiments of this application, the beneficial effects that the testing method of any language model provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0137] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.
[0138] In some embodiments, this application also provides a controller, including a memory and a processor; thereon storing a computer program, and the processor running the computer program in the memory, which, when executed by the processor, implements the steps in the embodiments of this application.
[0139] It should be noted that all data involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above.
[0140] It should be noted that, in the data processing stage, the technical solution of this application has strictly limited the scope of data collection to the minimum necessary to achieve the technical objectives, preventing the acquisition of irrelevant information. For any user information to be collected, the data subject will be clearly informed and their consent obtained. Furthermore, technologies such as encrypted storage and access control are employed to strengthen data security and ensure the security and compliance of the entire data processing process. The technical model and decision-making mechanism are based on objective technical parameters and do not introduce unnecessary parameters such as gender or age that may lead to discrimination, resolutely eliminating algorithmic discrimination and upholding public order and good morals. In addition, the specification fully describes the technical implementation methods, application scenarios, and compliance protection details. The claims are consistent with the content of the specification, key compliance designs are clear and verifiable, and the overall technical design is guided by the protection of public interests and adherence to social ethics, without any circumstances that harm public interests or violate public order and good morals.
[0141] In the above embodiments of the language model testing apparatus, computer-readable storage medium, computer device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and beneficial effects of the language model testing apparatus, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the language model testing method in the above embodiments, and will not be repeated here.
[0142] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0143] The foregoing has provided a detailed description of a language model testing method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for testing a language model, characterized in that, include: The system acquires user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by the target language model based on the user input information in the first language. The target response information is decomposed based on a preset information decomposition rule to obtain at least one target response sub-information; Based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information, the first prompt word for the language quality analysis task is generated; The language quality analysis task is performed by the first model based on the first prompt word to generate language quality analysis results for each of the target response sub-informations; Based on the language quality analysis results of each target response sub-information, a target test report is generated for the target language model.
2. The method according to claim 1, characterized in that, After obtaining the user input information and the target response information, the method further includes: Based on the user input information and the language recognition task requirements for the user input information, a second prompt word for the language recognition task is generated.
3. The method according to claim 2, characterized in that, After generating the second prompt word for the language recognition task based on the user input information and the recognition requirements of the language recognition task for the user input information, the method further includes: The second model performs the language recognition task based on the second prompt word to identify the language corresponding to the user input information.
4. The method according to claim 1, characterized in that, The step of performing the language quality analysis task based on the first prompt word using the first model to generate language quality analysis results for each of the target response sub-informations includes: The language quality analysis task is performed by the first model based on the first prompt word to identify the matching results of words and / or grammatical structures of each target response sub-information with the first language; Based on the matching results of each target response sub-information, corresponding language quality analysis results are generated.
5. The method according to claim 1, characterized in that, The generation of a target test report for the target language model based on the language quality analysis results of each target response sub-information includes: Based on the language quality analysis results of each target response sub-information, the target response sub-information is classified, and based on the language quality analysis results of the classified target response sub-information, a target test report is generated for the target response information output by the target language model.
6. The method according to claim 1, characterized in that, Before obtaining user input information and target response information, the method further includes: The user input information in the first language is input into the target language model, and the target language model generates and outputs the target response information based on the user input information in the first language.
7. The method according to claim 1, characterized in that, The language quality analysis results of each target response sub-information are in JSON format.
8. A testing device for a language model, characterized in that, include: An acquisition unit is used to acquire user input information and target response information, wherein the user input information is information in a first language, and the target response information is information generated and output by a target language model based on the user input information in the first language. The disassembly unit is used to disassemble the target response information based on a preset information disassembly rule to obtain at least one target response sub-information; The first generation unit is used to generate the first prompt word for the language quality analysis task based on the first language, each of the target response sub-information, and the analysis requirements of the language quality analysis task for the target response information. The processing unit is configured to perform the language quality analysis task based on the first prompt word using a first model, so as to generate language quality analysis results for each of the target response sub-informations; The second generation unit is used to generate a target test report for the target language model based on the language quality analysis results of each target response sub-information.
9. A computer device, characterized in that, It includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps of the language model testing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the language model testing method as described in any one of claims 1 to 7.
