Training method of question and answer model and related device

By employing multimodal intelligent parsing and semantic-driven dynamic block segmentation techniques, combined with efficient parameter fine-tuning and seamless toolchain integration, this approach solves the problems of inefficient data processing, high threshold for model fine-tuning, and insufficient toolchain collaboration in large-scale model training in vertical domains, enabling efficient and low-cost question-answering model training and application.

CN122114099APending Publication Date: 2026-05-29SHENZHEN ENTRY EXIT FRONTIER INSPECTION STATION OF THE PEOPLES REPUBLIC OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN ENTRY EXIT FRONTIER INSPECTION STATION OF THE PEOPLES REPUBLIC OF CHINA
Filing Date
2026-01-08
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In the fine-tuning training of large models in vertical domains, there are problems such as inefficient automated data processing, high threshold for model fine-tuning, and insufficient toolchain collaboration, resulting in unstable data quality, high costs, and low efficiency, making it difficult to meet the needs of rapid construction and iteration.

Method used

It adopts multimodal intelligent parsing, semantic-driven dynamic segmentation, multi-dimensional question-answering generation and efficient parameter fine-tuning throughout the entire process, combined with the seamless integration and closed-loop optimization mechanism of the toolchain, to achieve full-link intelligence from document input to knowledge extraction, model adaptation and scenario implementation.

Benefits of technology

It significantly reduces the application threshold and cost of large models in vertical fields, improves data processing efficiency and question-answer accuracy, shortens the model fine-tuning cycle, enhances the collaborative efficiency of the toolchain, and promotes the large-scale deployment of large models in various professional scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122114099A_ABST
    Figure CN122114099A_ABST
Patent Text Reader

Abstract

The application provides a training method of a question and answer model and related devices; a structured document sequence is generated by selecting a parsing algorithm according to a document type of an input document; document blocks are obtained by performing document blocking processing according to structural features and semantic features of the structured document sequence; candidate question and answer pairs are generated according to the document blocks, answers of the candidate question and answer pairs are revised according to a domain knowledge base, quality of the revised candidate question and answer pairs is scored, and a target question and answer pair is selected from the revised candidate question and answer pairs according to the score; an initial question and answer model is adjusted according to a data set of the target question and answer pair and a knowledge base domain knowledge base to obtain a target question and answer model; the problems of low efficiency of data automation processing, high threshold of model fine-tuning, and insufficient tool chain cooperation are solved, the quality and efficiency of training of a question and answer model in a vertical field are improved, the application construction threshold is reduced, and the scaling landing of the question and answer model is promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning, and more particularly to training methods and related apparatus for question-answering models. Background Technology

[0002] The following problems exist in the current process of fine-tuning training of large models in vertical domains and building customized applications: inefficient automated data processing, high threshold for model fine-tuning, and insufficient toolchain collaboration.

[0003] The problem lies in the insufficient automated generation capabilities for training data. Significant efficiency and quality issues exist in the content extraction, structuring, and question-and-answer pair generation of specialized documents in vertical domains (such as laws and regulations, medical literature, and knowledge bases for document verification). Traditional manual processing not only takes weeks or even months to complete document splitting, annotation, and cross-page sentence splicing, but also suffers from ambiguous wording, biased answers, or logical breaks in question-and-answer pairs due to individual cognitive differences. Furthermore, for documents containing sensitive information, manual intervention is prone to information leakage risks, making it difficult to meet the core demand for efficient and high-quality supply of training data for large models.

[0004] There are technical hurdles associated with model parameter optimization and adaptation. Fine-tuning large models requires specialized AI personnel to perform complex operations such as parameter configuration, training strategy formulation, and overfitting avoidance. However, most vertical industry entities are limited by a shortage of AI talent and insufficient hardware resources, making it difficult to independently achieve accurate adaptation and iteration between models and business data. The migration of general-purpose large models to vertical industries lacks standardized, low-code tool support, hindering the widespread adoption of model customization capabilities and severely restricting the application of these models in vertical scenarios.

[0005] The efficiency bottleneck in toolchain collaboration and workflow integration is a significant issue. Tools for document management, data annotation, model training, and application integration operate independently, creating data silos. Users must manually perform data export / import and format conversion operations across multiple platforms, resulting in numerous workflow interruptions and high collaboration costs. This leads to a lack of smooth operation across the entire chain from data preparation to model application, failing to meet the urgent needs of vertical industries for rapid construction and agile iteration of customized applications. Summary of the Invention

[0006] The following is an overview of the topics described in detail in this article.

[0007] The purpose of this application is to at least partially solve one of the technical problems existing in the related technologies. The embodiments of this application provide a training method and related apparatus for a question-answering model.

