CN116821696B - Training method, device, equipment and storage medium for form question-answer model - Google Patents

Training method, device, equipment and storage medium for form question-answer model Download PDF

Info

Publication number
CN116821696B
CN116821696B CN202311106077.2A CN202311106077A CN116821696B CN 116821696 B CN116821696 B CN 116821696B CN 202311106077 A CN202311106077 A CN 202311106077A CN 116821696 B CN116821696 B CN 116821696B
Authority
CN
China
Prior art keywords
question
task
text
query
answer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311106077.2A
Other languages
Chinese (zh)
Other versions
CN116821696A (en
Inventor
张倩汶
饶孟良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311106077.2A priority Critical patent/CN116821696B/en
Publication of CN116821696A publication Critical patent/CN116821696A/en
Application granted granted Critical
Publication of CN116821696B publication Critical patent/CN116821696B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a training method, device and equipment for a form question-answer model and a storage medium, and relates to the technical field of artificial intelligence. The method comprises the following steps: acquiring a basic data set for training a form question-answer model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises a form text with a matching relation, a query question, a query statement and a question answer; generating training samples corresponding to the question-answering tasks according to the quaternary data sets; generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set; training the table question-answer model by adopting training samples corresponding to the question-answer tasks and training samples corresponding to at least one associated task to obtain a trained table question-answer model. The application adopts multi-task combined training to the form question-answer model, effectively enhances the understanding capability of the model to the form text, and improves the accuracy of the output answer.

Description

Training method, device, equipment and storage medium for form question-answer model
Technical Field
The application relates to the technical field of artificial intelligence, in particular to a training method, device and equipment for a form question-answer model and a storage medium.
Background
Form questions and answers refer to answers to a natural language question given based on the form content. The answer to the question may be either one or more table cells contained in the table or a value inferred from the table that does not appear.
In the related art, a NL2SQL (Natural Language to Structured Query Language, converting a natural language into a structured query language) technology is generally used to implement a table question and answer, first converting a natural language question into an SQL (Structured Query Language ) query sentence, and then querying the table according to the SQL query sentence to obtain a query answer.
However, the intermediate language SQL generated in the method is not accurate enough, which easily results in low accuracy of the generated answers.
Disclosure of Invention
The embodiment of the application provides a training method, device and equipment for a form question-answer model and a storage medium. The technical scheme comprises the following aspects.
According to an aspect of the embodiment of the present application, there is provided a training method of a form question-answer model, the method including: acquiring a basic data set for training the form question-answering model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises form text, query questions, query sentences and question answers with matching relations; the table text is table content presented in a text form, the query statement is a query instruction for describing the query problem by adopting a table language of the table text, and the question answer is an answer corresponding to the query problem obtained by adopting the query statement to query from the table text; generating training samples corresponding to the question-answering tasks according to the quaternary data sets; the training samples corresponding to the question-answering tasks take the form text and the query questions as sample data, and tag data are determined based on the answers of the questions; generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set, wherein the associated task is a task for training the form question-answering model in a combined mode with the question-answering task; and training the form question-answer model by adopting a training sample corresponding to the question-answer task and a training sample corresponding to the at least one associated task to obtain a trained form question-answer model.
According to an aspect of the embodiment of the present application, there is provided a form question-answering method based on a form question-answering model, the method including: acquiring an input question to be answered; selecting a table text matched with the input problem from a table database according to the input problem as a first table text; wherein at least one of the following is stored in the table database: at least one form text corresponding to the formatting form and at least one form text corresponding to the semi-structuring form respectively; generating an output answer corresponding to the input question according to the first table text and the input question through the table question-answering model, wherein the table question-answering model is obtained by training a question-answering task and at least one associated task of the question-answering task, and the associated task is a task for training the table question-answering model in combination with the question-answering task.
According to an aspect of an embodiment of the present application, there is provided a training apparatus for a form question-answer model, the apparatus including: the data set acquisition module is used for acquiring a basic data set for training the form question-answer model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises form text with a matching relation, a query question, a query statement and a question answer; the table text is table content presented in a text form, the query statement is a query instruction for describing the query problem by adopting a table language of the table text, and the question answer is an answer corresponding to the query problem obtained by adopting the query statement to query from the table text; the first sample generation module is used for generating training samples corresponding to the question-answer tasks according to the quaternary data sets; the training samples corresponding to the question-answering tasks take the form text and the query questions as sample data, and tag data are determined based on the answers of the questions; the second sample generation module is used for generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set, wherein the associated task is a task for jointly training the form question-answering model with the question-answering task; and the training module is used for training the form question-answer model by adopting the training sample corresponding to the question-answer task and the training sample corresponding to the at least one associated task to obtain a trained form question-answer model.
According to an aspect of an embodiment of the present application, there is provided a form question-answering apparatus based on a form question-answering model, the apparatus including: the question acquisition module is used for acquiring an input question to be answered; the table selection module is used for selecting a table text matched with the input problem from a table database according to the input problem to serve as a first table text; wherein at least one of the following is stored in the table database: at least one form text corresponding to the formatting form and at least one form text corresponding to the semi-structuring form respectively; the answer output module is used for generating an output answer corresponding to the input question according to the first table text and the input question through the table question-answering model, the table question-answering model is obtained by training a question-answering task and at least one associated task of the question-answering task, and the associated task is a task for training the table question-answering model in a combined mode with the question-answering task.
According to an aspect of the embodiments of the present application, there is provided a computer device including a processor and a memory in which a computer program is stored, the computer program being loaded and executed by the processor to implement the training method of the form question-answer model described above, or a form question-answer method based on the form question-answer model.
According to an aspect of the embodiments of the present application, there is provided a computer-readable storage medium having stored therein a computer program loaded and executed by a processor to implement the training method of the form question-answer model described above, or a form question-answer method based on the form question-answer model.
According to an aspect of the embodiments of the present application, there is provided a computer program product comprising a computer program loaded and executed by a processor to implement the training method of the form question-answering model described above, or a form question-answering method based on the form question-answering model.
The technical scheme provided by the embodiment of the application can bring the following beneficial effects: by generating the training samples corresponding to the question-answer tasks and the training samples corresponding to the associated tasks according to at least one quaternary data set included in the basic data set, the training samples corresponding to the question-answer tasks and the training samples corresponding to the associated tasks can be adopted to perform joint training on the table question-answer model, and compared with a single-task training mode, the multi-task training process can effectively enhance understanding capability of the table question-answer model on the table text and the query questions, robustness of the table question-answer model is improved, and accordingly resolution of the model on the input questions and accuracy of the output answers are improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of the present application.
FIG. 2 is a schematic diagram of the operation of a form question-answer model in a model-using device according to one embodiment of the application.
Fig. 3 is a schematic diagram of a specific application of the form question-answer model provided in one embodiment of the present application.
Fig. 4 is a flowchart of a training method of a form question-answer model according to an embodiment of the present application.
FIG. 5 is a schematic diagram illustrating the operation of a training process for a form generation model provided by one embodiment of the present application.
Fig. 6 is a flowchart of a form question-answering method based on a form question-answering model according to one embodiment of the present application.
Fig. 7 is a block diagram of a training apparatus for a form question-answer model according to an embodiment of the present application.
Fig. 8 is a block diagram of a form question-answering apparatus based on a form question-answering model according to one embodiment of the present application.
Fig. 9 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use the knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include, for example, sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, pre-training model technologies, operation/interaction systems, mechatronics, and the like. The pre-training model is also called a large model and a basic model, and can be widely applied to all large-direction downstream tasks of artificial intelligence after fine adjustment. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
Machine Learning (ML) is a multi-domain interdisciplinary, involving multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is specially studied how a computer simulates or implements learning behavior of a human to acquire new knowledge or skills, and reorganizes existing knowledge structures to continuously improve own performance. Machine learning is the core of artificial intelligence, a fundamental approach to letting computers have intelligence, which is applied throughout various areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, induction learning, teaching learning, and the like. The pre-training model is the latest development result of deep learning, and integrates the technology.
The large language model (Large Language Model, LLM) is an artificial intelligence algorithm based on deep learning techniques with the goal of allowing the computer to understand and generate natural language. It learns the structure and regularity of a language by analyzing a large amount of language data such as text, speech or images, and uses this knowledge to accomplish various natural language processing tasks such as machine translation, speech recognition, text classification, question-answering systems, etc. Large language models typically use a transform architecture in deep learning to model text sequences in order to understand context and semantics. Its training process typically involves a large amount of data and computing resources, such as a large corpus and a high performance computing platform. In the training process, the large language model gradually learns the characteristics and rules of the language, and forms understanding and expression capability of the language.
The transducer architecture is a deep learning model that employs a self-attention mechanism that can be assigned different weights depending on the importance of the various parts of the input data. The architecture is mainly used in the field of natural language processing and Computer Vision (CV). The architecture typically includes Self-Attention (Self-Attention), multi-Head Attention (Multi-Head Attention), position coding (Positional Encoding), residual connection and normalization (Add & Norm), feed-Forward Network (Feed-Forward Network), position-by-Position Feed-Forward Network (Position-with-Forward Network), and the like, which constitute the encoder and decoder.
The Pre-training Model (PTM), also called a kerbstone Model, refers to a deep neural network (Deep Neural Network, DNN) with large parameters, which is trained on massive unlabeled data, and the PTM extracts common features on the data by utilizing the function approximation capability of the large-Parameter DNN, and is suitable for downstream tasks through Fine Tuning (PEFT), parameter-Efficient Fine Tuning (PEFT), prompt Fine Tuning (prompt-Tuning) and other technologies. Therefore, the pre-training model can achieve ideal effects in a small sample (Few-shot) or Zero sample (Zero-shot) scene. PTM can be classified according to the data modality of the process into a language model (ELMO, BERT, GPT), a visual model (swin-transducer, viT, V-MOE), a speech model (VALL-E), a multi-modal model (ViBERT, CLIP, flamingo, gato), etc., wherein a multi-modal model refers to a model that builds a representation of the characteristics of two or more data modalities. The pre-training model is an important tool for outputting artificial intelligence generation content (Artificial Intelligence Generated Content, AIGC), and can also be used as a general interface for connecting a plurality of specific task models.
As artificial intelligence technology research and advances, artificial intelligence technology expands research and applications in a variety of fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned, autopilot, unmanned, digital twinning, virtual humans, robotics, artificial intelligence generation content (Artificial Intelligence Generated Content, AIGC), conversational interactions, smart medicine, smart customer service, game AI, virtual Reality (VR), augmented Reality (Augmented Reality, AR), etc., it is believed that as technology advances, artificial intelligence technology will find application in more fields and with increasing value.
The technical scheme of the application mainly relates to a machine learning technology in an artificial intelligence technology, and mainly relates to a training and using process of a form question-answer model.
Referring to fig. 1, a schematic diagram of an implementation environment of an embodiment of the present application is shown. The solution implementation environment can implement a training and use system that becomes a form question-answer model. The implementation environment of the scheme can comprise: model training apparatus 10 and model using apparatus 20.
Model training device 10 may be an electronic device such as a cell phone, tablet, notebook, desktop, smart television, multimedia player device, vehicle terminal, server, smart robot, or some other electronic device with relatively high computing power. Model training device 10 is used to train a form question-answer model.
In the embodiment of the application, the form question-answering model is a machine learning model obtained by training based on a training method of the form question-answering model and is used for generating an output answer corresponding to an input question according to the input question. The model training device 10 may train the form question-answer model in a machine learning manner so as to enable the form question-answer model to have the capability of generating an output answer corresponding to an input question according to the input question, and a specific model training method may refer to the following embodiments.
Alternatively, the form question-answer model may be a large-scale language model.
The trained form question-answer model may be deployed for use in model use device 20. The model using device 20 may be a terminal device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a smart television, a multimedia playing device, a vehicle-mounted terminal, a smart robot, or a server. When an output answer corresponding to an input question needs to be generated according to the input question, the model using device 20 may implement the above-described function through the trained form question-answer model.
The model training apparatus 10 and the model using apparatus 20 may be two independent apparatuses or the same apparatus. If model training apparatus 10 and model using apparatus 20 are the same apparatus, model training apparatus 10 may be deployed in model using apparatus 20.
In the embodiment of the present application, the execution body of each step may be a computer device, and the computer device refers to an electronic device having data computing, processing and storage functions. The computer device may be a terminal device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a smart television, a multimedia playing device, a vehicle-mounted terminal, an intelligent robot, or a server. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing service. The computer device may be a model training device 10 as in fig. 1, or a model using device 20.
Fig. 2 shows a schematic operation diagram of a form question-answer model in a model using device, where the form question-answer model can be applied to a form question-answer scene in a customer service system and a dialogue system, and the form question-answer scene needs to be implemented by the form knowledge extraction module, the search system and the form question-answer model shown in fig. 2, and finally, answers corresponding to user questions are output.
After the system receives the user's input questions, the system will build a form-based dialog system for the domain to which the input questions relate. First, form knowledge in various formats is extracted from a form database, which may include form knowledge in HTML, latex, excel, word, etc., and the form knowledge in various formats is converted into text format. Alternatively, each table in text format may be directly stored in the table text library. And then selecting form text matched with the user problem from a form database by a retrieval system according to the user problem, and sending the form text to a form question-answer model. Alternatively, the retrieval system may select a form from the form database that matches the user's question, and then convert the form to a text format. And finally, searching an answer from the form text by the form question-answer model according to the user question, thereby obtaining a corresponding output answer.
Exemplary, a specific application of the form question-answer model provided by the present application may be shown in fig. 3, where a schematic diagram of a query result of a dialog system is provided. The user's input question is "how large the displacement of this car is," and the table matching the input question is retrieved from the table database as shown in table 1 below.
TABLE 1
Engine model SQRF4J16
Engine type Four-stroke, ignition type
Cylinder diameter (mm) 77
Piston stroke (mm) 85.8
Displacement (mL) 1598
Compression ratio 9.9:1
Rated power (kw) 145
Rated power rotating speed (r/min) 5500
Maximum torque (N.m) 290
Maximum torque rotation speed (r/min) 2000-4000
Converting the table 1 into a text format to obtain a table text, wherein the table text is "|engine model|engine model|cylinder diameter (mm) |piston stroke (mm) |displacement (mL) |compression ratio|rated power (kw) |rated power rotating speed (r/min) |maximum torque (N.m) |maximum torque rotating speed (r/min) |compression ratio|rated power rotating speed (r/min)n | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | />n|SQRF 4J 16|four strokes, ignition type |77|85.8|1598|9.9:1|145|5500|290|2000-4000| ", the dialogue system generates an output answer corresponding to the input question according to the input question through a form question-answering model, namely, the result of' query displacement (mL) shown in figure 3 is that: 1598", so that the output answer can be returned to the client where the user is located.
Referring to fig. 4, a flowchart of a training method of a form question-answer model according to an embodiment of the application is shown. The subject of execution of the steps of the method may be a computer device. The method may include at least one of the following steps 410-440.
Step 410, obtaining a basic data set for training a form question-answer model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises form text, query questions, query sentences and question answers with matching relations; the table text is table content presented in a text form, the query statement is a query instruction for describing a query question by adopting a table language of the table text, and the question answer is an answer corresponding to the query question obtained by querying the table text by adopting the query statement.
The table text is a table text matched with the query problem, and optionally, the table text may be a table text corresponding to a structured table or a table text corresponding to a semi-structured table.
The quaternary data set is a data set constructed based on the table text and the query questions, wherein the query sentences are query instructions for describing the query questions by using the table language of the table text, and the answers of the questions are answers corresponding to the query questions obtained by querying the table text by using the query sentences. According to the form text and the query questions, query sentences can be constructed, and according to the query sentences and the form text, answers corresponding to the query questions can be obtained.
Illustratively, the original form of the form text may be as shown in Table 2.
TABLE 2
Subject name Reference book Press (Verlag) Author's authors
Higher algebra Higher algebraic math Third edition of higher education press Editorial of North Dada mathematics
Mathematical analysis Mathematical analysis (Upper and lower) Third edition of higher education press Hua Shida editors
Mathematical statistics Mathematical statistics Scientific press Wei Laisheng editors
The table text (table) can be expressed as "|subject name|reference book|publishing company|author| |n| ---- | ---- | ---- | ---- |/>n|higher algebra|higher education press third edition|North university academy of university>n|mathematical analysis|mathematical analysis (up, down) |higher education Press third edition| Hua Shida editorial|>n|mathematical statistics|mathematical statistics|science Press| Wei LaishengEdit | ". The query question (query) is "statistics of how the book is published by scientific publishers, then who the book is written by". The query Statement (SQL) is "Select author where subject name=mathematical statistics and publishing company=scientific publishing company". The answer to the question (answer) is "Wei Laisheng authored.
The table language of the table text refers to each item in the table text and attribute data corresponding to each item, and the query statement describes the query problem by adopting each item in the table text and attribute data corresponding to each item. For example, the term dimension "mathematical statistics" in the query question is that the corresponding table language published by the scientific press is that when the entry in the table text is "subject name", the corresponding attribute data is "mathematical statistics", and when the entry in the table text is "press", the corresponding attribute data is "scientific press"; query the question dimension "who the book writes" in question corresponds to the table language being "author" in the table text, and query the corresponding attribute data, thereby obtaining the corresponding question answer "Wei Laisheng authoring".
Step 420, generating training samples corresponding to the question-answering task according to the quaternary data set; the training samples corresponding to the question-answering tasks take form text and query questions as sample data, and tag data are determined based on answers of the questions.
The question-answering task is a main line task of the form question-answering model and is used for outputting answers corresponding to the questions according to the form text and the questions input by the user.
The training samples corresponding to the question-answering task include sample data for use as input data of the question-answering task and tag data for use in calculating a loss function value with output data of the question-answering task.
Optionally, the training samples corresponding to the question-answering task may have the form text and the query questions as sample data and the answers to the questions as tag data.
Optionally, the training samples corresponding to the question-answering task may also use the form text and the query question as sample data, and the rewritten question answer as tag data.
In some embodiments, the answer to the question is rewritten to obtain a rewritten answer to the question, and the rewritten answer to the question is described by a table language of a table text; generating training samples corresponding to the question-answer tasks according to the form text, the query questions and the rewritten question answers; the training samples corresponding to the question-answering tasks take rewritten question answers as tag data.
The rewritten question answer (rewriteanswer) is based on the table text and the query question, the question answer is described in a table language of the table text, and the rewritten question answer includes a full amount of attribute data of at least one item related to the query question, including attribute data of each dimension in the query question. The rewritten question answer is a question answer with more abundant attribute data than the question answer without the rewriting.
Illustratively, the answer to the question is "Wei Laisheng authored", the answer to the question after being rewritten, which is described in a table language of a table text, is "the name of the subject is mathematical statistics", and in the case where the publisher is a scientific publisher, the result of the query author is Wei Laisheng authored. In the case of "attribute data including a problem dimension" the result of a query author is Wei Laisheng editorial, "attribute data also including a condition dimension" the subject name is mathematical statistics, and the publisher is a scientific publisher.
The description level of the rewritten question answers is richer by rewriting the question answers, so that when the rewritten question answers are used as tag data to train the form question-answer model, the training effect of the form question-answer model can be enhanced, and the accuracy of the output answers is improved.
Step 430, generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set, wherein the associated task is a task for training a form question-answering model in combination with the question-answering task.
The associated task is an auxiliary line task of the form question-answer model and is used for training the form question-answer model in combination with the question-answer task, so that the training effect of the form question-answer model is improved.
The associated tasks include a question rewrite task, a subtable generation task, and a thought chain task. The problem writing task is used for writing the problem writing method of the query problem according to the table language of the table text, so that the rewritten query problem can be more in line with the word expression used in the table text. The sub-table generating task is used for finding row and column information related to the query problem in the table text to form a new sub-table text, and the sub-table text comprises entries corresponding to the query problem in the table text and attribute data corresponding to the entries. The thinking chain task is used for generating rewritten query questions according to the form text and the query questions, regenerating sub-table text, and finally generating output answers, so that the model can think step by step according to the thinking chain to obtain answers corresponding to the query questions.
The training samples corresponding to the associated tasks are generated according to the data in the quaternary data sets, the training samples corresponding to the associated tasks comprise sample data and label data, the sample data is used as input data of the associated tasks, and the label data is used for calculating loss function values with output data of the associated tasks. The sample data are table text and query questions, and the tag data are generated according to the table text, the query questions and other data in the quaternary data group.
The label data corresponding to the problem rewriting task is generated according to the form text, the query problem and the query statement; the label data corresponding to the subtable generating task is generated according to the table text, the query problem and the query statement; the label data corresponding to the thinking chain task is generated according to the form text, the query question and the question answer.
It should be noted that, the step 420 and the step 430 may be performed simultaneously, or may be performed sequentially, or the step 420 may be performed first, or the step 430 may be performed first, which is not limited in the present application.
And step 440, training the table question-answer model by adopting training samples corresponding to the question-answer tasks and training samples corresponding to at least one associated task to obtain a trained table question-answer model.
Optionally, training samples corresponding to the question-answering task and training samples corresponding to an associated task may be used to train the table question-answering model, so as to obtain a trained table question-answering model. For example, training samples corresponding to question-answering tasks and training samples corresponding to question-rewriting tasks can be used for training the table question-answering model; training samples corresponding to the question-answer tasks and training samples corresponding to the sub-table generating tasks can also be adopted to train the table question-answer model; training samples corresponding to the question-answering tasks and training samples corresponding to the thinking chain tasks can also be adopted to train the table question-answering model.
Optionally, training samples corresponding to the question-answer task and training samples corresponding to a plurality of associated tasks may also be used to train the table question-answer model. For example, a training sample corresponding to a question-answer task and training samples corresponding to two or three tasks in the associated task may be employed to train the table question-answer model.
In some embodiments, the question-answering model may be trained using training samples corresponding to question-answering tasks, and training samples corresponding to at least one associated task other than question-overwriting tasks, sub-table generation tasks, and thought-chain tasks.
In some embodiments, the total loss function value is calculated according to the loss function value corresponding to the question-answer task and the loss function value corresponding to the at least one associated task; and adjusting parameters of the form question-answer model according to the total loss function value to obtain a trained form question-answer model.
Optionally, the loss function value corresponding to the question-answer task and the loss function value corresponding to the at least one associated task may be added, and the total loss function value may be calculated.
Optionally, the total loss function value may be obtained by performing weighted summation on the loss function value corresponding to the question-answer task and the loss function value corresponding to at least one associated task. The weight parameters corresponding to the loss function values of the tasks can be set independently according to the actual training requirements of the form question-answer model, and the application is not limited to the actual training requirements.
For the loss function value corresponding to each task, an MSE (Mean Squared Error, mean square error) loss function may be used, or other loss functions capable of expressing the meaning of loss, such as a log likelihood loss function, a cross entropy loss function, an exponential loss function, etc., which is not limited in this application.
The total loss function value of the training process of the form question-answer model is obtained by calculating the question-answer task and the loss function value corresponding to at least one associated task, so that the loss difference output by the model can be judged according to the total loss function value, and further, the parameters of the form question-answer model are adjusted according to the loss difference, so that a better form question-answer effect is achieved, and the accuracy of the output answer of the form question-answer model is improved.
According to the technical scheme provided by the embodiment of the application, the training samples corresponding to the question-answering tasks and the training samples corresponding to the associated tasks are generated according to the at least one quaternary data set included in the basic data set, so that the training samples corresponding to the question-answering tasks and the training samples corresponding to the associated tasks can be adopted to perform combined training on the table question-answering model, and compared with a single-task training mode, the multi-task training process can effectively enhance the understanding capability of the table question-answering model on the table text and the query problem, improve the robustness of the table question-answering model, and further improve the resolution of the model on the input problem and the accuracy of the output answer.
Next, a training process of the problem rewriting task will be described.
First, a training sample corresponding to a problem rewriting task needs to be acquired.
In some embodiments, the query question is rewritten based on a table language contained in the query statement, resulting in a first rewritten question described in the table language.
The first rewrite question is a rewritten query question obtained by rewriting the query question based on a table language included in the query sentence. The first rewrite question is a question writing method for rewriting a query question by using a query sentence, and rewrites the query question into a text expression used in a table language of a table text.
Illustratively, the query sentence is "Select author where subject name=mathematical statistics and press=scientific press", the query question is "mathematical statistics" the book is published by scientific press, then the book is what is written by "based on the table language contained in the query sentence, and the first rewrite question obtained is" subject name is mathematical statistics, press is scientific press, and the case of the author. It can be seen that the first rewrite problem describes "mathematical statistics", "scientific press" and "who writes" in the query problem in a table language, respectively.
In some embodiments, according to the form text, the query question and the first rewrite question, generating a training sample corresponding to the question rewrite task; the training samples corresponding to the question rewriting tasks take the form text and the query questions as sample data, and the first rewriting questions as tag data.
Secondly, training a table question-answering model by adopting training samples corresponding to the question rewriting task.
In some embodiments, generating a second rewrite question corresponding to the query question according to the form text and the query question through a form question-answer model; and calculating a first loss function value according to the second rewrite problem and the first rewrite problem, wherein the first loss function value is used for measuring the performance of the form question-answer model on the problem rewrite task.
The second rewritten question is a rewritten query question output by the form question-answer model based on the input form text and the query question. And calculating a first loss function value according to the second rewrite problem and the first rewrite problem, thereby obtaining the loss difference of the form question-answering model on the problem rewrite task.
The query questions are rewritten based on the table language contained in the query statement to obtain the first rewritten questions, so that the first rewritten questions are used as tag data to train the table question-answering model, the understanding capability of the table question-answering model on the query questions can be enhanced, and the accuracy of the model output answers can be improved after multitasking training.
The training process for the sub-table generation task is described below.
First, a training sample corresponding to a subtable generating task needs to be acquired.
In some embodiments, generating a rewritten query statement from the query question and the query statement, the rewritten query statement for full attribute data of at least one entry in the query table text related to the query question; and extracting the total attribute data of at least one item related to the query problem from the table text according to the rewritten query sentence, and obtaining a first sub-table text.
The rewritten query statement is the full-scale attribute data of at least one item related to the query question in the table text, namely the full-scale attribute data of the condition dimension and the question dimension related to the query question in the table text.
Illustratively, the query sentence is "Select author where subject name=mathematical statistics and publishing agent=scientific publishing agent", and the rewritten query sentence is "Select subject name, publishing agent, author where subject name=mathematical statistics and publishing agent=scientific publishing agent". It can be seen that the query statement is a query of attribute data of an author entry in the table text, and the rewritten query statement is a query of full-scale attribute data of a subject name entry, a publisher entry, and an author entry in the table text.
The first sub-table text is related row and column information obtained by inquiring the total attribute data of at least one item related to the inquiry problem in the table text based on the rewritten inquiry statement, and the table text is compressed into a sub-table text related to the inquiry problem based on the rewritten inquiry statement.
Illustratively, the first sub-table text (sub-table) is "|subject name|publisher|author|n| ---- |---- | ---- |/>n|mathematical statistics|scientific publisher| Wei Laisheng editorial| ", it can be seen that the first sub-table text includes entries corresponding to the query problem in the table text, i.e.," |subject name|publisher|author| ", and attribute data corresponding to each entry, i.e.," |mathematical statistics|scientific publisher| Wei Laisheng editorial| ".
In some embodiments, generating training samples corresponding to sub-table generation tasks according to the table text, the query question and the first sub-table text; the training samples corresponding to the sub-table generating tasks take the table text and the query questions as sample data, and the first sub-table text as tag data.
Optionally, training samples corresponding to the subtable generating task can be generated according to the form text, the first rewrite problem and the first subtable text; the training samples corresponding to the sub-table generating tasks take the table text and the first rewrite problem as sample data, and the first sub-table text as tag data.
The first rewrite problem may be generated by referring to the above embodiment.
Secondly, training samples corresponding to the subtable generating tasks are adopted to train the table question-answer model.
In some embodiments, generating a second sub-table text corresponding to the query question according to the table text and the query question through a table question-answer model; and calculating a second loss function value according to the second sub-table text and the first sub-table text, wherein the second loss function value is used for measuring the performance of the form question-answer model on the sub-table generation task.
The second sub-table text is the sub-table text output by the table question-answering model according to the input table text and the query questions. And calculating a second loss function value according to the second sub-table text and the first sub-table text, thereby obtaining the loss difference of the form question-answer model on the sub-table generation task.
Optionally, in the case that the training sample corresponding to the sub-table generating task uses the table text and the first rewrite problem as sample data and uses the first sub-table text as tag data, the second sub-table text is a sub-table text output by the table question-answer model according to the input table text and the first rewrite problem.
By generating rewritten query sentences according to the query questions and the query sentences and inquiring the table text according to the rewritten query sentences, the first sub-table text is obtained, so that the first sub-table text is used as tag data to train the table question-answer model, the understanding capability of the table question-answer model to the table text can be enhanced, and the accuracy of the model output answer can be improved after multitasking training.
Next, a training process of the mental chain task will be described.
First, a training sample corresponding to a task of a mental chain needs to be acquired.
In some embodiments, the query question is rewritten based on a table language contained in the query statement, resulting in a first rewritten question described in the table language; generating a rewritten query statement according to the query question and the query statement, wherein the rewritten query statement is used for inquiring the total attribute data of at least one item related to the query question in the table text; and extracting full attribute data of at least one item related to the query problem or the first rewrite problem from the table text according to the rewritten query sentence to obtain a first sub-table text.
The first rewrite problem and the generation process of the first sub-table text may refer to the above embodiments, and will not be described herein.
In some embodiments, training samples corresponding to the mental chain tasks are generated according to the form text, the query questions, the answers to the questions, the first rewrite questions and the first sub-table text; the training samples corresponding to the thinking chain tasks take the form text and the query questions as sample data, and the first rewritten questions, the first sub-table text and the answers to the questions as tag data.
Secondly, training samples corresponding to the subtable generating tasks are adopted to train the table question-answer model.
In some embodiments, generating a second rewritten question, a second sub-table text and an output answer corresponding to the query question according to the table text and the query question through a table question-answer model; and calculating a third loss function value according to the difference between the second rewritten question and the first rewritten question, the difference between the second sub-table text and the first sub-table text and the difference between the output answer and the question answer, wherein the third loss function value is used for measuring the performance of the form question-answer model on the thinking chain task.
Calculating a loss function value corresponding to the rewrite problem according to the difference between the second rewrite problem and the first rewrite problem; calculating a loss function value corresponding to the sub-table text according to the difference between the second sub-table text and the first sub-table text; and calculating a loss function value corresponding to the answer according to the difference between the output answer and the question answer. And calculating to obtain a third loss function value according to the loss function value corresponding to the rewritten question, the loss function value corresponding to the sub-table text and the loss function value corresponding to the answer.
Alternatively, the loss function value corresponding to the overwriting problem, the loss function value corresponding to the sub-table text, and the loss function value corresponding to the answer may be added to obtain the third loss function value.
Optionally, the loss function value corresponding to the overwriting problem, the loss function value corresponding to the sub-table text and the loss function value corresponding to the answer may be weighted and summed to obtain a third loss function value. The weight parameters corresponding to the loss function values can be set independently according to the actual training requirements of the form question-answer model, and the application is not limited to the actual training requirements.
The second rewrite question is generated firstly according to the form text and the query question by the thought chain task, the second sub-table text is generated again, and the output answer is finally generated, so that the model can think step by step according to the thought chain, the understanding capability of the model on the query question and the form text is enhanced, and the accuracy of the model output answer is improved.
FIG. 5 is a schematic diagram illustrating the operation of a training process for a form generation model, wherein a retrieval system selects form text from a form database that matches a query question based on the query question, and generates a base dataset for training the form question-answer model based on the form text and the query question, the base dataset including at least one quaternary data set. According to the quaternary data set, training samples corresponding to the question-answering tasks and at least one training sample corresponding to the associated task are generated, the table question-answering model is trained, the training effect of the question-answering tasks is enhanced by the table question-answering model based on multi-task training, understanding ability of the table question-answering model to the table text and the query questions is effectively enhanced, and accuracy of the model output answers is improved.
Referring to fig. 6, a flowchart of a form question-answering method based on a form question-answering model according to one embodiment of the present application is shown. The subject of execution of the steps of the method may be a computer device. The method may include at least one of the following steps 610-630.
Step 610, obtain an input question to be answered.
For example, the input question may be "statistics of how the book was published by a scientific press, then who the book was written.
Step 620, selecting a form text matched with the input problem from the form database as a first form text according to the input problem; wherein the table database stores at least one of the following: at least one formatted form corresponds to the form text respectively, and at least one semi-structured form corresponds to the form text respectively.
The first table text may be a table text corresponding to the formatted table, or may be a table text corresponding to the semi-structured table.
Structured tables (Well-structured tables) are dominated by tables in the form of databases (databases). The table consists of M rows and N columns of data, wherein each row consists of N table units and represents an information record; each column is made up of M table cells, all of which in the same column are of the same type. Structured tables have a standardized format, which is simpler in table research.
Semi-structured tables (Semi-structured tables) are inferior to structured Table specifications, often contain complex structural forms such as cell merging, hierarchical headers, and the like, and have specific writing formats at the code level. Common sources of semi-structured tables are: HTML, latex, excel, word, etc.
Step 630, generating an output answer corresponding to the input question according to the first table text and the input question through a table question-answering model, wherein the table question-answering model is obtained by training a question-answering task and at least one associated task of the question-answering task, and the associated task is a task for training the table question-answering model in combination with the question-answering task.
Illustratively, based on the fact that the input question is "mathematical statistics" that the book is published by a scientific press, then the book is "who the book is written to," the output answer generated by the form question-answer model is "the subject name is mathematical statistics," and in the case that the press is a scientific press, the result of the query author is Wei Laisheng editorial.
The training process of the form question-answer model may refer to the above embodiments, and will not be described herein.
According to the technical scheme provided by the embodiment of the application, the form question-answering method is realized by adopting the form question-answering model obtained by training based on the question-answering task and at least one associated task of the question-answering task, so that the resolution of the input questions can be improved, and the accuracy of the output answers can be improved.
The training method of the form question-answering model and the form question-answering method based on the form question-answering model provided by the embodiment of the application are model training processes and using processes which correspond to each other. For details not described in detail on one side, reference is made to the description on the other side.
Table 3 below shows a comparison of the model effects of the untrained form question-answer model.
TABLE 3 Table 3
Model ChatGLM-6B ChaGPT-3.5~175B model-7B of the application
Accuracy rate of 0.414 0.486 0.402
As can be seen from the table 3, the model ChatGLM is 60 hundred million parameters, the model ChaGPT-3.5 is 1750 hundred million parameters, the model of the application is a 70 hundred million parameter framework as a basic model, and the accuracy of the model is 0.414, 0.486 and 0.402 respectively, and the accuracy is lower.
Table 4 below shows a comparison of the model effect obtained by the model of the present application for different task training.
TABLE 4 Table 4
Sequence number Training tasks The model of the application
Experiment 1 Training only for question-answering tasks 0.554
Experiment 2 Question-answer task answer introduction rewrite 0.619
Experiment 3 Stacked multitasking 0.74
As can be seen from the above Table 4, the model accuracy of the form question-answer model trained only by the question-answer task is lower than that of the model trained by the question-answer task by the rewritten question answer, and the model accuracy of the model trained jointly based on the multitasking is obviously improved compared with that of the former two training modes. The understanding ability of the form text and the query answers by the form question-answer model based on the multi-task joint training is obviously enhanced.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Referring to fig. 7, a block diagram of a training device for a form question-answer model according to an embodiment of the present application is shown. The device has the function of realizing the training method of the form question-answering model, and the function can be realized by hardware or by executing corresponding software by the hardware. The apparatus may be the computer device described above or may be provided in a computer device. As shown in fig. 7, the apparatus 700 may include: a data set acquisition module 710, a first sample generation module 720, a second sample generation module 730, and a training module 740.
A data set obtaining module 710, configured to obtain a basic data set for training the form question-answer model, where the basic data set includes at least one quaternary data set, and the quaternary data set includes a form text, a query question, a query sentence, and a question answer that have a matching relationship; the table text is table content presented in a text form, the query statement is a query instruction for describing the query question by adopting a table language of the table text, and the question answer is an answer corresponding to the query question obtained by adopting the query statement to query from the table text.
The first sample generating module 720 is configured to generate training samples corresponding to the question-answer task according to the quaternary data set; and the training samples corresponding to the question-answering tasks take the form text and the query questions as sample data, and label data are determined based on the answers of the questions.
And the second sample generating module 730 is configured to generate, according to the quaternary data set, a training sample corresponding to at least one associated task of the question-answering task, where the associated task is a task for training the form question-answering model in association with the question-answering task.
And the training module 740 is configured to train the form question-answer model by using a training sample corresponding to the question-answer task and a training sample corresponding to the at least one associated task, so as to obtain a trained form question-answer model.
In some embodiments, the associated task includes a question-rewrite task; the second sample generation module 730 includes a question rewrite task sub-module, configured to rewrite the query question based on a table language included in the query statement, to obtain a first rewrite question described by using the table language; generating training samples corresponding to the problem rewriting tasks according to the table text, the query problem and the first rewriting problem; the training samples corresponding to the question rewriting task take the table text and the query question as sample data, and the first rewriting question as tag data.
In some embodiments, the task for question rewriting submodule is further configured to generate, according to the form text and the query question, a second rewrite question corresponding to the query question through the form question-answer model; and calculating a first loss function value according to the second rewrite problem and the first rewrite problem, wherein the first loss function value is used for measuring the performance of the form question-answering model on the problem rewrite task.
In some embodiments, the associated tasks include a sub-table generation task; the second sample generating module 730 includes a sub-table generating task sub-module, configured to generate, according to the query question and the query statement, a rewritten query statement, where the rewritten query statement is used to query total attribute data of at least one item related to the query question in the table text; extracting full attribute data of at least one item related to the query problem from the table text according to the rewritten query statement to obtain a first sub-table text; generating training samples corresponding to the subtable generating tasks according to the table text, the query questions and the first subtable text; the training samples corresponding to the sub-table generating tasks take the table text and the query questions as sample data, and the first sub-table text as tag data.
In some embodiments, the sub-table generating task sub-module is further configured to generate, according to the form text and the query question, a second sub-table text corresponding to the query question through the form question-answer model; and calculating a second loss function value according to the second sub-table text and the first sub-table text, wherein the second loss function value is used for measuring the performance of the form question-answer model on the sub-table generation task.
In some embodiments, the associated tasks include thought chain tasks; the second sample generating module 730 includes a thought-chain task sub-module, configured to rewrite the query question based on a table language included in the query statement, to obtain a first rewrite question described by using the table language; generating a rewritten query statement according to the query question and the query statement, wherein the rewritten query statement is used for querying total attribute data of at least one item related to the query question in the table text; extracting full attribute data of at least one item related to the query problem or the first rewrite problem from the table text according to the rewritten query statement to obtain a first sub-table text; generating training samples corresponding to the thinking chain tasks according to the table text, the query questions, the answers to the questions, the first rewrite questions and the first sub-table text; the training samples corresponding to the thinking chain tasks take the table text and the query questions as sample data, and the first rewritten questions, the first sub-table text and the answers to the questions as tag data.
In some embodiments, the thought chain task sub-module is further configured to generate, according to the form text and the query question, a second rewritten question, a second sub-table text, and an output answer corresponding to the query question through the form question-answer model; and calculating a third loss function value according to the difference between the second rewrite problem and the first rewrite problem, the difference between the second sub-table text and the first sub-table text and the difference between the output answer and the question answer, wherein the third loss function value is used for measuring the performance of the form question-answer model on the thinking chain task.
In some embodiments, the first sample generating module 720 is configured to rewrite the answer to obtain a rewritten answer to the question, where the rewritten answer to the question is described in a table language of the table text; generating training samples corresponding to the question-answering task according to the form text, the query questions and the rewritten questions; and the training sample corresponding to the question-answering task takes the rewritten question answers as tag data.
In some embodiments, the training module 740 is configured to calculate an overall loss function value according to the loss function value corresponding to the question-answer task and the loss function value corresponding to the at least one associated task; and adjusting parameters of the form question-answer model according to the total loss function value to obtain the trained form question-answer model.
According to the technical scheme provided by the embodiment of the application, the training samples corresponding to the question-answering tasks and the training samples corresponding to the associated tasks are generated according to the at least one quaternary data set included in the basic data set, so that the training samples corresponding to the question-answering tasks and the training samples corresponding to the associated tasks can be adopted to perform combined training on the table question-answering model, and compared with a single-task training mode, the multi-task training process can effectively enhance the understanding capability of the table question-answering model on the table text and the query problem, improve the robustness of the table question-answering model, and further improve the resolution of the model on the input problem and the accuracy of the output answer.
Referring to fig. 8, a block diagram of a form question-answering device based on a form question-answering model according to one embodiment of the present application is shown. The device has the function of realizing the form question-answering method based on the form question-answering model, and the function can be realized by hardware or can be realized by executing corresponding software by hardware. The apparatus may be the computer device described above or may be provided in a computer device. As shown in fig. 8, the apparatus 800 may include: a question acquisition module 810, a form selection module 820, and an answer output module 830.
The question obtaining module 810 is configured to obtain an input question to be answered.
A form selection module 820, configured to select, according to the input problem, a form text that matches the input problem from a form database as a first form text; wherein at least one of the following is stored in the table database: at least one formatted form corresponds to the form text respectively, and at least one semi-structured form corresponds to the form text respectively.
The answer output module 830 is configured to generate, according to the first table text and the input question, an output answer corresponding to the input question through the table question-answer model, where the table question-answer model is obtained by training a question-answer task and at least one associated task of the question-answer task, and the associated task is a task for training the table question-answer model in association with the question-answer task.
According to the technical scheme provided by the embodiment of the application, the form question-answering method is realized by adopting the form question-answering model obtained by training based on the question-answering task and at least one associated task of the question-answering task, so that the resolution of the input questions can be improved, and the accuracy of the output answers can be improved.
It should be noted that, in the apparatus provided in the foregoing embodiment, when implementing the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the content structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the apparatus and the method embodiments are detailed in the method embodiments and are not repeated herein.
Referring to FIG. 9, a block diagram of a computer device 900 according to one embodiment of the application is shown. The computer device 900 may be any electronic device having data computing, processing, and storage capabilities. The computer device 900 may be used to implement the training method of the form question-answer model provided in the above embodiments, or a form question-answer method based on the form question-answer model.
In general, the computer device 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 901 may also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 901 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 901 may also include an AI processor for processing computing operations related to machine learning.
The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer-readable storage medium in memory 902 is used to store a computer program configured to be executed by one or more processors to implement the training method of the form question-answering model described above, or a form question-answering method based on the form question-answering model.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is not limiting of the computer device 900, and may include more or fewer components than shown, or may combine certain components, or employ a different arrangement of components.
In an exemplary embodiment, a computer readable storage medium is also provided, in which a computer program is stored, which computer program, when being executed by a processor of a computer device, implements the training method of the form question-answering model described above, or a form question-answering method based on the form question-answering model. Alternatively, the above-mentioned computer-readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory ), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, or the like.
In an exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program stored in a computer readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program to cause the computer device to execute the training method of the form question-answer model described above, or the form question-answer method based on the form question-answer model.
It should be noted that, before and during the process of collecting the relevant data of the user, the present application may display a prompt interface, a popup window or output voice prompt information, where the prompt interface, popup window or voice prompt information is used to prompt the user to collect the relevant data currently, so that the present application only starts to execute the relevant step of obtaining the relevant data of the user after obtaining the confirmation operation of the user to the prompt interface or popup window, otherwise (i.e. when the confirmation operation of the user to the prompt interface or popup window is not obtained), the relevant step of obtaining the relevant data of the user is finished, i.e. the relevant data of the user is not obtained. In other words, all user data collected by the method are processed strictly according to the requirements of relevant national laws and regulations, informed consent or independent consent of the personal information body is collected under the condition that the user agrees and authorizes, and the subsequent data use and processing actions are carried out within the scope of laws and regulations and the authorization of the personal information body, and the collection, use and processing of relevant user data are required to comply with relevant laws and regulations and standards of relevant countries and regions.
It should be understood that references herein to "a plurality" are to two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. In addition, the step numbers described herein are merely exemplary of one possible execution sequence among steps, and in some other embodiments, the steps may be executed out of the order of numbers, such as two differently numbered steps being executed simultaneously, or two differently numbered steps being executed in an order opposite to that shown, which is not limiting.
The foregoing description of the exemplary embodiments of the application is not intended to limit the application to the particular embodiments disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the application.

