IP Library Granted Patent US 12,332,877
Granted Patent B2
US 12,332,877 · App. 17/862,519 · Granted Jun 17, 2025

Method for acquiring structured question-answering model, question-answering method and corresponding apparatus

Inventors: Wenbin Jiang (Beijing, CN); Yajuan Lyu (Beijing, CN); Yong Zhu (Beijing, CN); Hua Wu (Beijing, CN); Haifeng Wang (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
G06F16/243G06F16/212G06F16/245G06N5/02
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,332,877
App. No.
17/862,519
Granted
Jun 17, 2025
Kind
B2
Abstract

The present disclosure discloses a method for acquiring a structured question-answering (QA) model, a QA method and corresponding apparatuses, and relates to knowledge graph and deep learning technologies in the field of artificial intelligence technologies. A specific implementation solution involves: acquiring training samples corresponding to N structured QA database types, the training samples including question samples, information of the structured QA database types and query instruction samples used by the question samples to query structured QA databases of the types, N being an integer greater than 1; and training a text generation model by using the training samples to obtain the structured QA model, wherein the question samples and the information of the structured QA database types are taken as input to the text generation model, and the query instruction samples are taken as target output of the text generation model.

Claims (42)

1. A computer-implemented method for obtaining a structured question-answering (QA) model by training of text generation model, comprising:

acquiring training samples corresponding to N different types of structured QA database, each training sample comprising a question sample, information of the type of a structured QA database and a query instruction sample used by the question sample to query the structured QA database of the type, N being an integer greater than 1, wherein the N different types of structured QA database comprise: table-based structured QA databases and knowledge-based structured QA databases, and the information of the type of the structured QA database comprises: data schema information corresponding to the type of the structured QA database and a task identifier corresponding to the type of the structured QA database, the task identifier indicating the type of structured QA databases queried by the question sample; and

training a text generation model by using the training samples corresponding to N different types of structured QA database to obtain a general structured QA model, wherein the structured QA model is configured to simultaneously use annotation data of a plurality of QA tasks to learn, and share information in the databases and the training samples during the training, and the question samples and the information of the types of structured QA database are taken as input to the text generation model, and the query instruction samples are taken as target output of the text generation model,

wherein the text generation model comprises an encoder and a decoder;

the encoder is configured to encode a sample sequence obtained by splicing the question samples, the structured QA database type information and the query instruction samples in the training samples, to obtain vector representations of Tokens in the sample sequence, wherein the encoder is implemented based on a network layer which comprises a Recurrent Neural Network (RNN) or a Transformer;

the decoder is configured to perform mapping by using the vector representations of the Tokens in the sample sequence, to obtain query instructions which are used to query corresponding structured QA databases for the question sample; and

a training objective of the text generation model is to minimize differences between the query instructions obtained by the decoder and the corresponding query instruction samples.

2. The method according to claim 1 , wherein the step of acquiring training samples corresponding to N different types of structured QA database comprises:

acquiring, from a data set of the N structured QA database types, the question samples and the query instruction samples used by the question samples to query the corresponding structured QA databases; or

acquiring, from a data set of the N different types of structured QA database, the question samples and answers corresponding to the question samples, acquiring, from the corresponding structured QA databases, path information from entities comprised in the question samples to entities comprised in answer samples, and generating, by using the path information, the query instruction samples used by the question samples to query the corresponding structured QA databases.

3. A question-answering (QA) method, comprising:

acquiring questions and information of types of structured QA database;

inputting the questions and the information of the types of structured QA database to a structured QA model, to obtain query instructions outputted by the structured QA model; and

querying a structured QA database corresponding to the type by using the query instructions, to obtain answers corresponding to the questions;

wherein the structured QA database is pre-trained with the method according to claim 1 .

4. The method according to claim 3 , wherein the step of acquiring questions and information of types of structured QA database comprises:

performing task identification on the questions by using a pre-task identification model, to obtain task identifiers to which the questions apply; and

obtaining, by using preset data schema information corresponding to the task identifiers, data schemas corresponding to the questions under the task identifiers to which the questions apply.

5. The method according to claim 3 , wherein the step of acquiring questions and information of types of structured QA database comprises: acquiring M data schemas of the questions under the types of structured QA database respectively, M being a positive integer greater than 1;

the step of inputting the questions and the information of the structured QA database types to a structured QA model, to obtain query instructions outputted by the structured QA model comprises: combining the questions and the obtained M data schemas respectively to obtain M input sequences, and inputting the M input sequences to the structured QA model respectively, to obtain query instructions under the M structured QA database types; and

the step of querying structured QA databases corresponding to the types by using the query instructions, to obtain answers corresponding to the questions comprises: querying the corresponding structured QA databases respectively by using the obtained M query instructions, to obtain M answers; and returning the M answers to a user, or returning the answer with the highest quality.

6. An electronic device, comprising:

at least one processor; and

a memory communicatively connected with the at least one processor;

wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a method for obtaining a structured question-answering (QA) model by training of text generation model, wherein the method comprises:

acquiring training samples corresponding to N different types of structured QA database, each training sample comprising a question sample, information of the type of a structured QA database and a query instruction sample used by the question sample to query the structured QA database of the type, N being an integer greater than 1, wherein the N different types of structured QA database comprise: table-based structured QA databases and knowledge-based structured QA databases, and the information of the type of the structured QA database comprises: data schema information corresponding to the type of the structured QA database and a task identifier corresponding to the type of the structured QA database, the task identifier indicating the type of structured QA databases queried by the question sample; and

training a text generation model by using the training samples corresponding to N different types of structured QA database to obtain a general structured QA model, wherein the structured QA model is configured to simultaneously use annotation data of a plurality of QA tasks to learn, and share information in the databases and the training samples during the training, and the question samples and the information of the types of structured QA database are taken as input to the text generation model, and the query instruction samples are taken as target output of the text generation model,

wherein the text generation model comprises an encoder and a decoder;

the encoder is configured to encode a sample sequence obtained by splicing the question samples, the structured QA database type information and the query instruction samples in the training samples, to obtain vector representations of Tokens in the sample sequence, wherein the encoder is implemented based on a network layer which comprises a Recurrent Neural Network (RNN) or a Transformer;

the decoder is configured to perform mapping by using the vector representations of the Tokens in the sample sequence, to obtain query instructions which are used to query corresponding structured QA databases for the question sample; and

a training objective of the text generation model is to minimize differences between the query instructions obtained by the decoder and the corresponding query instruction samples.

7. The electronic device according to claim 6 , wherein the step of acquiring training samples corresponding to N different types of structured QA database comprises: acquiring, from a data set of the N structured QA database types, the question samples and the query instruction samples used by the question samples to query the corresponding structured QA databases; or acquiring, from a data set of the N different types of structured QA database, the question samples and answers corresponding to the question samples, acquiring, from the corresponding structured QA databases, path information from entities comprised in the question samples to entities comprised in answer samples, and generating, by using the path information, the query instruction samples used by the question samples to query the corresponding structured QA databases.

8. A non-transitory computer readable storage medium with computer instructions stored thereon, wherein the computer instructions are used for causing a method for obtaining a structured question-answering (QA) model by training of text generation model, wherein the method comprises:

acquiring training samples corresponding to N different types of structured QA database, each training sample comprising a question sample, information of the type of a structured QA database and a query instruction sample used by the question sample to query the structured QA database of the type, N being an integer greater than 1, wherein the N different types of structured QA database comprise: table-based structured QA databases and knowledge-based structured QA databases, and the information of the type of the structured QA database comprises: data schema information corresponding to the type of the structured QA database and a task identifier corresponding to the type of the structured QA database, the task identifier indicating the type of structured QA databases queried by the question sample; and

training a text generation model by using the training samples corresponding to N different types of structured QA database to obtain a general structured QA model, wherein the structured QA model is configured to simultaneously use annotation data of a plurality of QA tasks to learn, and share information in the databases and the training samples during the training, and the question samples and the information of the types of structured QA database are taken as input to the text generation model, and the query instruction samples are taken as target output of the text generation model,

wherein the text generation model comprises an encoder and a decoder;

the encoder is configured to encode a sample sequence obtained by splicing the question samples, the structured QA database type information and the query instruction samples in the training samples, to obtain vector representations of Tokens in the sample sequence, wherein the encoder is implemented based on a network layer which comprises a Recurrent Neural Network (RNN) or a Transformer;

the decoder is configured to perform mapping by using the vector representations of the Tokens in the sample sequence, to obtain query instructions which are used to query corresponding structured QA databases for the question sample; and

a training objective of the text generation model is to minimize differences between the query instructions obtained by the decoder and the corresponding query instruction samples.

9. The non-transitory computer readable storage medium according to claim 8 , wherein the step of acquiring training samples corresponding to N different types of structured QA database comprises:

acquiring, from a data set of the N structured QA database types, the question samples and the query instruction samples used by the question samples to query the corresponding structured QA databases; or

acquiring, from a data set of the N different types of structured QA database, the question samples and answers corresponding to the question samples, acquiring, from the corresponding structured QA databases, path information from entities comprised in the question samples to entities comprised in answer samples, and generating, by using the path information, the query instruction samples used by the question samples to query the corresponding structured QA databases.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 12, 2022
From: JIANG, WENBIN; LYU, YAJUAN; ZHU, YONG; WU, HUA; WANG, HAIFENG
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 060481/0205 →
Priority Claims (1)
CN 202110814649.7 · Jul 19, 2021 · national
Continuity (1)
Related Publication 20230018489A1 · Jan 19, 2023
References Cited (26)
US 11301502B1 · Dijamco · 2022 [cited by examiner]
US 12013850B2 · Rahmfeld · 2024 [cited by examiner]
US 20130226846A1 · Ming et al. · 2013 [cited by applicant]
US 20180336198A1 · Zhong · 2018 [cited by examiner]
US 20210049158A1 · Jiao · 2021 [cited by examiner]
US 20210201174A1 · Huang et al. · 2021 [cited by applicant]
US 20210248455A1 · Reddy · 2021 [cited by examiner]
US 20210374133A1 · Lin · 2021 [cited by examiner]
US 20220067281A1 · Hu · 2022 [cited by examiner]
US 20220129450A1 · Cao · 2022 [cited by examiner]
US 20220374420A1 · Relan · 2022 [cited by examiner]
US 20240061833A1 · Tangari · 2024 [cited by examiner]
US 20240061835A1 · Subramanian · 2024 [cited by examiner]
US 20240184829A1 · Roy · 2024 [cited by examiner]
CN 109522393A · 2019 [cited by applicant]
CN 109684354A · 2019 [cited by applicant]
CN 109766417A · 2019 [cited by applicant]
CN 111046154A · 2020 [cited by applicant]
CN 111339246A · 2020 [cited by applicant]
CN 111767381A · 2020 [cited by applicant]
CN 112507098A · 2021 [cited by applicant]
CN 112966089A · 2021 [cited by applicant]
CN 113010693A · 2021 [cited by applicant]
KR 20210038449A · 2021 [cited by applicant]
Extended European Search Report of European patent application No. 22183722.2 issued Dec. 14, 2022, 8 pages. [cited by applicant]
Notice of Grant of Invention Patent Right of Chinese application No. 202110814649.7 dated Apr. 19, 2024, 8 pages. [cited by applicant]