A Chinese error correction method and system based on multi-agent cooperation and retrieval enhancement
By employing multi-agent collaboration and retrieval enhancement methods, multiple Chinese error correction expert agents and referee agents are constructed. Combined with an error correction text knowledge base and a vector database, this addresses the accuracy problem of existing Chinese spelling error correction methods lacking real-time data training, thereby improving error correction accuracy and system stability.
Patent Information
- Application Number
- CN202511164443.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-08-20
AI Technical Summary
Existing Chinese spelling correction methods, lacking real-time data training, cannot effectively cope with extreme text deformation and industry terminology updates, resulting in insufficient correction accuracy and affecting security audit efficiency.
A multi-agent collaboration and retrieval enhancement approach is adopted to construct multiple Chinese error correction expert agents and one Chinese error correction judge agent. A multi-agent closed-loop feedback module is constructed through detection, discrimination and feedback prompts to realize information collaboration, step-by-step reasoning and iterative optimization among the agents. Retrieval enhancement is carried out by combining the error correction text knowledge base and vector database.
It improves the accuracy of Chinese error correction, reduces the training cost of traditional deep learning algorithms, solves the problem of insufficient judgment and error correction accuracy of large models in the Chinese error correction process, and improves the stability and availability of the system.
Smart Images

Figure CN120654706B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of cyberspace security technology, and in particular relates to a Chinese error correction method and system based on multi-agent collaboration and retrieval enhancement. Background Art
[0002] Currently, large Chinese language models, represented by DeepSeek, Qwen, and ChatGLM, have become extremely important technical tools in the field of Chinese natural language processing. In the field of Chinese spelling correction, a series of approaches have emerged, including those based on mechanism rules, traditional machine learning, deep learning represented by CNN and BERT, and large language models. Models trained with BERT have achieved the best results. With the enrichment of data resources and the increase in model parameter size, the capabilities of large language models in the field of Chinese spelling correction have continued to improve. They are able to generalize corrections even with limited training data, improving the ability to detect unknown Chinese errors and significantly assisting text review efforts. However, in certain industries, during information dissemination, to circumvent the platform's security review mechanisms, criminals often use extreme text deformation methods to modify content. Furthermore, industry terminology is constantly updated. As a result, traditional methods, lacking real-time data training, are unable to guarantee correction accuracy due to limited generalization performance, impacting the efficiency of security review efforts. Summary of the Invention
[0003] Purpose of the invention: The technical problem to be solved by the present invention is to provide a Chinese error correction method and system based on multi-agent collaboration and retrieval enhancement in response to the shortcomings of the existing technology.
[0004] To achieve the above objectives, in a first aspect, a Chinese error correction method based on multi-agent collaboration and retrieval enhancement is disclosed, comprising the following steps:
[0005] Step 1: Based on the large language model and agent prompting project, build multiple Chinese error correction expert agents and one Chinese error correction referee agent;
[0006] Step 2: Build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, access the Chinese error correction expert agent and the Chinese error correction referee agent, and use them for information retrieval by the Chinese error correction expert agent and the Chinese error correction referee agent, thereby enhancing the ability to understand the context and realizing the retrieval enhancement generation function;
[0007] Step 3: Design detection prompts, discrimination prompts, and feedback prompts, build a multi-agent closed-loop feedback module, realize information collaboration, step-by-step reasoning, result verification, and iterative optimization among various agents, and complete the Chinese error correction task.
[0008] Furthermore, the types of the multiple Chinese error correction expert agents described in step 1 include grammatical error correction expert agents, vocabulary error correction expert agents, semantic error correction expert agents and logical error correction expert agents.
[0009] The grammar error correction expert agent is used to process errors including structure, punctuation, tense, quantifiers and function words;
[0010] The lexical error correction expert agent is used to handle errors including collocation, synonyms, homophones, similar characters and pinyin;
[0011] The semantic error correction expert agent is used to handle errors including ambiguity, negation and unclear reference;
[0012] The logical error correction expert agent is good at handling errors including causality, inconsistency and event sequence;
[0013] The Chinese error correction referee intelligent agent is used to adopt a voting mechanism or a scoring mechanism to comprehensively judge the output results of multiple Chinese error correction expert intelligent agents.
[0014] Furthermore, in step 3, a multi-agent closed-loop feedback module is constructed, including:
[0015] Step 3-1: merge the original text to be processed and the detection prompt information, input it into the Chinese error correction expert agent for processing, and output the detection result;
[0016] Step 3-2: Combine the output results and judgment prompt information of all Chinese error correction expert agents, input them into the Chinese error correction referee agent for processing, and output the judgment results and error correction results;
[0017] Step 3-3: If the error correction result of the Chinese error correction referee agent cannot be used as the final error correction result, the output results and feedback prompt information of all Chinese error correction expert agents and Chinese error correction referee agents are merged, and input into the Chinese error correction expert agent for processing again to output the detection result.
[0018] Through detection prompts, the original input is used as the input of the Chinese error correction expert intelligent agent, through discrimination prompts, the output of the Chinese error correction expert intelligent agent is used as the input of the Chinese error correction referee intelligent agent, and through feedback prompts, the output of the Chinese error correction referee intelligent agent is used as the input of the Chinese error correction expert intelligent agent. By setting judgment conditions, a feedback link is formed.
[0019] Furthermore, step 3-1 includes:
[0020] Set the original text to be processed for:
[0021]
[0022] Where N is the character length of the original text X to be processed, , Represents the nth character of text X;
[0023] Set the detection prompt information to P, then enter the detection prompt text of the Chinese error correction expert agent for:
[0024]
[0025] Where, Merge() is a merging function that merges the detection prompt information with the text to be processed;
[0026] Set the correct judgment result for , Bool value, indicating a character Is it correct? The correct error correction result is , For characters The corresponding correct error correction characters satisfy:
[0027]
[0028] The processing process of the Chinese error correction expert agent is as follows:
[0029]
[0030] Where, It is the processing function of the Chinese error correction expert agent. This is the judgment result of the Chinese error correction expert agent. It is a Bool value, indicating that the Chinese error correction expert agent is correcting the character The judgment result of correctness; This is the error correction result of the Chinese error correction expert agent. For characters The error correction result of the mth Chinese error correction expert agent is , , M represents the number of Chinese error correction expert agents.
[0031] Furthermore, step 3-2 includes:
[0032] For the judgment result processing, the Chinese error correction referee agent adopts a voting scheme to count the judgment results of each Chinese error correction expert agent and select the one with the largest number as the final judgment result, namely:
[0033]
[0034] Where, is a Bool value, indicating the judgment result of the Chinese error correction referee agent; if , judge that there is no error in the original text X and enter the end phase; if , determine that there are errors in the original text X and enter error correction;
[0035] Regarding the error correction results, the Chinese error correction referee agent uses its own understanding ability to analyze and score the error correction results of each Chinese error correction expert agent.
[0036]
[0037]
[0038] In the formula, Score() is the scoring model, and the conclusion of the mth Chinese error correction expert agent corresponds to the score , the Chinese error correction expert agent with the highest score among all Chinese error correction expert agents is , the corresponding score is ;
[0039] Set the score threshold S Th And the feedback iteration threshold K:
[0040] (1) When When , the error correction result of the highest-scoring Chinese error correction expert agent is the final error correction result and enters the output link; k represents the number of feedback iterations;
[0041] (2) When When the error correction result of the highest-scoring Chinese error correction expert agent cannot be used as the final error correction result, step 3-3 is executed to enter the feedback link.
[0042] In step 3-3, if the error correction result of the Chinese error correction referee agent cannot be used as the final error correction result, the output results and feedback prompt information of all Chinese error correction expert agents and Chinese error correction referee agents are merged, and the results are input into the Chinese error correction expert agent for processing again, and step 3-1 is executed again, and .
[0043] Furthermore, the information coordination, step-by-step reasoning, result verification and iterative optimization of each intelligent agent described in step 3 include: solving the deviation problem existing in a single intelligent agent and a single round of error correction by utilizing the Chinese language understanding and processing capabilities of multiple intelligent agents, and improving the overall error correction accuracy by comparing and learning multiple output results; regularly organizing business experts to manually judge the results, and updating the newly discovered and characteristic samples to the error correction text knowledge base to realize the update of system capabilities.
[0044] Furthermore, in step 1, the agent prompting project includes 6 sub-projects, namely, role-playing sub-project, thought chain sub-project, sample prompting sub-project, task decomposition sub-project, self-consistency sub-project and reverse thinking sub-project;
[0045] The role-playing sub-project is used to make the large language model play the role of a corresponding Chinese error correction expert or Chinese error correction referee, so that its logical analysis and output results are focused and professional;
[0046] The thought chain project is used to guide the large language model to gradually reason about Chinese error correction, thereby improving the accuracy of complex Chinese error correction tasks;
[0047] The sample prompt sub-project is used to provide correct examples during the Chinese error correction process, facilitating the large language model to learn the task objectives;
[0048] The task decomposition sub-project is used to break down the complex Chinese error correction task into multiple simple tasks to assist the large language model in thinking;
[0049] The self-consistency sub-project is used to repeat the Chinese error correction task independently multiple times to reduce the impact of output probability;
[0050] The reverse thinking sub-project is used to compare the original text to be corrected in Chinese with the correction result, so that the large language model can review the correction result.
[0051] Furthermore, the error correction text knowledge base in step 2 is composed of error texts and correct texts;
[0052] The vector database converts the corpus in the error-correcting text knowledge base into high-dimensional vectors for storage and retrieval through data extraction, text segmentation, and vectorization. This facilitates the rapid retrieval of text data with high similarity to the input content vector, enabling recall. Data extraction involves the process of obtaining useful information from unstructured or semi-structured data sources, using regular expressions, parsers, and text recognition techniques. Text segmentation addresses text length limitations by combining semantic chunking and sliding windows to divide long texts into semantic units. Vectorization converts text data into multidimensional vectors, facilitating the model's understanding of semantic similarity.
[0053] Furthermore, step 2 also includes vectorizing the original text to be processed input by the user, retrieving data with high similarity in the vector database, sorting and summarizing the recall results, combining the original text to be processed input by the user into new prompt information, and inputting it into the Chinese error correction expert intelligent agent and the Chinese error correction referee intelligent agent to achieve prompt enhancement effect.
[0054] In the second aspect, a Chinese error correction system based on multi-agent collaboration and retrieval enhancement is disclosed, including an agent construction module, a retrieval enhancement module and a multi-agent closed-loop feedback module.
[0055] The agent building module is used to build multiple Chinese error correction expert agents and one Chinese error correction referee agent based on the large language model and agent prompt engineering;
[0056] The retrieval enhancement module is used to build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, and access the Chinese error correction expert agent and the Chinese error correction referee agent;
[0057] The multi-agent closed-loop feedback module is used to achieve information collaboration, step-by-step reasoning, result verification and iterative optimization of each agent based on the designed detection prompts, discrimination prompts and feedback prompts, and complete the Chinese error correction task.
[0058] Beneficial effects: Compared with the prior art, the present invention has the following advantages.
[0059] 1. To address the problem of insufficient judgment and correction accuracy of a single large language model during the Chinese error correction process, the present invention proposes a multi-agent coordinated Chinese error correction method, which improves the accuracy of the entire system by leveraging the capabilities of collaborative experts and referees of multiple agents.
[0060] 2. In order to cope with the emergence of new words and concepts in the Internet industry and reduce the training costs of updating algorithm models using traditional deep learning algorithms, the present invention proposes a Chinese error correction method based on retrieval enhancement. By quickly adding error information samples to the large model, the discrimination and error correction capabilities of the large model are improved.
[0061] 3. To address the problems of hallucinations and insufficient stability in large models, this paper introduces a closed-loop feedback mechanism. Through multiple rounds of model self-iteration and self-optimization, the output results are judged and optimized, ultimately improving the accuracy of the output results. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more apparent.
[0063] Figure 1 A flowchart of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement is provided in an embodiment of the present application.
[0064] Figure 2 A schematic diagram of an intelligent agent construction method for Chinese error correction based on multi-agent collaboration and retrieval enhancement provided in an embodiment of the present application.
[0065] Figure 3 A schematic diagram of the retrieval enhancement process of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement provided in an embodiment of the present application.
[0066] Figure 4 A schematic diagram of the detection prompt structure of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement provided in an embodiment of the present application.
[0067] Figure 5 A schematic diagram of the discrimination prompt structure of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement provided in an embodiment of the present application.
[0068] Figure 6 A schematic diagram of the feedback prompt structure of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The embodiments of the present invention will be described below with reference to the accompanying drawings.
[0070] The large model has powerful text understanding and information updating capabilities, and has extremely strong generalization performance in the field of Chinese error correction. It exceeds the upper limit of traditional deep learning algorithms and will become a new technical solution for Chinese error correction. The engineering solution of "large model + small model" will become an extremely important and common application method in the field of natural language. However, in the process of carrying out Chinese error correction tasks, the large model will have hallucinations, be unable to output according to the prompt requirements, and lack accuracy and stability, resulting in the engineering application conditions of the large model in this scenario being immature. Therefore, the present invention is designed from three perspectives: multi-agent collaboration, retrieval enhancement, and closed-loop feedback, to solve the hidden dangers that arise in the mode of a single large model and a single detection, and improve overall accuracy and usability. The Chinese error correction method and system based on multi-agent collaboration and retrieval enhancement provided in this application can be applied to application scenarios such as security review of Chinese content on Internet platforms, manuscript proofreading, Chinese language learning, and image and text recognition detection.
[0071] The first embodiment of the present application discloses a method for evaluating the content security capability of a large model, comprising the following steps:
[0072] Step 1: Based on the large language model and agent prompting project, build multiple Chinese error correction expert agents and one Chinese error correction referee agent, such as Figure 2 As shown;
[0073] The large language model includes but is not limited to Chinese open source large language models such as DeepSeek, ChatGLM, Baichuan, and Qwen. The types of the multiple Chinese error correction expert agents include grammar error correction expert agents, vocabulary error correction expert agents, semantic error correction expert agents, and logic error correction expert agents.
[0074] The grammar error correction expert agent is used to process errors including structure, punctuation, tense, quantifiers and function words;
[0075] The lexical error correction expert agent is used to handle errors including collocation, synonyms, homophones, similar characters and pinyin;
[0076] The semantic error correction expert agent is used to handle errors including ambiguity, negation and unclear reference;
[0077] The logical error correction expert agent is good at handling errors including causality, inconsistency and event sequence;
[0078] The mth Chinese error correction expert agent is , where m=1,2,...,M.
[0079] The Chinese error correction referee agent is , which is used to comprehensively judge the output results of multiple Chinese error correction expert agents using voting or scoring mechanisms.
[0080] The agent prompting project includes 6 sub-projects, namely role-playing sub-project, thinking chain sub-project, sample prompting sub-project, task decomposition sub-project, self-consistency sub-project and reverse thinking sub-project;
[0081] The role-playing sub-project is used to make the large language model play the role of a corresponding Chinese error correction expert or Chinese error correction referee, so that its logical analysis and output results are focused and professional;
[0082] The thought chain project is used to guide the large language model to gradually reason about Chinese error correction, thereby improving the accuracy of complex Chinese error correction tasks;
[0083] The sample prompt sub-project is used to provide correct examples during the Chinese error correction process, facilitating the large language model to learn the task objectives;
[0084] The task decomposition sub-project is used to break down the complex Chinese error correction task into multiple simple tasks to assist the large language model in thinking;
[0085] The self-consistency sub-project is used to repeat the Chinese error correction task independently multiple times to reduce the impact of output probability;
[0086] The reverse thinking sub-project is used to compare the original text to be corrected in Chinese with the correction result, so that the large language model can review the correction result.
[0087] Step 2: Build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, access the Chinese error correction expert agent and the Chinese error correction referee agent, and use them for information retrieval by the Chinese error correction expert agent and the Chinese error correction referee agent, enhance the ability of context understanding, and realize the retrieval enhancement generation function, such as Figure 2 As shown;
[0088] The error correction text knowledge base is composed of error text and correct text, such as Figure 3 As shown in the figure, the data sources include but are not limited to open source SIGHAN2013, SIGHAN2014, SIGHAN2015, LEMON, CSCDNS, OCR and other error correction task datasets and manually annotated Internet text information datasets.
[0089] The vector database converts the corpus in the error correction text knowledge base into high-dimensional vectors for storage and retrieval through data extraction, text segmentation and vectorization steps, which facilitates the rapid retrieval of text data with high similarity to the input content vector and realizes the recall function. Figure 3 As shown in the figure, it is a database used to store, index, query and retrieve high-dimensional vector data. It can realize advanced analysis and similarity search that are difficult for traditional databases to complete. It is particularly suitable for processing unstructured data such as images, audio, and text, including mainstream vector databases such as Milvus, Qdrant, Weaviate, FAISS, and RediSearch; data extraction includes the process of obtaining useful information from unstructured or semi-structured data sources, using regular expressions, parsers, and text recognition technology; text segmentation is used to solve the text length limit, and a combination of semantic blocking and sliding windows is used to divide long texts into semantic units; vectorization is used to convert text data into multi-dimensional vectors to facilitate the model to understand semantic similarity. Common methods include BCEmbedding (an embedding and reordering model optimized for retrieval enhancement), BGEEmbedding (a universal text embedding model), and M3E (Moka Massive Mixed Embedding, a text embedding model).
[0090] Step 2 also includes Figure 3The retrieval enhancement recommendation system shown in the figure vectorizes the original text to be processed input by the user, retrieves data with high similarity in the vector database, sorts and summarizes the recall results, combines the original text to be processed input by the user into new prompt information, and inputs it into the Chinese error correction expert intelligent agent and the Chinese error correction referee intelligent agent to achieve the prompt enhancement effect.
[0091] Based on the prompting process, the agent also has the ability to generate enhanced retrieval data and can call the text knowledge base data mentioned in step 2. The generation temperature of the agent can be set to 0.3, the learning rate to 1e-5, the maximum number of generated tokens to 2048, and the number of search items to 10.
[0092] Step 3: Design detection prompts, discrimination prompts and feedback prompts, build a multi-agent closed-loop feedback module, realize information coordination, step-by-step reasoning, result verification and iterative optimization of each agent, and complete the Chinese error correction task. Specifically, the detection prompt is as follows: Figure 4 As shown, the discrimination prompt is as follows Figure 5 As shown, the feedback prompt is as follows Figure 6 As shown. Figure 1 As shown, step 3 includes:
[0093] Step 3-1: merge the original text to be processed and the detection prompt information, input it into the Chinese error correction expert agent for processing, and output the detection results; including:
[0094] Set the original text to be processed for:
[0095]
[0096] Where N is the character length of the original text X to be processed, , Represents the nth character of text X;
[0097] Set the detection prompt information to P, then enter the detection prompt text of the Chinese error correction expert agent for:
[0098]
[0099] Where, Merge() is a merging function that merges the detection prompt information with the text to be processed;
[0100] Set the correct judgment result for , Bool value, indicating a character Is it correct? The correct error correction result is , For characters The corresponding correct error correction characters satisfy:
[0101]
[0102] The processing process of the Chinese error correction expert agent is as follows:
[0103]
[0104] Where, It is the processing function of the Chinese error correction expert agent. This is the judgment result of the Chinese error correction expert agent. It is a Bool value, indicating that the Chinese error correction expert agent is correcting the character The judgment result of correctness; This is the error correction result of the Chinese error correction expert agent. For characters The error correction result of the mth Chinese error correction expert agent is , , M represents the number of Chinese error correction expert agents.
[0105] Step 3-2: Combine the output results and judgment prompt information of all Chinese error correction expert agents, input them into the Chinese error correction referee agent for processing, and output the judgment results and error correction results; specifically, it includes:
[0106] For the judgment result processing, the Chinese error correction referee agent adopts a voting scheme to count the judgment results of each Chinese error correction expert agent and select the one with the largest number as the final judgment result, namely:
[0107]
[0108] Where, is a Bool value, indicating the judgment result of the Chinese error correction referee agent; if , judge that there is no error in the original text X and enter the end phase; if , determine that there are errors in the original text X and enter error correction;
[0109] Regarding the error correction results, the Chinese error correction referee agent uses its own understanding ability to analyze and score the error correction results of each Chinese error correction expert agent. In the specific implementation process, the score can be required to be 0-10 points, with 0 points for completely not meeting the requirements, 5 points for problems but not affecting understanding, and 10 points for correct completion. Then:
[0110]
[0111]
[0112] In the formula, Score() is a scoring model, and the referee agent scores based on the requirements set by the prompt words from the error correction results. The conclusion of the mth Chinese error correction expert agent corresponds to the score. , the Chinese error correction expert agent with the highest score among all Chinese error correction expert agents is , the corresponding score is ;
[0113] Set the score threshold S Th And the feedback iteration threshold K:
[0114] (1) When When , the error correction result of the highest-scoring Chinese error correction expert agent is the final error correction result and enters the output link; k represents the number of feedback iterations;
[0115] (2) When When the error correction result of the highest-scoring Chinese error correction expert agent cannot be used as the final error correction result, step 3-3 is executed to enter the feedback link.
[0116] Step 3-3: If the error correction result of the Chinese error correction referee agent cannot be used as the final error correction result, the output results and feedback prompt information of all Chinese error correction expert agents and Chinese error correction referee agents are merged, and the results are input into the Chinese error correction expert agent for processing again, and step 3-1 is executed again. , and finally output the detection results.
[0117] The information coordination, step-by-step reasoning, result verification and iterative optimization of each intelligent agent include: solving the deviation problem existing in a single intelligent agent and a single round of error correction by utilizing the Chinese language understanding and processing capabilities of multiple intelligent agents, and improving the overall error correction accuracy by comparing and learning multiple output results; regularly organizing business experts to manually judge the results, and updating newly discovered and characteristic samples to the error correction text knowledge base.
[0118] The second embodiment of the present application discloses a Chinese error correction system based on multi-agent collaboration and retrieval enhancement, which is characterized by comprising an agent construction module, a retrieval enhancement module and a multi-agent closed-loop feedback module.
[0119] The agent building module is used to build multiple Chinese error correction expert agents and one Chinese error correction referee agent based on the large language model and agent prompt engineering;
[0120] The retrieval enhancement module is used to build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, and access the Chinese error correction expert agent and the Chinese error correction referee agent;
[0121] The multi-agent closed-loop feedback module is used to achieve information collaboration, step-by-step reasoning, result verification and iterative optimization of each agent based on the designed detection prompts, discrimination prompts and feedback prompts, and complete the Chinese error correction task.
[0122] In a specific implementation, the present application provides a computer storage medium and a corresponding data processing unit, wherein the computer storage medium is capable of storing a computer program that, when executed by the data processing unit, executes the invention of a Chinese error correction method based on multi-agent collaboration and retrieval enhancement provided by the present invention, as well as some or all of the steps in each embodiment. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0123] Those skilled in the art will clearly understand that the technical solutions in the embodiments of the present invention can be implemented using computer programs and their corresponding general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a computer program, i.e., a software product. This computer program software product can be stored in a storage medium and includes a number of instructions for enabling a device including a data processing unit (such as a personal computer, server, single-chip microcomputer, MUU, or network device) to execute the methods described in various embodiments of the present invention or certain portions of these embodiments.
[0124] The present invention provides a Chinese error correction method and system based on multi-agent collaboration and enhanced retrieval. There are many methods and approaches to implement this technical solution. The above is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and such improvements and modifications should also be considered within the scope of protection of the present invention. Any components not specified in this embodiment may be implemented using existing technologies.
Claims
1. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement, characterized in that: The following steps are involved: Step 1: Based on the large language model and agent prompting project, build multiple Chinese error correction expert agents and one Chinese error correction referee agent; Step 2: Build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, access the Chinese error correction expert agent and the Chinese error correction referee agent, and use them for information retrieval by the Chinese error correction expert agent and the Chinese error correction referee agent, thereby enhancing the ability to understand the context and realizing the retrieval enhancement generation function; Step 3: Design detection prompts, discrimination prompts, and feedback prompts, build a multi-agent closed-loop feedback module, and achieve information collaboration, step-by-step reasoning, result verification, and iterative optimization among all agents to complete the Chinese error correction task; The types of the multiple Chinese error correction expert agents described in step 1 include grammatical error correction expert agents, vocabulary error correction expert agents, semantic error correction expert agents and logical error correction expert agents. The grammar error correction expert agent is used to process errors including structure, punctuation, tense, quantifiers and function words; The lexical error correction expert agent is used to handle errors including collocation, synonyms, homophones, similar characters and pinyin; The semantic error correction expert agent is used to handle errors including ambiguity, negation and unclear reference; The logical error correction expert agent is good at handling errors including causality, inconsistency and event sequence; The Chinese error correction referee intelligent agent is used to adopt a voting mechanism or a scoring mechanism to comprehensively judge the output results of multiple Chinese error correction expert intelligent agents.
2. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 1, characterized in that: In step 3, a multi-agent closed-loop feedback module is constructed, including: Step 3-1: merge the original text to be processed and the detection prompt information, input it into the Chinese error correction expert agent for processing, and output the detection result; Step 3-2: Combine the output results and judgment prompt information of all Chinese error correction expert agents, input them into the Chinese error correction referee agent for processing, and output the judgment results and error correction results; Step 3-3: If the error correction result of the Chinese error correction referee agent cannot be used as the final error correction result, the output results and feedback prompt information of all Chinese error correction expert agents and Chinese error correction referee agents are merged, and input into the Chinese error correction expert agent for processing again to output the detection result.
3. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 2, characterized in that: Step 3-1 includes: Set the original text to be processed for: , Where N is the character length of the original text X to be processed, , Represents the nth character of text X; Set the detection prompt information to P, then enter the detection prompt text of the Chinese error correction expert agent for: , Where, Merge() is a merging function that merges the detection prompt information with the text to be processed; Set the correct judgment result , Bool value, indicating a character Is it correct? Correct error correction result , For characters The corresponding correct error correction characters satisfy: , The processing process of the Chinese error correction expert agent is as follows: , Where, It is the processing function of the Chinese error correction expert agent. This is the judgment result of the Chinese error correction expert agent. It is a Bool value, indicating that the Chinese error correction expert agent is correcting the character The judgment result of correctness; This is the error correction result of the Chinese error correction expert agent. For characters The error correction result of the mth Chinese error correction expert agent is , , M represents the number of Chinese error correction expert agents.
4. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 3, characterized in that: Step 3-2 includes: For the judgment result processing, the Chinese error correction referee agent adopts a voting scheme to count the judgment results of each Chinese error correction expert agent and select the one with the largest number as the final judgment result, namely: , Where, is a Bool value, indicating the judgment result of the Chinese error correction referee agent; if , judge that there is no error in the original text X and enter the end phase; if , determine that there are errors in the original text X and enter error correction; Regarding the error correction results, the Chinese error correction referee agent uses its own understanding ability to analyze and score the error correction results of each Chinese error correction expert agent. , , In the formula, Score() is the scoring model, and the conclusion of the mth Chinese error correction expert agent corresponds to the score , the Chinese error correction expert agent with the highest score among all Chinese error correction expert agents is , the corresponding score is ; Set the score threshold S Th And the feedback iteration threshold K: (1) When When , the error correction result of the highest-scoring Chinese error correction expert agent is the final error correction result and enters the output link; k represents the number of feedback iterations; (2) When When the error correction result of the highest-scoring Chinese error correction expert agent cannot be used as the final error correction result, step 3-3 is executed to enter the feedback phase; In step 3-3, if the error correction result of the Chinese error correction referee agent cannot be used as the final error correction result, the output results and feedback prompt information of all Chinese error correction expert agents and Chinese error correction referee agents are merged, and the results are input into the Chinese error correction expert agent for processing again, and step 3-1 is executed again, and .
5. The Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 4 is characterized in that: The information coordination, step-by-step reasoning, result verification and iterative optimization of each intelligent agent described in step 3 include: solving the deviation problem existing in single-agent and single-round error correction by utilizing the Chinese language understanding and processing capabilities of multiple intelligent agents, and improving the overall error correction accuracy by comparing and learning multiple output results; regularly organizing business experts to manually judge the results and update newly discovered and characteristic samples to the error correction text knowledge base.
6. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 5, characterized in that: In step 1, the agent prompting project includes 6 sub-projects, namely, role-playing sub-project, thought chain sub-project, sample prompting sub-project, task decomposition sub-project, self-consistency sub-project and reverse thinking sub-project; The role-playing sub-project is used to make the large language model play the role of a corresponding Chinese error correction expert or Chinese error correction referee, so that its logical analysis and output results are focused and professional; The thought chain project is used to guide the large language model to gradually reason about Chinese error correction, thereby improving the accuracy of complex Chinese error correction tasks; The sample prompt sub-project is used to provide correct examples during the Chinese error correction process, facilitating the large language model to learn the task objectives; The task decomposition sub-project is used to break down the complex Chinese error correction task into multiple simple tasks to assist the large language model in thinking; The self-consistency sub-project is used to repeat the Chinese error correction task independently multiple times to reduce the impact of output probability; The reverse thinking sub-project is used to compare the original text to be corrected in Chinese with the correction result, so that the large language model can review the correction result.
7. A Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 6, characterized in that: The error correction text knowledge base in step 2 is composed of error texts and correct texts; The vector database converts the corpus in the error correction text knowledge base into high-dimensional vectors for storage and retrieval through data extraction, text segmentation and vectorization steps; data extraction includes the process of obtaining useful information from unstructured or semi-structured data sources, using regular expressions, parsers, and text recognition technology; text segmentation is used to solve the text length limit, using a combination of semantic block segmentation and sliding windows to divide long texts into semantic units; vectorization is used to convert text data into multidimensional vectors.
8. The Chinese error correction method based on multi-agent collaboration and retrieval enhancement according to claim 7 is characterized in that: Step 2 also includes vectorizing the original text to be processed input by the user, retrieving data with high similarity in the vector database, sorting and summarizing the recall results, combining the original text to be processed input by the user into new prompt information, and inputting it into the Chinese error correction expert intelligent agent and the Chinese error correction referee intelligent agent to achieve prompt enhancement effect.
9. A Chinese error correction system based on multi-agent collaboration and retrieval enhancement, characterized in that: Including agent building module, retrieval enhancement module and multi-agent closed-loop feedback module, The agent building module is used to build multiple Chinese error correction expert agents and one Chinese error correction referee agent based on the large language model and agent prompt engineering; The retrieval enhancement module is used to build a knowledge base of error correction texts, convert the corpus in the knowledge base into a vector database, and access the Chinese error correction expert agent and the Chinese error correction referee agent; The multi-agent closed-loop feedback module is used to achieve information collaboration, step-by-step reasoning, result verification and iterative optimization among the agents based on the designed detection prompts, discrimination prompts and feedback prompts, and complete the Chinese error correction task; The types of the multiple Chinese error correction expert agents include grammar error correction expert agents, vocabulary error correction expert agents, semantic error correction expert agents and logic error correction expert agents. The grammar error correction expert agent is used to process errors including structure, punctuation, tense, quantifiers and function words; The lexical error correction expert agent is used to handle errors including collocation, synonyms, homophones, similar characters and pinyin; The semantic error correction expert agent is used to handle errors including ambiguity, negation and unclear reference; The logical error correction expert agent is good at handling errors including causality, inconsistency and event sequence; The Chinese error correction referee intelligent agent is used to adopt a voting mechanism or a scoring mechanism to comprehensively judge the output results of multiple Chinese error correction expert intelligent agents.
Citation Information
Patent Citations
Self-error-correction retrieval enhancement agent system
CN120278144A
Computer implemented methods and apparatus for testing a telecommunications management network (TMN) agent
EP0843441A2
Cited By
A text sequence correction model training and correction method, device, equipment and medium
CN122655749A