[0008] An embodiment of the first aspect of this application provides a method for training a question-answering model, comprising: Get the input document; Based on the document type of the input document, select the appropriate parsing algorithm to generate a sequence of structured documents; Based on the structural and semantic features of the structured document sequence, document chunking is performed to obtain document chunks containing document content, semantic tags, and contextual association weights; Candidate question-answer pairs are generated based on the document blocks. The answers of the candidate question-answer pairs are corrected based on the domain knowledge base corresponding to the candidate question-answer pairs. The quality of the corrected candidate question-answer pairs is scored. The target question-answer pair is selected from the corrected candidate question-answer pairs based on the score. The initial question-answering model is adjusted based on the dataset of the target question-answer pairs and the domain knowledge base to obtain the target question-answering model.

[0009] According to certain embodiments of the first aspect of this application, the method further includes: The performance of the quantitative model is determined based on the task completion rate and user satisfaction during the online process of the target question-answering model. Causal analysis is performed based on the performance of the quantification model to identify performance bottlenecks, and the parameters of the target question-answering model are adjusted based on the performance bottlenecks.

[0010] According to certain embodiments of the first aspect of this application, the method further includes: Acquire new business data during the deployment process of the target question-answering model; Based on the new business data, incremental adjustments are made to obtain the incremental adjustment model part; The target question-answering model is adjusted based on the incremental adjustment model.

[0011] According to certain embodiments of the first aspect of this application, selecting a corresponding parsing algorithm based on the document type of the input document includes: When the input document is an editable document, a rule-based regular expression matching algorithm and a DOM tree traversal algorithm are used. When the input document is an OFD document, an XML path language parser is used; When the input document is a PDF document, a text layer extractor and a rule-based regular expression matching algorithm are used.

[0012] According to certain embodiments of the first aspect of this application, the document chunking process is represented as follows: In the formula, B is the set of document blocks, and b is a document block. and All are preset weighting coefficients. For structural characteristic functions, For length characteristic function, The result of document segmentation processing. Let j be the sequence of structured documents.

[0013] According to certain embodiments of the first aspect of this application, the scoring includes the sum of a factual consistency score, an information coverage score, a language fluency score, and a domain expertise score. The factual consistency score is used to evaluate the degree of matching with the domain knowledge base. The information coverage score is used to evaluate the proportion of core keywords covering document blocks. The language fluency score is used to evaluate language fluency. The domain expertise score is used to evaluate the domain expertise of the language.

[0014] According to certain embodiments of the first aspect of this application, the score is represented as follows: In the formula, s is the score. Score for factual consistency. Scoring based on information coverage Scoring based on language fluency Rate the level of expertise in the field. 'a' represents the question and 'a' represents the answer.

[0015] According to certain embodiments of the first aspect of this application, a target question-answering model is obtained by adjusting the initial question-answering model based on the dataset of the target question-answering pair and the domain knowledge base using a low-rank adaptation method or a four-bit quantized low-rank adaptation method.

[0016] According to a second aspect of this application, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a training method for a question-answering model as described in an embodiment of the first aspect of this application.

[0017] According to a third aspect of this application, a computer storage medium stores computer-executable instructions for performing a training method for a question-answering model as described in an embodiment of the first aspect of this application.

[0018] The above solution offers at least the following benefits: Through multimodal intelligent parsing, semantic-driven dynamic segmentation, multi-dimensional question-answering generation, and efficient parameter fine-tuning throughout the entire process, combined with seamless toolchain integration and closed-loop optimization mechanisms, it achieves end-to-end intelligentization from "document input - knowledge extraction - model adaptation - scenario deployment," significantly reducing the application threshold and cost of large-scale models in vertical domains and accelerating the intelligent transformation process of various industries. It specifically addresses three major issues: inefficient automated data processing, high barriers to model fine-tuning, and insufficient toolchain collaboration. The aim is to improve the quality and efficiency of large-scale model training in vertical domains, lower the application construction threshold, and promote the large-scale deployment of large models in various professional scenarios. Attached Figure Description

[0019] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.

[0020] Figure 1 This is a flowchart illustrating the training steps of a question-answering model. Figure 2 This is a step diagram of the closed-loop optimization and continuous learning process; Figure 3 This is another step in the closed-loop optimization and continuous learning process. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0022] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, or the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0023] Large-scale language models (LLMs) demonstrate their advantages in terms of parameter scale and capability boundaries, ranging from small to large parameters and from single-text modality to multimodal fusion inference. However, in vertical fields such as laws and regulations, medical literature, or immigration management, the in-depth application of large models still faces a core bottleneck in the "data-model-tool" triple link, which restricts their leap from general capabilities to domain-specific capabilities.