Claims (14)

1. A method for training a form question-answer model, the method comprising:
acquiring a basic data set for training the form question-answering model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises form text, query questions, query sentences and question answers with matching relations; the table text is table content presented in a text form, the query statement is a query instruction for describing the query problem by adopting a table language of the table text, and the question answer is an answer corresponding to the query problem obtained by adopting the query statement to query from the table text;
Generating training samples corresponding to the question-answering tasks according to the quaternary data sets; the training samples corresponding to the question-answering tasks take the form text and the query questions as sample data, and tag data are determined based on the answers of the questions;
generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set, wherein the associated task is a task for training the form question-answering model in a combined mode with the question-answering task; the related tasks comprise a question rewriting task, a sub-table generating task and a thinking chain task, wherein the question rewriting task is used for rewriting a question writing method of the query question according to a table language of the table text, so that the generated rewritten question can accord with a text expression in the table text, the sub-table generating task is used for inquiring item information related to the query question in the table text, generating a sub-table text, the thinking chain task is used for enabling the table question answering model to generate an answer corresponding to the query question according to a thinking chain, the thinking chain is used for firstly generating the rewritten question according to the table text and the query question, then generating the sub-table text and finally generating a thinking mode of the answer;
And training the form question-answer model by adopting a training sample corresponding to the question-answer task and a training sample corresponding to the at least one associated task to obtain a trained form question-answer model.
2. The method of claim 1, wherein the associated task comprises the question-overwriting task;
the generating training samples corresponding to at least one associated task of the question-answer task according to the quaternary data set comprises the following steps:
based on the table language contained in the query statement, rewriting the query question to obtain a first rewritten question described by adopting the table language;
generating training samples corresponding to the problem rewriting tasks according to the table text, the query problem and the first rewriting problem; the training samples corresponding to the question rewriting task take the table text and the query question as sample data, and the first rewriting question as tag data.
3. The method according to claim 2, wherein the method further comprises:
generating a second rewrite problem corresponding to the query problem according to the form text and the query problem through the form question-answer model;
And calculating a first loss function value according to the second rewrite problem and the first rewrite problem, wherein the first loss function value is used for measuring the performance of the form question-answering model on the problem rewrite task.
4. The method of claim 1, wherein the associated tasks comprise the sub-table generation task;
the generating training samples corresponding to at least one associated task of the question-answer task according to the quaternary data set comprises the following steps:
generating a rewritten query statement according to the query question and the query statement, wherein the rewritten query statement is used for querying total attribute data of at least one item related to the query question in the table text;
extracting full attribute data of at least one item related to the query problem from the table text according to the rewritten query statement to obtain a first sub-table text;
generating training samples corresponding to the subtable generating tasks according to the table text, the query questions and the first subtable text; the training samples corresponding to the sub-table generating tasks take the table text and the query questions as sample data, and the first sub-table text as tag data.
5. The method according to claim 4, wherein the method further comprises:
generating a second sub-table text corresponding to the query question according to the table text and the query question through the table question-answering model;
and calculating a second loss function value according to the second sub-table text and the first sub-table text, wherein the second loss function value is used for measuring the performance of the form question-answer model on the sub-table generation task.
6. The method of claim 1, wherein the associated task comprises the mental chain task;
the generating training samples corresponding to at least one associated task of the question-answer task according to the quaternary data set comprises the following steps:
based on the table language contained in the query statement, rewriting the query question to obtain a first rewritten question described by adopting the table language;
generating a rewritten query statement according to the query question and the query statement, wherein the rewritten query statement is used for querying total attribute data of at least one item related to the query question in the table text;
extracting full attribute data of at least one item related to the query problem or the first rewrite problem from the table text according to the rewritten query statement to obtain a first sub-table text;
Generating training samples corresponding to the thinking chain tasks according to the table text, the query questions, the answers to the questions, the first rewrite questions and the first sub-table text; the training samples corresponding to the thinking chain tasks take the table text and the query questions as sample data, and the first rewritten questions, the first sub-table text and the answers to the questions as tag data.
7. The method of claim 6, wherein the method further comprises:
generating a second rewritten question, a second sub-table text and an output answer corresponding to the query question according to the table text and the query question through the table question-answer model;
and calculating a third loss function value according to the difference between the second rewrite problem and the first rewrite problem, the difference between the second sub-table text and the first sub-table text and the difference between the output answer and the question answer, wherein the third loss function value is used for measuring the performance of the form question-answer model on the thinking chain task.
8. The method according to claim 1, wherein generating training samples corresponding to the question-answer task according to the quaternary data set includes:
The question answers are rewritten, so that rewritten question answers are obtained, and the rewritten question answers are described by adopting a table language of the table text;
generating training samples corresponding to the question-answering task according to the form text, the query questions and the rewritten questions; and the training sample corresponding to the question-answering task takes the rewritten question answers as tag data.
9. The method according to any one of claims 1 to 8, wherein training the form question-answer model using the training samples corresponding to the question-answer task and the training samples corresponding to the at least one associated task to obtain a trained form question-answer model includes:
calculating to obtain a total loss function value according to the loss function value corresponding to the question-answer task and the loss function value corresponding to the at least one related task;
and adjusting parameters of the form question-answer model according to the total loss function value to obtain the trained form question-answer model.
10. A form question-answering method based on a form question-answering model, the method comprising:
Acquiring an input question to be answered;
selecting a table text matched with the input problem from a table database according to the input problem as a first table text; wherein at least one of the following is stored in the table database: at least one form text corresponding to the formatting form and at least one form text corresponding to the semi-structuring form respectively;
generating an output answer corresponding to the input question according to the first table text and the input question through the table question-answering model, wherein the table question-answering model is obtained by training a question-answering task and at least one associated task of the question-answering task, and the associated task is a task for training the table question-answering model in combination with the question-answering task; the related tasks comprise a question rewriting task, a sub-table generating task and a thinking chain task, wherein the question rewriting task is used for rewriting a question writing method of the input question according to a table language of the table text, so that the generated rewritten question can accord with a text expression in the table text, the sub-table generating task is used for inquiring item information related to the input question in the table text, generating a sub-table text, the thinking chain task is used for enabling the table question answering model to generate an answer corresponding to the input question according to a thinking chain, and the thinking chain refers to a thinking mode that the rewritten question is firstly generated according to the table text and the input question, then the sub-table text is generated, and finally the answer is generated.
11. A training device for a form question-answer model, the device comprising:
the data set acquisition module is used for acquiring a basic data set for training the form question-answer model, wherein the basic data set comprises at least one quaternary data set, and the quaternary data set comprises form text with a matching relation, a query question, a query statement and a question answer; the table text is table content presented in a text form, the query statement is a query instruction for describing the query problem by adopting a table language of the table text, and the question answer is an answer corresponding to the query problem obtained by adopting the query statement to query from the table text;
the first sample generation module is used for generating training samples corresponding to the question-answer tasks according to the quaternary data sets; the training samples corresponding to the question-answering tasks take the form text and the query questions as sample data, and tag data are determined based on the answers of the questions;
the second sample generation module is used for generating training samples corresponding to at least one associated task of the question-answering task according to the quaternary data set, wherein the associated task is a task for jointly training the form question-answering model with the question-answering task; the related tasks comprise a question rewriting task, a sub-table generating task and a thinking chain task, wherein the question rewriting task is used for rewriting a question writing method of the query question according to a table language of the table text, so that the generated rewritten question can accord with a text expression in the table text, the sub-table generating task is used for inquiring item information related to the query question in the table text, generating a sub-table text, the thinking chain task is used for enabling the table question answering model to generate an answer corresponding to the query question according to a thinking chain, the thinking chain is used for firstly generating the rewritten question according to the table text and the query question, then generating the sub-table text and finally generating a thinking mode of the answer;
And the training module is used for training the form question-answer model by adopting the training sample corresponding to the question-answer task and the training sample corresponding to the at least one associated task to obtain a trained form question-answer model.
12. A form question-answering apparatus based on a form question-answering model, the apparatus comprising:
the question acquisition module is used for acquiring an input question to be answered;
the table selection module is used for selecting a table text matched with the input problem from a table database according to the input problem to serve as a first table text; wherein at least one of the following is stored in the table database: at least one form text corresponding to the formatting form and at least one form text corresponding to the semi-structuring form respectively;
the answer output module is used for generating an output answer corresponding to the input question according to the first table text and the input question through the table question-answering model, the table question-answering model is obtained by training a question-answering task and at least one associated task of the question-answering task, and the associated task is a task for training the table question-answering model in a combined mode with the question-answering task; the related tasks comprise a question rewriting task, a sub-table generating task and a thinking chain task, wherein the question rewriting task is used for rewriting a question writing method of the input question according to a table language of the table text, so that the generated rewritten question can accord with a text expression in the table text, the sub-table generating task is used for inquiring item information related to the input question in the table text, generating a sub-table text, the thinking chain task is used for enabling the table question answering model to generate an answer corresponding to the input question according to a thinking chain, and the thinking chain refers to a thinking mode that the rewritten question is firstly generated according to the table text and the input question, then the sub-table text is generated, and finally the answer is generated.
13. A computer device comprising a processor and a memory, the memory having stored therein a computer program that is loaded and executed by the processor to implement the method of training the form question-answer model of any one of claims 1 to 9 or to implement the form question-answer model-based form question-answer method of claim 10.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, which is loaded and executed by a processor to implement the training method of the form question-answering model according to any one of claims 1 to 9, or to implement the form question-answering method based on the form question-answering model according to claim 10.
CN202311106077.2A 2023-08-30 2023-08-30 Training method, device, equipment and storage medium for form question-answer model Active CN116821696B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311106077.2A CN116821696B (en) 2023-08-30 2023-08-30 Training method, device, equipment and storage medium for form question-answer model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311106077.2A CN116821696B (en) 2023-08-30 2023-08-30 Training method, device, equipment and storage medium for form question-answer model

