Method and system for improving stability and question and answer accuracy of large language model driven software
By constructing a multi-stage detection and repair mechanism in the runtime middle layer, the crash problem of large language model-driven software when handling abnormal files was solved, the accuracy and stability of question answering were improved, and non-intrusive deployment and efficient engineering integration were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- EAST CHINA NORMAL UNIV
- Filing Date
- 2026-03-05
- Publication Date
- 2026-05-19
Smart Images

Figure CN122064798A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fault-tolerant integration technology, and relates to the fields of artificial intelligence and natural language processing technology. Specifically, it relates to a method and system that enables large language model software to avoid runtime crashes when processing abnormal files and improve the accuracy of file-based question answering through a fault-tolerant processing mechanism. Background Technology
[0002] In recent years, with the rapid development of large language models, a new type of "large language model-driven" software has emerged. This software uses large language models as core components to perform various tasks. Many of these programs support users uploading files and answering questions based on those files. However, due to the inherent non-determinism and open output of large language models, as well as flaws in software architecture design, their output often fails to meet user needs, and the accuracy of their answers urgently needs improvement. Furthermore, abnormal file input can directly trigger software crashes, and their stability also urgently needs enhancement.
[0003] These issues concern the application value and user trust of large language model-driven software. The core demand of users uploading files for consultation is to rely on tools to accurately extract and reliably interpret information from specific documents, with application scenarios covering key areas such as academic research, business analysis, and professional decision-making. Output deviations or errors not only lead to information distortion and increased time costs, but may also cause risks such as inaccurate academic conclusions and flawed business judgments. This contradicts the original design intent of improving efficiency, undermines user trust, and hinders the large-scale deployment of the technology.
[0004] Existing methods mostly focus on improving the model itself, without offering solutions for enhancing the stability and accuracy of existing software. If there are weaknesses at the application layer, even with comprehensive model optimization, overall performance will be limited. Furthermore, current methods for categorizing incorrect answers in forms are based on question type or form length, without delving into the underlying causes of errors.
[0005] Retrieval-enhanced generation (RAG) methods are widely used in existing large language model-driven question-answering systems. This technique involves splitting large-scale documents into multiple text fragments and building a vector retrieval index. When a user asks a question, the system first retrieves relevant text fragments and then uses these fragments as context input to the large language model to generate the answer. This retrieval-enhanced approach significantly improves the accuracy and information coverage of question-answering, especially suitable for handling long texts and large-scale knowledge bases. However, RAG methods typically rely on complex vector retrieval architectures and document segmentation strategies, increasing the design and maintenance costs of the system. Furthermore, RAG solutions lack an effective and unified file representation mechanism when dealing with files of diverse formats and complex structures, making it difficult to fully utilize the structured information contained within the files. In addition, existing RAG technologies have not provided a systematic solution to the stability issues of large language model-driven intelligent agents during runtime, which can easily lead to runtime crashes or abnormal terminations, affecting the overall user experience.
[0006] In summary, while RAG, as a typical retrieval-enhanced question-answering technology, has made significant progress in improving model answer accuracy, it still has shortcomings in agent stability assurance and the universality of cross-format file representation. Therefore, further research and improvement of stability enhancement mechanisms and unified file format processing methods have significant technical and practical value. Existing technologies have not yet proposed a systematic, runtime-automatic intervention method for large language model-driven software; this invention aims to fill this technological gap and propose an innovative solution. Furthermore, to improve the software's ability to answer user questions, this paper also proposes a table-based error reason classification method, providing guidance for tool implementation. Summary of the Invention
[0007] This invention relates to the fields of artificial intelligence and natural language processing, specifically to a method and system for improving the stability of large language model-driven software and the accuracy of document-based question answering.
[0008] The closest technical solution to this invention is a "Document Question Answering Method Based on Retrieval Enhanced Generation (RAG)". In existing technologies, the Retrieval Enhanced Generation (RAG) method segments documents into blocks, establishes a vector database, and retrieves relevant fragments as input to the LLM during question answering. Representative works include REALM and RAG. Current methods primarily focus on the large model itself, while the software aspect remains largely unexplored. To address the shortcomings of existing technologies, the purpose of this invention is to provide a method, system, and application to alleviate runtime integration failures in large language model-driven software. Specifically, through a fault-tolerant mechanism, the large language model software can avoid runtime crashes when handling abnormal files, while ensuring the accuracy of question answers. The abnormal files in this invention are essentially empty files or table files containing null values, which can directly cause runtime crashes in the large language model software.
[0009] The method proposed in this invention for improving the stability and question-answering accuracy of large language model-driven software, based on a runtime intermediate layer, constructs a multi-stage detection and repair mechanism to optimize and adapt input files and questions, and checks the output results, including the following steps:
[0010] Step A, Input Preprocessing: Perform dual-channel preprocessing on the file and the question, and detect abnormal files and constrain the scope of the answer through format compatibility and instruction injection;
[0011] Step B, Dynamic Routing: Dynamically route based on document format and problem intent, employing multiple strategies including code generation for content transformation and solution;
[0012] Step C, Result Verification and Self-Correction: Through retry and logical consistency check mechanisms, the output results are verified and self-corrected to ensure the reliability of the conclusions.
[0013] Step A of this invention includes the following sub-steps:
[0014] Step A1: First, check if the incoming file is an abnormal file. If it is, prevent the file from entering the application and give the user a prompt. Otherwise, proceed to step A2.
[0015] In step A1, before the file is entered into the large language model software, it is checked whether it is an empty file. If it is a multi-page file, it is necessary to check whether each page has content and there are no blank pages.
[0016] Step A2: Obtain the file format and encoding format accepted by the application, modify the file, extend format compatibility, and convert the file encoding;
[0017] Step A3: On the question side, inject specific instruction prompts, strictly constraining the agent to generate an answer within the given file scope. The instructions in this invention are universal for all file types, and specifically take the form of a text string: "".
[0018] Step B of the present invention includes the following sub-steps:
[0019] Step B1: Identify the file format of the incoming file by its extension. If it is plain text, leave it unchanged; if it is HTML, proceed to B2; if it is a table document, proceed to B3.
[0020] Step B2: Automatically remove tags from the HTML file and convert it into well-structured plain text;
[0021] Step B3: The table file then activates a more refined, problem-intention-based secondary processing pipeline.
[0022] Furthermore, the secondary processing pipeline based on problem intent described in step B3 includes:
[0023] Step B31: First, the large language model needs to be used to determine the intent of the question. If it is a sequence question, proceed to B32; if it is a counting question, proceed to B33; if it is another question, proceed to B34.
[0024] This invention categorizes sequence-related problems as problems of order, such as what is before and after in a column, what is the first row of a table, what is the last row, etc. Sorting problems also fall into this category. Counting problems refer to quantitative statistics, such as how many people in a table meet a certain requirement, or how to list all people who meet the requirements.
[0025] Step B32: For sequential problems, we will optimize the problem to make it easier for the large language model to understand the meaning of the problem. Proceed to B34.
[0026] Step B33: For counting problems, a large language model will be used to generate code. The code will be automatically compiled to try to get the answer. If the output is normal, it will be taken as the answer; otherwise, proceed to B34.
[0027] Step B34: Convert the table to text format, and then pass the processed file and the text file into the application.
[0028] Furthermore, step B33, which involves generating code using a large language model and attempting to obtain the answer through automatic compilation, includes:
[0029] Step B331: Obtain column name information by reading the first row of the CSV file and convert all column names to lowercase format to provide accurate field references for subsequent code generation;
[0030] Step B332: Construct request parameters for a large language model and set strict code generation rules. The system prompts explicitly require the use of a specified encoding to read the file, uniform case conversion, standardized numerical processing flow, and code generation based on the actual column names. When the column names do not match, null should be returned.
[0031] Step B333: Receive the code returned by the model and perform multiple validations. First, check if the code contains the keyword "null" and necessary file reading statements. Then, extract all column names used in the code using regular expressions and verify if they exist in the actual column name list. If any validation fails, return null.
[0032] Step B334: Set up an exception handling mechanism throughout the process to ensure that when an error is encountered, a prompt message is output and null is returned to ensure the stable operation of the system;
[0033] In this invention, errors are captured: it is normal for the generated code to not run. There will be a catch mechanism to catch all execution failure exceptions. As long as the execution fails, null will be returned. If null is received later, it will know that the code generation scheme has failed and the path of normal operation, i.e., generating the answer using the large model, will still be followed.
[0034] Step B335: Execute the generated code automatically to obtain the final result.
[0035] Step C of the present invention includes the following sub-steps:
[0036] Step C1: Check the obtained answer. If it is blank, let the application run it again. If the answer is still blank the second time, prompt the user that there is an error in the application and ask them to try other inputs.
[0037] Step C2: If the answer is not empty, use the large language model to check whether the reasoning process and the conclusion conflict. If there is a conflict, adjust the conclusion to be consistent with the reasoning process.
[0038] This invention only requires telling the large language model whether the process and conclusion need to be checked for conflict, and the large model can make the judgment automatically. Because the task is very simple, there is no need to set specific rules, and the task can be completed by relying on the capabilities of the large model.
[0039] Based on the above methods, this invention also proposes a system for improving the stability and question-answering accuracy of large language model-driven software, including: an intermediate layer module; wherein, the intermediate layer module is used to intercept output and perform detection and repair between AI components and user input, realizing the entire process of input preprocessing, dynamic processing routing, result verification and self-correction.
[0040] The beneficial effects of the method and system proposed in this invention for improving the stability and question-answering accuracy of large language model-driven software include:
[0041] 1. This system extracts user input and automatically converts files into application-compatible encodings and formats, improving versatility and stability;
[0042] 2. Preprocessing potential problems helps large language models answer questions better based on documents, thus improving accuracy;
[0043] 3. This system employs a non-intrusive deployment method, which improves ease of use and engineering integration efficiency;
[0044] 4. This invention employs a low-overhead runtime instrumentation mechanism to achieve efficient deployment and execution without intruding on business logic code;
[0045] 5. In order to improve the accuracy of answering questions about documents, this invention proposes a method for classifying incorrect answers to form documents. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a schematic diagram of the overall architecture of Lotus, the runtime adaptation system proposed in this invention.
[0048] Figure 2 This is a schematic diagram illustrating the errors encountered when using Quivr before integrating the system of this invention.
[0049] Figure 3 This is an error classification diagram based on table-based question and answer proposed in this invention. Detailed Implementation
[0050] The present invention will be further described in detail below with reference to the specific embodiments and accompanying drawings. Except for the contents specifically mentioned below, the processes, conditions, and experimental methods for implementing the present invention are all common knowledge and general knowledge in the art, and the present invention does not have any particular limitations.
[0051] This invention discloses a method for improving the stability and question-answering accuracy of large language model-driven software. The method is based on a runtime intermediate layer that constructs a multi-stage detection and repair mechanism to optimize and adapt input files and questions, and to check the output results. The method includes: Step 1, Input Preprocessing: Dual-path preprocessing of files and questions is performed, using format compatibility and instruction injection to detect abnormal files and constrain the answer range. Step 2, Dynamic Routing: Dynamic routing is performed based on document format and question intent, employing multiple strategies, including code generation, for content conversion and solving. Step 3, Result Verification and Self-Correction: Through retry and logical consistency checks, the output results are verified and self-corrected to ensure reliable conclusions. This invention also discloses a system for implementing the above method, which has broad application value.
[0052] The method of the present invention includes:
[0053] 1. Document Segmentation: Dividing long documents or large-scale knowledge bases into shorter text blocks for efficient subsequent indexing and retrieval. Segmentation is typically based on semantics, paragraphs, or fixed length, providing unit text for vector retrieval.
[0054] 2. Vectorization and Index Building: A pre-trained encoder model is used to convert the segmented text blocks into vector representations, which are then used to build a vector database index. This enables fast semantic similarity search.
[0055] 3. Relevant Text Retrieval: In the question-and-answer process, when a user asks a question, the question is converted into a vector, and based on similarity, several text blocks most relevant to the question are quickly retrieved from the vector database as context.
[0056] 4. Generative Response: Input the retrieved relevant text blocks along with the user's question into the Large Language Model (LLM), and output the final answer through the generative model to complete the question answering task.
[0057] This invention provides a method for large language model software to avoid runtime crashes when processing abnormal files and to ensure the accuracy of answering questions through a fault-tolerant processing mechanism. The method is based on a runtime intermediate layer that constructs a multi-stage detection and repair mechanism to optimize and adapt the input files and questions, and to check the output results; including:
[0058] Step 1: Input preprocessing. Perform dual preprocessing on the file and the question. Detect abnormal files and constrain the scope of the answer through format compatibility and instruction injection.
[0059] Step 2: Dynamically process routing. Based on the document format and problem intent, dynamically route the content, using multiple strategies including code generation for content transformation and solution.
[0060] Step 3: Result verification and self-correction. Through retry and logical consistency check mechanisms, the output results are verified and self-corrected to ensure the reliability of the conclusions.
[0061] Step one further includes:
[0062] Step A1: First, check if the incoming file is an abnormal file. If so, prevent the file from entering the application and provide the user with a notification. Otherwise, proceed to Step A2.
[0063] Step A2: Obtain the file format and encoding format accepted by the application, modify the file, expand format compatibility, and convert the file encoding.
[0064] Step A3: On the question side, inject specific instruction prompts to strictly constrain the agent to generate answers within the scope of the given file.
[0065] Step two further includes:
[0066] Step B1: Identify the file format of the incoming file by its extension. If it is plain text, leave it unchanged. If it is HTML, proceed to B2. If it is a table document, proceed to B3.
[0067] Step B2: Automatically remove tags from the HTML file and convert it into well-structured plain text.
[0068] Step B3 activates a more refined, problem-intention-based secondary processing pipeline for the table file.
[0069] Step B3 activates a more refined, problem-intent-based secondary processing pipeline for the table file, including:
[0070] Step C1: First, use a large language model to determine the intent of the question. If it is a sequence problem, proceed to C2; if it is a counting problem, proceed to C3; if it is another type of problem, proceed to C4.
[0071] Step C2, for sequential problems, will optimize the problem to make it easier for the large language model to understand the meaning of the problem, and then proceed to C4.
[0072] Step C3: For counting problems, a large language model will be used to generate code. The code will be automatically compiled to try to get the answer. If the output is normal, it will be taken as the answer; otherwise, proceed to C4.
[0073] Step C4: Convert the table to text format, and then import the processed file and the text file into the application.
[0074] Step C3 uses a large language model to generate code and attempts to obtain the answer through automatic compilation, including:
[0075] Step D1: Obtain column name information by reading the first row of the CSV file and convert all column names to lowercase format to provide accurate field references for subsequent code generation.
[0076] Step D2: Construct request parameters for a large language model and set strict code generation rules. The system prompts explicitly require the use of a specified encoding to read the file, uniform case conversion, standardized numerical processing flow, and code generation based on actual column names. When column names do not match, null should be returned.
[0077] Step D3: Receive the code returned by the model and perform multiple validations. First, check if the code contains the keyword "null" and necessary file reading statements. Then, extract all column names used in the code using regular expressions and verify if they exist in the actual column name list. If any validation fails, return null.
[0078] Step D4: Set up an exception handling mechanism throughout the process to ensure that when an error is encountered, a prompt message is output and null is returned, thus ensuring the stable operation of the system.
[0079] Step D5: The generated code will be executed automatically to obtain the final result.
[0080] Step three further includes:
[0081] Step E1: Check the obtained answer. If it is blank, run the application again. If the answer is still blank the second time, prompt the user that there is an error in the application and ask them to try other inputs.
[0082] Step E2: If the answer is not empty, use the large language model to check whether the reasoning process and the conclusion conflict. If there is a conflict, adjust the conclusion to be consistent with the reasoning process.
[0083] A system for improving the stability and answer accuracy of large language model-driven software, through a fault-tolerance mechanism, enables the large language model software to avoid runtime crashes when handling abnormal files and ensures the accuracy of answering questions. The system is used to implement the method described in this invention and includes: an intermediate layer module; the intermediate layer module is used to intercept output and perform detection and repair between AI components and user input.
[0084] Example 1: Error Repair in Table-Based Question Answering Application Quivr
[0085] Implementation Environment
[0086] Application: Quivr application
[0087] Large model: DeepSeek-V3.2-Exp
[0088] Programming language: Python 3.11
[0089] Framework: LangChain
[0090] Hardware configuration: M3 Max CPU (4.05GHz, 16-core), 32MB L2 Cache, 64GB RAM
[0091] Network connection: 1000Mbps
[0092] Problem Description
[0093] When Quivr receives a table file as input, it treats each row of the table as a separate file. During the filtering process, it can only select 20 entries to send to the larger model. Because the larger model receives incomplete and disordered information, the accuracy of its answers is difficult to meet the user's needs.
[0094] Operating steps
[0095] Step 1: The software runs independently without any additional tools.
[0096] (1) Testing software
[0097] (2) Calculate the accuracy rate and classify the causes of errors.
[0098] Step 2: Deploy the runtime middleware layer
[0099] (1) Add the @lotus_decorator decorator to the main function call entry function of Quivr.
[0100] (2) Answer the questions according to the process of preprocessing → dynamic routing → software operation → result verification and self-correction.
[0101] (3) Calculate the accuracy rate and classify the causes of errors.
[0102] Step 3: Accuracy Comparison
[0103] Input 200 QA test cases and perform tests with and without patches, comparing the changes in accuracy between the two cases.
[0104] Results data
[0105] Original software accuracy: 110 out of 200 test cases were answered correctly, with an accuracy of 55%.
[0106] Accuracy after patching: 152 out of 200 test cases were answered correctly, with an accuracy of 76%.
[0107] Overall improvement: Quivr's accuracy in answering questions increased from 55% to 76%.
[0108] Example 2: File compatibility and anomaly detection and repair in Robby-Chatbot, an application based on file-based question answering.
[0109] Implementation Environment
[0110] Application: Robby-Chatbot app
[0111] Large model: DeepSeek-V3.2-Exp
[0112] Programming language: Python 3.11
[0113] Framework: LangChain
[0114] Hardware configuration: M3 Max CPU (4.05GHz, 16-core), 32MB L2 Cache, 64GB RAM
[0115] Network connection: 1000Mbps
[0116] Problem Description
[0117] Robby-Chatbot can only accept certain file formats as input, such as CSV, TXT, and HTML files. It cannot accept other file formats such as XLSX and Markdown. Furthermore, the software is unstable; encountering abnormal files, such as blank files or files with encoding inconsistent with the software, can easily cause it to crash.
[0118] Operating steps
[0119] Step 1: The software runs independently without any additional tools.
[0120] (1) Testing software;
[0121] (2) Count the number of error cases.
[0122] Step 2: Deploy the runtime middleware layer
[0123] (1) Add the @lotus_decorator decorator to the main function call entry function of Robby-Chatbot;
[0124] (2) Count the number of error reports.
[0125] Step 3: Accuracy Comparison
[0126] Input 200 abnormal or incompatible files as test cases, and perform tests with and without patches, comparing the changes in the number of error cases between the two cases.
[0127] Results data
[0128] Original software accuracy: In 200 test cases, all exceptions, inconsistent encoding, and incompatible file formats caused the program to crash.
[0129] Accuracy after patching: All test cases passed out of 200 test cases.
[0130] In summary, this invention effectively helps improve the stability and compatibility of software.
[0131] Those skilled in the art will understand that the embodiments of this application can be implemented as methods, systems, or computer program products. Therefore, this application can take the form of pure hardware embodiments, pure software embodiments, or embodiments combining hardware and software; it can also take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.), and can be implemented through various computer languages such as Java and JavaScript.
[0132] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks, can be implemented by computer program instructions. These instructions are provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to generate a machine such that instructions executable by the processor generate instructions for implementing the flowchart. Figure 1 One or more processes, boxes Figure 1 Devices that specify functions in one or more boxes.
[0133] These computer program instructions may also be stored in a computer-readable storage medium that enables a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the storage medium generate an article of manufacture containing instruction means that can implement a process. Figure 1 One or more processes, boxes Figure 1 The functions specified in one or more boxes.
[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on that device to achieve computer processing, thereby providing an implementation flow for the instructions executed on the device. Figure 1 One or more processes, boxes Figure 1The steps that specify the function in one or more boxes.
[0135] Although preferred embodiments of this application have been described, those skilled in the art, once they grasp the basic inventive concept, can make further changes and modifications to these embodiments. Therefore, the appended claims are intended to cover the preferred embodiments as well as all changes and modifications falling within the scope of protection of this application.
[0136] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of protection of this application. If such modifications and variations fall within the scope of protection of the claims of this application and their equivalents, this application is also intended to include such modifications and variations.
[0137] The scope of protection of this invention is not limited to the above embodiments. All variations and advantages that can be conceived by those skilled in the art without departing from the spirit and scope of this invention are included within the scope of protection of this invention, which is defined by the appended claims.
[0138] References
[0139] [1]Tan J, Dou Z, Wang W, et al. Htmlrag: Html is better than plaintext for modeling retrieved knowledge in rag systems[C] / / Proceedings of theACM on Web Conference 2025. 2025: 1733-1746.
[0140] [2]Shao Y, Huang Y, Shen J, et al. Are llms correctly integrated into software systems?[J]. arXiv preprint arXiv:2407.05138, 2024.
[0141] [3]Shao Y, Huang Y, Zou J, et al. Comfrey: Mitigating IntegrationFailures in LLM-enabled Software at Run-Time[J]. 2026.
[0142] [4]Dong H, Zhao J, Tian Y, et al. Spreadsheetllm: Encodingspreadsheets for large language models[J]. arXiv preprint arXiv:2407.09025,2024.
[0143] [5]Pasupat P, Liang P. Compositional semantic parsing on semi-structured tables[C] / / Proceedings of the 53rd Annual Meeting of theAssociation for Computational Linguistics and the 7th International JointConference on Natural Language Processing (Volume 1: Long Papers). 2015:1470-1480.
[0144] [6]Gao Y, Liu Y, Li X, et al. XIYAN-SQL: AMulti-GENERATOR ENSEMBLEFRAMEWORK FOR TEXT-TO-SQL[J]. arXiv preprint arXiv:2411.08599, 2024.
[0145] [7]Pasupat P, Liang P. Compositional semantic parsing on semi-structured tables[C] / / Proceedings of the 53rd Annual Meeting of theAssociation for Computational Linguistics and the 7th International JointConference on Natural Language Processing (Volume 1: Long Papers). 2015:1470-1480.
[0146] [8]Raj M, Srinivasan R. AI-powered Document Chatbot for dataretrieval[C] / / International Conference on Intelligent Systems and DigitalTransformation (ICISD 2025). Atlantis Press, 2025: 668-681.
[0147] [9]Osnabrück, Institute of Cognitive Science, 2025, Publications ofthe Institute of Cognitive Science 2025, Number 3
[0148]
[10] Zhang S, Shao H, Xie Z. Improving Conversational LiteratureRetrieval Quality via Personalized Profile-Based Re-ranking. IEEE J BiomedHealth Inform. 2026 Mar 3;PP. doi: 10.1109 / JBHI.2026.3669741. Epub ahead ofprint. PMID: 41774624。
Claims
1. A method for improving the stability and question-answering accuracy of large language model-driven software, characterized in that, Includes the following steps: Step A, Input Preprocessing: Perform dual preprocessing on the file and the question, and detect abnormal files through format compatibility and instruction injection to constrain the scope of the answer; Step B, Dynamic Routing: Dynamically route based on document format and problem intent, employing multiple strategies including code generation for content transformation and solution; Step C, Result Verification and Self-Correction: Through retry and logical consistency check mechanisms, the output results are verified and self-corrected to ensure the reliability of the conclusions.
2. The method for improving the stability and question-answering accuracy of large language model-driven software as described in claim 1, characterized in that, Step A includes the following sub-steps: Step A1: First, check if the incoming file is an abnormal file. If it is, prevent the file from entering the application and give the user a prompt. Otherwise, proceed to step A2. Step A2: Obtain the file format and encoding format accepted by the application, modify the file, extend format compatibility, and convert the file encoding; Step A3: On the question side, inject specific instruction prompts to strictly constrain the agent to generate answers within the scope of the given file.
3. The method for improving the stability and question-answering accuracy of large language model-driven software as described in claim 1, characterized in that, Step B includes the following sub-steps: Step B1: Identify the file format of the incoming file by its extension. If it is plain text, leave it unchanged; if it is HTML, proceed to B2; if it is a table document, proceed to B3. Step B2: Automatically remove tags from the HTML file and convert it into well-structured plain text; Step B3: The table file then activates a more refined, problem-intention-based secondary processing pipeline.
4. The method for improving the stability and question-answering accuracy of large language model-driven software as described in claim 3, characterized in that, The secondary processing pipeline based on problem intent described in step B3 includes: Step B31: Use the large language model to make an intent judgment on the question. If it is a sequence question, go to B32; if it is a counting question, go to B33; if it is another question, go to B34. Step B32: For sequential problems, optimize the problem to make it easier for the large language model to understand the meaning of the problem, then proceed to B34; Step B33: For counting problems, use a large language model to generate code and attempt to get the answer through automatic compilation. If the output is normal, it is taken as the answer; otherwise, proceed to B34. Step B34: Convert the table to text format, and then pass the processed file and the text file into the application.
5. The method for improving the stability and question-answering accuracy of large language model-driven software as described in claim 4, characterized in that, Step B33 involves generating code using a large language model and attempting to obtain the answer through automatic compilation, including: Step B331: Obtain column name information by reading the first row of the CSV file and convert all column names to lowercase format to provide accurate field references for subsequent code generation; Step B332: Construct request parameters for a large language model, set code generation rules, use specified encoding to read files for system prompts, uniformly convert case, standardize numerical processing flow, and generate code based on actual column names. When column names do not match, null should be returned. Step B333: Receive the code returned by the model and perform multiple validations. First, check if the code contains the null keyword and necessary file reading statements. Then, extract all column names used in the code using regular expressions and verify if they exist in the actual column name list. If any validation fails, return null. Step B334: Set up an exception handling mechanism throughout the process to ensure that when an error is encountered, a prompt message is output and null is returned to ensure the stable operation of the system; Step B335: Execute the generated code automatically to obtain the final result.
6. The method for improving the stability and question-answering accuracy of large language model-driven software as described in claim 1, characterized in that, Step C includes the following sub-steps: Step C1: Check the obtained answer. If it is blank, let the application run it again. If the answer is still blank the second time, prompt the user that there is an error in the application and ask them to try other inputs. Step C2: If the answer is not empty, use the large language model to check whether the reasoning process and the conclusion conflict. If there is a conflict, adjust the conclusion to be consistent with the reasoning process.
7. A system for improving the stability and question-answering accuracy of large language model-driven software, characterized in that, include: The intermediate layer module is used to intercept the output between the AI component and the user input and perform detection and repair, realizing the entire process of input preprocessing, dynamic processing routing, result verification and self-correction.
8. The system for improving the stability and question-answering accuracy of large language model-driven software as described in claim 7, characterized in that, The system employs the method described in any one of claims 1-6.