[0024] First, the efficient generation of high-quality training data for vertical domains faces a dual dilemma of "human dependency" and "semantic fragmentation." The domain adaptability of large models heavily relies on training with structured question-and-answer pairs (QA data), but traditional data preparation processes are highly manual: on the one hand, professionals must manually break down documents (e.g., splitting tens of thousands of pages of policies and regulations into logically consistent paragraphs) and extract questions and answers, taking weeks or even months; on the other hand, manual annotation is easily affected by subjective cognitive biases, leading to vague question descriptions, fragmented answers (omitted key clauses), and even security risks due to the exposure of sensitive information. More importantly, traditional methods only focus on the surface-level text breakdown, lacking a deep understanding of the document's semantic structure (e.g., chapter hierarchy, chart relationships, and professional terminology context). The generated QA pairs often fail to effectively drive the model to learn the domain's knowledge system due to semantic fragmentation (e.g., incorrect punctuation across pages, and a disconnect between technical principles and implementation cases). Significant efficiency and quality issues exist in the content extraction, structuring, and QA pair generation of vertical domain professional documents (e.g., laws and regulations, medical literature, and certificate research knowledge bases). Traditional manual processing not only takes weeks or even months to complete document splitting, annotation, and cross-page sentence splicing, but also suffers from ambiguous expression, biased answers, or logical breaks in question-and-answer pairs due to individual cognitive differences. For documents containing sensitive information, manual intervention is also prone to information leakage risks, making it difficult to meet the core demand for efficient and high-quality supply of training data for large models.

[0025] Secondly, fine-tuning large-scale models in vertical domains faces dual barriers of "high technical threshold" and "high resource consumption." Although general-purpose large-scale models possess powerful generalization capabilities, their parameter scale and training costs make it difficult for most vertical domain entities to directly participate in model customization. On the one hand, the fine-tuning process involves complex techniques such as parameter configuration (e.g., selecting which layers to train), training strategies (e.g., learning rate scheduling, gradient accumulation), and overfitting avoidance (e.g., data augmentation, regularization), requiring professional teams to master cutting-edge knowledge such as deep learning and distributed training. On the other hand, full-parameter fine-tuning places extremely high demands on GPU computing power (e.g., A100 / H100 clusters), making it difficult for small and medium-sized entities to conduct iterative optimization due to hardware resource limitations. This results in domain models remaining at a rudimentary stage of "general capabilities + simple fine-tuning" for a long time, unable to adapt to complex business scenarios (e.g., multilingual document verification in immigration management, multi-clause reasoning in legal documents). Fine-tuning large models requires specialized AI personnel to perform complex operations such as parameter configuration, training strategy formulation, and compliance avoidance in simulations. However, most vertical industry entities are limited by a shortage of AI talent and insufficient hardware resources, making it difficult to independently complete the accurate adaptation and iteration of models and business data. The migration of general-purpose large models to vertical industries lacks standardized, low-code tool support, making it difficult to popularize model customization capabilities and severely restricting the application of models in vertical scenarios.

[0026] Finally, the "application deployment chain" for large-scale models in vertical domains is inefficient due to fragmented tools. Currently, document management tools (such as PDF parsing software), annotation platforms (such as human QA generation tools), training frameworks (such as Unsloth and llama-Factory), and agent deployment tools (such as API gateways) are mostly independent systems, lacking data interoperability and collaboration mechanisms. For example, users must first import the document into a parsing tool to extract text, then manually export it to an annotation platform to generate question-and-answer pairs, subsequently convert the data format and import it into a training framework to fine-tune the model, and finally deploy the agent through another set of interface tools. Each step of manual operation not only increases the risk of errors (such as semantic loss due to format conversion), but also reduces data usability due to semantic understanding discrepancies between tools (such as the "chapter titles" extracted by the parsing tool not matching the "semantic tags" of the annotation tool). This "data silo" phenomenon severely hinders the efficiency of the entire chain from document to model to application, making it difficult to meet the needs of vertical domains for "fast, accurate, and scalable" large-scale model applications. The independent nature of tools for document management, data annotation, model training, and application integration creates data silos. Users need to manually complete data export / import, format conversion, and other operations across multiple platforms. This results in numerous process interruptions and high collaboration costs, leading to a lack of smooth operation across the entire chain from data preparation to model application. This fails to meet the urgent needs of vertical industries for the rapid construction and agile iteration of customized applications.

[0027] To address the above issues, embodiments of this application provide a training method and related apparatus for a question-answering model.

[0028] The embodiments of this application will be further described below with reference to the accompanying drawings.

[0029] Reference Figure 1 The training method for the question-answering model includes the following steps: Step S100: Obtain the input document; Step S200: Select the appropriate parsing algorithm based on the document type of the input document to generate a structured document sequence; Step S300: Perform document segmentation based on the structural and semantic features of the structured document sequence to obtain document blocks containing document content, semantic tags, and contextual association weights; Step S400: Generate candidate question-answer pairs based on document blocks; correct the answers of candidate question-answer pairs based on the domain knowledge base corresponding to the candidate question-answer pairs; score the quality of the corrected candidate question-answer pairs; and select the target question-answer pair from the corrected candidate question-answer pairs based on the score. Step S500: Adjust the initial question-answering model based on the dataset of the target question-answer pair and the domain knowledge base to obtain the target question-answering model.

[0030] By leveraging multimodal intelligent parsing, semantic-driven dynamic segmentation, multi-dimensional question-answering generation, and efficient parameter fine-tuning throughout the entire process, combined with seamless toolchain integration and closed-loop optimization mechanisms, this approach aims to achieve end-to-end intelligentization from "document input - knowledge extraction - model adaptation - scenario deployment." This significantly reduces the application threshold and cost of large-scale models in vertical domains, accelerating the intelligent transformation process across industries. It specifically addresses three major issues: inefficient automated data processing, high barriers to model fine-tuning, and insufficient toolchain collaboration. The goal is to improve the quality and efficiency of large-scale model training in vertical domains, lower the application development threshold, and promote the large-scale deployment of large models in various professional scenarios.

[0031] For step S100, the input documents are obtained, and the set of input documents is as follows: ,in .

[0032] For step S200, the appropriate parsing algorithm is selected based on the document type of the input document to generate a structured document sequence, including the following steps: When the input document is an editable document, a rule-based regular expression matching algorithm and a DOM tree traversal algorithm are used. When the input document is an OFD document, the XML Path Language parser is used; When the input document is a PDF document, a text layer extractor and a rule-based regular expression matching algorithm are used.

[0033] This addresses the problems of traditional document processing, which relies on manual labor, is inefficient, and is prone to introducing information errors.

[0034] Specifically, through text structure rule parsing algorithms Complete the document content extraction.

[0035] Represented as: ; in, To represent a rule-based regular expression matching algorithm, This represents the document object model tree traversal algorithm. This represents an XML path language parser. This indicates a text layer extractor. This indicates the algorithm fusion operation.

[0036] For editable documents (DOC / PPT / Markdown), a rule-based regular expression matching and DOM tree traversal algorithm is used to directly extract text and metadata. For OFD documents, the standardized XML structure is utilized to extract text, charts, and metadata through an XPath parser. For PDF documents, the text layer is extracted using tools such as LibreOffice, and then a rule-based regular expression matching traversal algorithm is used for text processing to output a structured text sequence.

[0037] Output structured document content library Structured document sequence This achieves high-fidelity, low-error conversion preprocessing of document content.

[0038] For step S300, breaking through the mechanical and subjective nature of traditional document segmentation, a segmentation algorithm that integrates structural and semantic features is adopted to generate semantically independent units strongly associated with the vertical domain knowledge system. Document segmentation is performed based on the structural and semantic features of the structured document sequence to obtain document blocks containing document content, semantic tags, and contextual association weights.

[0039] A block-based algorithm based on decision trees is adopted. To structure documents As input, generate an initial set of document blocks. Block partitioning algorithm The decision function is constructed by fusing two types of features: In the formula, B is the set of document blocks, and b is a document block. and All are preset weighting coefficients. For structural characteristic functions, For length characteristic function, The result of document segmentation processing. Let j be the sequence of structured documents.

[0040] Specifically, As a structural feature function, it quantifies the nesting relationship of chapter titles (e.g., the depth of the hierarchy of "1.1→1.1.1"). The correlation between the position of the chart and the text is calculated using IoU. .in addition, This is a length feature function, controlling the number of characters in a paragraph to be between 500 and 2000. ,when hour Take the maximum value of 1; , The feature weights are optimized through training with domain data.

[0041] The interactive interface allows users to adjust the chunks (merge / split), ultimately outputting document chunks with metadata. {Content, semantic tags, contextual weights}.

[0042] For step S400, to address the issues of factual bias and ambiguous expression in traditional large-scale model-generated question-answer pairs, a multi-dimensional evaluation system is created to quantify the quality of question-answer pairs, transforming ambiguous question-answer pairs into high-confidence, domain-specific question-answer data. Candidate question-answer pairs are generated based on document blocks. The answers of the candidate question-answer pairs are corrected based on the corresponding domain knowledge base. The quality of the corrected candidate question-answer pairs is scored, and the target question-answer pair is selected from the corrected candidate pairs based on the scores.

[0043] Specifically, input document blocks The target question-answer pair is generated through a two-stage generative model. The first stage is candidate generation: calling the domain pre-trained model to generate 3 to 5 sets of candidate question-answer pairs (covering types such as concept explanation and process description); the second stage is calibration and optimization: combining the domain knowledge base to correct the answers (such as professional terminology, typos, etc.).

[0044] The scoring consists of the sum of factual consistency score, information coverage score, language fluency score, and domain expertise score. The factual consistency score is used to evaluate the degree of matching with the domain knowledge base, the information coverage score is used to evaluate the proportion of core keywords covering document blocks, the language fluency score is used to evaluate language fluency, and the domain expertise score is used to evaluate the domain expertise of the language.

[0045] Through a multi-dimensional evaluation system Quantifying the impact of question-and-answer on quality ( ): ; in, The questions and answers are separated, and scores are generated by a large model using the following methods: For rating, Score the factual consistency (the degree of exact match with the domain knowledge base). , For domain knowledge). The information coverage score is based on the percentage of document blocks covered by core keywords. ); Score for fluency of language; Rate the level of expertise in the field.

[0046] After receiving the ratings, users can confirm them in batches through the interface: The question-and-answer pairs are entered into the database; The question-and-answer pairs are corrected by users and then fed back into the question-and-answer database. This improves the accuracy of the question-and-answer pairs, enables quantitative control over the quality of domain-specific question-and-answer data, and effectively alleviates the problem of unstable data quality.

[0047] For step S500, the initial question answering model is adjusted according to the dataset of the target question answering pair and the domain knowledge base using a low-rank adaptation method or a four-bit quantized low-rank adaptation method to obtain the target question answering model.

[0048] Combining previous model fine-tuning practices with the use of open-source large model fine-tuning algorithm libraries, this paper effectively streamlines the entire question-and-answer data chain for parameter-efficient large model fine-tuning in vertical domains. It transforms the traditional complex fine-tuning process (parameter configuration and strategy formulation) that requires expert parameter tuning into a lightweight and automated model adaptation process, solving the problem of excessively high fine-tuning thresholds.

[0049] Specifically, the dataset of input target question-answer pairs domain knowledge base A hybrid fine-tuning strategy using either the low-rank adaptation method LoRA or the four-bit quantized low-rank adaptation method QLoRA is employed to obtain a fine-tuned large model. ,have: or .

[0050] LoRA fine-tunes only 1% to 3% of the model's parameters (updated via a low-rank matrix approximation), maintaining over 95% of the original model's performance. QLoRA performs 4-bit quantization on LoRA parameters, reducing computational resource requirements (reducing GPU memory usage by 50%).

[0051] The training process integrates adaptive optimization techniques: automatic learning rate adjustment (dynamically reduced based on loss function fluctuations); gradient accumulation (supporting large batch training and alleviating memory pressure); and mixed-precision computation (FP16 / BF16 hybrid for accelerated training). Through the efficient fine-tuning scheme employed in the proposed method, the fine-tuning cycle is shortened from weeks to hours, significantly reducing hardware costs.

[0052] For the target question-answering model, closed-loop optimization and continuous learning are carried out based on user feedback.

[0053] Reference Figure 2 Closed-loop optimization and continuous learning include the following steps: Step S611: Determine the quantitative model performance based on the task completion rate and user satisfaction of the target question-answering model during the online process; Step S612: Perform causal analysis based on the performance of the quantification model to identify performance bottlenecks, and adjust the parameters of the target question-answering model based on the performance bottlenecks.

[0054] Specifically, after the large-scale model in a vertical domain is launched, user interaction feedback is collected to construct a multi-dimensional evaluation system to quantify model performance. This involves combining quantitative and qualitative indicators to quantify the feedback, resulting in... The quantitative indicator is: task completion rate. Qualitative indicators include: user satisfaction. (5-point scale).

[0055] Through causal analysis , pinpointing performance bottlenecks (such as "information loss due to block errors") "Misunderstandings arising from the discrepancy between domain expertise and general knowledge" The data is then fed back to the upstream module for parameter tuning (such as adjusting the block feature weights). (Update question and answer generation calibration rules).

[0056] Reference Figure 3 In addition, closed-loop optimization and continuous learning also include the following steps: Step S621: Obtain new business data of the target question-answering model during the online process; Step S622: Perform incremental adjustments based on the new business data to obtain the incremental adjustment model part; Step S623: Adjust the target question-answering model based on the incremental adjustment model part.

[0057] Specifically, collect new business data regularly. The incremental fine-tuning model part is obtained through incremental fine-tuning. And adopt an incremental fine-tuning scheme. Update the model.

[0058] The specific implementation process of the question-answering model training method is described below.

[0059] Document Upload and Intelligent Preprocessing Steps: Users first upload PDF / DOC / OFD documents (including scanned copies) through the system's front-end interface. The system automatically identifies the document type based on a multimodal parsing engine and calls OCR (for scanned copies), XML deconstruction (for OFD), or text extraction algorithms (for editable documents) to extract the full text content. Simultaneously, it extracts file metadata (title, chapter structure, chart titles, font size, etc.) and removes redundant information such as watermarks, headers and footers, and duplicate paragraphs through an adaptive cleaning algorithm. At the same time, it intelligently splices cross-page sentences based on the article's paragraph structure to output a structured, high-fidelity document content library.

[0060] The semantically driven intelligent segmentation execution steps are as follows: An intelligent document segmentation algorithm based on decision trees is adopted to generate initial document blocks by combining document structural features (such as chapter title hierarchy and chart relationships). Each document block is automatically segmented into metadata containing semantic tags (such as "technical principles", "implementation cases", and "parameter descriptions"). The system supports users to adjust the segmented content and merge / split blocks through an interactive visual interface, ensuring that the document blocks maintain independent semantic units while forming a strong logical connection with the vertical domain knowledge system.

[0061] The multi-dimensional enhanced question-and-answer data pair generation steps are as follows: Based on a general large model or a domain large model (integrating domain corpus during the pre-training stage), initial question-and-answer pairs are generated by combining structured data of document blocks (such as chapter tags and keywords); a multi-dimensional evaluation system (including fact consistency verification, information coverage analysis, language fluency detection, and domain professionalism evaluation) is introduced, and cross-validation is performed between the pre-trained general large model and the domain expert knowledge base to output a comprehensive score (0-10 points) for each question-and-answer pair; users can batch-mark high-confidence question-and-answer pairs (automatically added to the database) or correct low-confidence question-and-answer pairs through a visual review interface (corrected content is synchronously fed back to the training corpus) to form a high-quality domain question-and-answer dataset.

[0062] The steps for parameter-efficient fine-tuning of large vertical domain models are as follows: Based on the generated question-answer dataset and domain knowledge base (such as structured databases and industry standard documents), a hybrid parameter-efficient fine-tuning strategy of LoRA (low-rank adaptation) + QLoRA (4-bit quantization QLoRA) is adopted. While maintaining more than 95% of the performance of the original large model, only 1%-3% of the parameters are fine-tuned. During the training process, an adaptive learning rate scheduler (automatically adjusts the learning rate according to the fluctuation of the loss function), gradient accumulation (supports large batch training), and mixed precision calculation (FP16 / BF16 hybrid) are integrated. Core indicators such as fine-tuning loss and accuracy are monitored in real time to obtain a lightweight and highly adaptable large vertical domain model.

[0063] The scalable intelligent agent generation and application integration steps are as follows: Based on the fine-tuned large model, combined with the domain toolchain (such as database query API, computing engine, and third-party service interfaces), the toolset is dynamically bound through function calling technology to generate a dedicated intelligent agent that supports the execution of complex tasks; the optimal prompt template (including role settings, constraints, and output format) is automatically generated according to the target task type (such as "fault diagnosis" or "solution recommendation"), reducing the cost of manually designing prompt words; the intelligent agent can quickly connect to business systems (such as front-line investigation and interrogation decision support systems) through standardized API interfaces, achieving seamless integration from model capabilities to business scenarios.

[0064] The closed-loop optimization and evaluation steps based on user feedback are as follows: Deploy intelligent agents in actual business scenarios, collect user interaction logs (including input questions, model outputs, and user correction behaviors), and construct a multi-dimensional evaluation system that includes quantitative indicators (such as task completion rate) and qualitative indicators (such as user satisfaction and domain expert ratings); locate key factors affecting model performance through causal inference (such as information loss caused by block errors and domain misunderstandings caused by fine-tuning data deviations), and feed the analysis results back to upstream steps such as document preprocessing, question-and-answer data generation, and model fine-tuning to drive parameter tuning or manual intervention optimization of each module; at the same time, establish a continuous learning mechanism, regularly collect new business data to regenerate question-and-answer pairs and incrementally fine-tune the model to ensure that the model performance continues to evolve with business development, forming a closed-loop "data-model-application-optimization" chain.

[0065] Furthermore, taking the large-scale model fine-tuning training of the "Document Recognition and Verification Knowledge Base Question Answering System" as an example, the specific implementation process will be explained in detail.

[0066] The system environment and parameter configuration are as follows.

[0067] The hardware environment is as follows: the server uses a single GPU server; the client uses a regular PC.

[0068] The software environment is as follows: Operating system: Ubuntu 22.04 LTS for the server, and Windows 10 / 11 and UnionTech system for the client; Development environment: Python, PyTorch, Transformers, FastAPI; Database: MySQL 8.4.3; Web server: Nginx 1.21.6 (deployment project management interface).

[0069] Key parameter settings: Document segmentation: paragraph length threshold from 512 to 2048 characters; Question-answer generation: Qwen3-32B-AWQ model is used, with a question generation temperature coefficient of 0.7; Model fine-tuning: the base model is Qwen2.5-7B, with a learning rate of 5e. -5 Batch size=4, training rounds 10.

[0070] Users can upload relevant documents for document recognition (DOCX format, 10 pages in total) through the project management interface. The system automatically performs preprocessing: it calls the LibreOffice library to extract text content, matches headings at all levels using regular expressions, identifies the font size and format of the headings, converts them into corresponding Markdown headings, and finally generates Markdown formatted text, outputting a plain text file (UTF-8 encoding, approximately 150,000 characters).

[0071] The length of border inspection teaching materials documents is set to 2048 characters to avoid fragmented knowledge points. Seven document blocks are generated.