Publications (2)

Publication Number Publication Date
CN116821696A CN116821696A (en) 2023-09-29
CN116821696B true CN116821696B (en) 2023-11-24

Family

ID=88127843

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311106077.2A Active CN116821696B (en) 2023-08-30 2023-08-30 Training method, device, equipment and storage medium for form question-answer model

Country Status (1)

Country Link
CN (1) CN116821696B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579605A (en) * 2022-04-26 2022-06-03 阿里巴巴达摩院(杭州)科技有限公司 Table question-answer data processing method, electronic equipment and computer storage medium
CN115062126A (en) * 2022-06-08 2022-09-16 北京捷通华声科技股份有限公司 Statement analysis method and device, electronic equipment and readable storage medium
CN116303971A (en) * 2023-03-29 2023-06-23 重庆交通大学 Few-sample form question-answering method oriented to bridge management and maintenance field
CN116303537A (en) * 2023-03-10 2023-06-23 京东科技信息技术有限公司 Data query method and device, electronic equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10127274B2 (en) * 2016-02-08 2018-11-13 Taiger Spain Sl System and method for querying questions and answers
US20220044134A1 (en) * 2020-08-10 2022-02-10 Accenture Global Solutions Limited Intelligent question answering on tabular content

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579605A (en) * 2022-04-26 2022-06-03 阿里巴巴达摩院(杭州)科技有限公司 Table question-answer data processing method, electronic equipment and computer storage medium
CN115062126A (en) * 2022-06-08 2022-09-16 北京捷通华声科技股份有限公司 Statement analysis method and device, electronic equipment and readable storage medium
CN116303537A (en) * 2023-03-10 2023-06-23 京东科技信息技术有限公司 Data query method and device, electronic equipment and storage medium
CN116303971A (en) * 2023-03-29 2023-06-23 重庆交通大学 Few-sample form question-answering method oriented to bridge management and maintenance field