[0072] The Qwen3-32B-AWQ model is invoked to generate candidate questions and corresponding answers for document blocks.

[0073] Large model self-evaluation: Qwen3-32B-AWQ scored the question-and-answer pair (out of 10), and the above question scored 9.2 points.

[0074] Select high-scoring question-answer pairs (score ≥ 8 points), divide them into training and validation sets in an 8:2 ratio, and convert them to JSON format ({"question": "...", "answer": "..."}).

[0075] Fine-tuning configuration of the vertical domain model.

[0076] Base model: Qwen3-8B (pre-trained weights); Training parameters: learning rate 5e-5, batch size=4, 10 training epochs, LoRA fine-tuning (rank=16). Overfitting control: When the accuracy of the validation set decreases for two consecutive rounds, the learning rate is automatically reduced to 1 / 5 of the original rate.

[0077] Training process: The model fine-tuning task scheduler monitors GPU utilization in real time (maintaining it at 70% to 80%), saves the intermediate model after each training round, and finally generates the model file "immigration-qa-8B-finetuned.pt".

[0078] Agent generation and application: Based on the fine-tuned model, generate a "document question and answer agent", configure the API interface ( / v1 / agent / immigration), and support POST requests (parameters: question, user_id).

[0079] Business integration: The system is integrated with the Meisha system through the MCP tool to achieve functionality.

[0080] Frontline officers can input questions into the question-and-answer system, which will automatically retrieve the answers, return the answers, and provide operation instructions. After receiving the answers and completing their duties, frontline officers can provide feedback on the results through the system.

[0081] The question-answering model fine-tuning training method based on intelligent document parsing and automatic question-answering data generation has formed systematic advantages in terms of data processing efficiency, model adaptation cost, tool collaboration capability and scenario practicality, addressing the problem of large-scale model applications in vertical fields.

[0082] First, addressing the issues of traditional data preparation relying on manual labor, resulting in low efficiency and inconsistent quality, an intelligent document parsing and multi-dimensional question-and-answer generation mechanism has enabled a leap from "time-consuming manual processing" to "automated and efficient output." The processing time for multi-page professional documents such as border inspection textbooks has been optimized, reducing the entire process (including content extraction, cleaning, and cross-page splicing) to within one hour, improving efficiency by over 95%. Through a question-and-answer generation method calibrated with semantic segmentation and a domain knowledge base, the accuracy of question-and-answer pairs has increased from 70-80% in manual processing to over 85% (e.g., 90% accuracy in legal and regulatory question-and-answer pairs), effectively mitigating issues such as ambiguous expressions and biased answers. The fully automated processing of documents containing sensitive information (such as border inspection research materials) eliminates the risk of information leakage due to human intervention; security assessments have significantly reduced the probability of sensitive information exposure.

[0083] Then, addressing the issue of traditional fine-tuning requiring professional teams and high costs, a shift from "expert-led" to "lightweight operation" was achieved through efficient parameter fine-tuning strategies and intelligent process design; labor costs were reduced by more than 70%; through technologies such as adaptive learning rate scheduling and pruning accuracy calculation, the model maintained more than 95% of general performance while improving the domain task response accuracy by 40% compared to general models (e.g., the border inspection knowledge base question-answering model achieved an accuracy of 90%, close to 85% of the level of human answers from industry experts); the overfitting warning and automatic adjustment mechanism reduced trial and error costs by 50%, and large-scale model adaptation could be completed without the need to build a professional AI team, significantly lowering the application threshold of large-scale models in vertical domains.

[0084] Furthermore, the efficient integration of tools and workflows eliminates the barriers of "data silos." Addressing the issues of fragmented traditional tools and inefficient data flow, integrated management and intelligent agent integration upgrade from "manual operation across multiple platforms" to "full-link automation." The training tasks for question-answer pairs are simplified, reduced to a mere 5-step automated process (including data upload, segmentation, question-answer generation, model fine-tuning, and application integration), improving operational efficiency by 75%. Full-link automation eliminates errors from manual export / import and format conversion, reducing task error rates. The multi-agent collaboration interface supports seamless integration with business systems, significantly improving query response time in typical scenarios (such as border inspection anomaly data verification), reducing manual retrieval time, and enhancing business processing efficiency. Hardware resource utilization is increased by 50%, and server energy consumption is reduced by 20% under the same training task, achieving intensive utilization of computing resources.

[0085] Finally, its practicality and scalability are outstanding, accelerating the intelligent implementation in professional fields. Addressing the issues of poor adaptability and high learning costs of traditional tools, it expands from a "single scenario" to "multi-scenario coverage" through multi-document type support and visual management design. It can quickly adapt to various vertical document types such as situation reports, case briefings, and official document summaries. Real-world testing shows that the model for generating reports on immigration and smuggling personnel extracts key information several times faster than manual methods, and improves risk prediction accuracy by 10%. The visual management interface reduces the learning cost by 80%, promoting rapid application in scenarios such as frontline duty and interrogation. It can continuously evolve, with a closed-loop optimization mechanism based on user feedback, ensuring that model performance continuously improves with business development (e.g., after adding new business data, the accuracy rate of question answering decays by less than 5% within six months), ensuring that the technical solution evolves in sync with actual needs.

[0086] In summary, through intelligent and automated technological innovation, breakthrough advantages have been achieved in data processing efficiency, model adaptation cost, tool collaboration capabilities, and scenario practicality. This has comprehensively solved the problems of fine-tuning training of large models in vertical fields and building customized applications, providing efficient, inclusive, and easily scalable technical support for the large-scale deployment of large models in professional fields.

[0087] Embodiments of this application provide an electronic device. The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the question-answering model training method described above.

[0088] This electronic device can be any smart terminal, including computers.

[0089] In general, for the hardware structure of electronic devices, the processor can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, to execute relevant programs and implement the technical solutions provided in the embodiments of this application.

[0090] The memory can be implemented in the form of read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory and is called and executed by the processor.

[0091] Input / output interfaces are used to implement information input and output.

[0092] The communication interface is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0093] The bus transmits information between various components of a device, such as the processor, memory, input / output interfaces, and communication interfaces. The processor, memory, input / output interfaces, and communication interfaces communicate with each other within the device via the bus.

[0094] Embodiments of this application provide a computer storage medium. The computer storage medium stores computer-executable instructions for executing the question-answering model training method described above.

[0095] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium. In the foregoing description of this specification, references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0096] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0097] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0098] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0099] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0100] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed between each other may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms. Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

[0101] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A training method for a question-answering model, characterized in that, include: Get the input document; Based on the document type of the input document, select the appropriate parsing algorithm to generate a sequence of structured documents; Based on the structural and semantic features of the structured document sequence, document chunking is performed to obtain document chunks containing document content, semantic tags, and contextual association weights; Candidate question-answer pairs are generated based on the document blocks. The answers of the candidate question-answer pairs are corrected based on the domain knowledge base corresponding to the candidate question-answer pairs. The quality of the corrected candidate question-answer pairs is scored. The target question-answer pair is selected from the corrected candidate question-answer pairs based on the score. The initial question-answering model is adjusted based on the dataset of the target question-answer pairs and the domain knowledge base to obtain the target question-answering model.

2. The training method for the question-answering model according to claim 1, characterized in that, The method further includes: The performance of the quantitative model is determined based on the task completion rate and user satisfaction during the online process of the target question-answering model. Causal analysis is performed based on the performance of the quantification model to identify performance bottlenecks, and the parameters of the target question-answering model are adjusted based on the performance bottlenecks.

3. The training method for the question-answering model according to claim 1, characterized in that, The method further includes: Acquire new business data during the deployment process of the target question-answering model; Based on the new business data, incremental adjustments are made to obtain the incremental adjustment model part; The target question-answering model is adjusted based on the incremental adjustment model.

4. The training method for the question-answering model according to claim 1, characterized in that, Selecting the appropriate parsing algorithm based on the document type of the input document includes: When the input document is an editable document, a rule-based regular expression matching algorithm and a DOM tree traversal algorithm are used. When the input document is an OFD document, an XML path language parser is used; When the input document is a PDF document, a text layer extractor and a rule-based regular expression matching algorithm are used.

5. The training method for the question-answering model according to claim 1, characterized in that, The document chunking process is represented as follows: In the formula, B is the set of document blocks, and b is a document block. and All are preset weighting coefficients. For structural characteristic functions, For length characteristic function, The result of document segmentation processing. Let j be the sequence of structured documents.

6. The training method for the question-answering model according to claim 1, characterized in that, The scoring includes the sum of factual consistency score, information coverage score, language fluency score, and domain expertise score. The factual consistency score is used to evaluate the degree of matching with the domain knowledge base. The information coverage score is used to evaluate the proportion of core keywords covering document blocks. The language fluency score is used to evaluate language fluency. The domain expertise score is used to evaluate the domain expertise of the language.

7. The training method for the question-answering model according to claim 6, characterized in that, The rating is expressed as follows: In the formula, s is the score. Score for factual consistency. Scoring based on information coverage Scoring based on language fluency Rate the level of expertise in the field. 'a' represents the question and 'a' represents the answer.

8. The training method for the question-answering model according to claim 1, characterized in that, The target question-answering model is obtained by adjusting the initial question-answering model based on the dataset and domain knowledge base of the target question-answering pair using either the low-rank adaptation method or the four-bit quantization low-rank adaptation method.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements a training method for the question-answering model as described in any one of claims 1 to 8.

10. A computer storage medium, characterized in that, The system stores computer-executable instructions for performing a training method for a question-answering model as described in any one of claims 1 to 8.