Also Published As

Publication number Publication date
CN116821696A (en) 2023-09-29

Similar Documents

Publication Publication Date Title
CN110427461B (en) Intelligent question and answer information processing method, electronic equipment and computer readable storage medium
CN111581401B (en) Local citation recommendation system and method based on depth correlation matching
CN112085120B (en) Multimedia data processing method and device, electronic equipment and storage medium
CN110866129A (en) Cross-media retrieval method based on cross-media uniform characterization model
CN116721334B (en) Training method, device, equipment and storage medium of image generation model
CN113971222A (en) Multi-mode composite coding image retrieval method and system
CN113392265A (en) Multimedia processing method, device and equipment
Chai Design and implementation of English intelligent communication platform based on similarity algorithm
CN115759119A (en) Financial text emotion analysis method, system, medium and equipment
CN117556067B (en) Data retrieval method, device, computer equipment and storage medium
Aksonov et al. Question-Answering Systems Development Based on Big Data Analysis
CN113240046B (en) Knowledge-based multi-mode information fusion method under visual question-answering task
WO2022095370A1 (en) Text matching method and apparatus, terminal device, and storage medium
CN117094395A (en) Method, device and computer storage medium for complementing knowledge graph
CN117290478A (en) Knowledge graph question-answering method, device, equipment and storage medium
CN117033609A (en) Text visual question-answering method, device, computer equipment and storage medium
CN116821696B (en) Training method, device, equipment and storage medium for form question-answer model
WO2023173552A1 (en) Establishment method for target detection model, application method for target detection model, and device, apparatus and medium
CN114491076B (en) Data enhancement method, device, equipment and medium based on domain knowledge graph
CN116186219A (en) Man-machine dialogue interaction method, system and storage medium
CN115525751A (en) Intelligent question-answering system and method based on knowledge graph
CN115359486A (en) Method and system for determining custom information in document image
CN115129863A (en) Intention recognition method, device, equipment, storage medium and computer program product
CN114372128A (en) Automatic solving method and system for rotationally symmetric geometric volume problem
CN114840680A (en) Entity relationship joint extraction method, device, storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant