CN117972047A - Document retrieval method and automatic question-answering method - Google Patents

Document retrieval method and automatic question-answering method Download PDF

Info

Publication number
CN117972047A
CN117972047A CN202410032147.2A CN202410032147A CN117972047A CN 117972047 A CN117972047 A CN 117972047A CN 202410032147 A CN202410032147 A CN 202410032147A CN 117972047 A CN117972047 A CN 117972047A
Authority
CN
China
Prior art keywords
document
retrieval
data
text
sample
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.)
Pending
Application number
CN202410032147.2A
Other languages
Chinese (zh)
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.)
Zhejiang Alibaba Robot Co ltd
Original Assignee
Zhejiang Alibaba Robot 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 Zhejiang Alibaba Robot Co ltd filed Critical Zhejiang Alibaba Robot Co ltd
Priority to CN202410032147.2A priority Critical patent/CN117972047A/en
Publication of CN117972047A publication Critical patent/CN117972047A/en
Pending legal-status Critical Current

Links

Classifications

    • 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

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the specification provides a document retrieval method and an automatic question-answering method, wherein the document retrieval method comprises the following steps: acquiring data to be retrieved; according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents; inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document; and according to the data to be searched and the search feedback text, searching the target document from the plurality of documents. By utilizing the strong text understanding and reasoning capability of the pre-training language model, feedback of deviation between at least one candidate document and the retrieval intention of the data to be retrieved is provided in a natural language mode, a plurality of documents are retrieved again according to the feedback to obtain a target document, fully-automatic multi-round retrieval interaction is realized, and the correlation between the target document and the data to be retrieved is improved in an iterative mode.

Description

Document retrieval method and automatic question-answering method
Technical Field
The embodiment of the specification relates to the technical field of computers, in particular to a document retrieval method and an automatic question-answering method.
Background
With the development of computer technology, automated document retrieval (Document Retrieval) is becoming an important research point. Document retrieval refers to a process of searching and returning information related to a large number of document sets through query conditions input by a user.
At present, as the requirements of people on search results are higher and higher, document search is performed by directly utilizing query conditions input by users, and the problem that the relevance between a target document and the query conditions is extremely low due to the fact that the actual search intention cannot be accurately understood easily occurs, so that a document search scheme with high search relevance is needed.
Disclosure of Invention
In view of this, the present embodiment provides a document retrieval method. One or more embodiments of the present disclosure relate to an automatic question-answering method, a document retrieval device, an automatic question-answering device, a computing device, a computer-readable storage medium, and a computer program, so as to solve the technical defects of "the correlation between a retrieved target document and a query condition is extremely low and the accuracy is poor due to the fact that the actual retrieval intention of a user cannot be accurately understood" in the prior art.
According to a first aspect of embodiments of the present specification, there is provided a document retrieval method, including:
Acquiring data to be retrieved;
according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents;
Inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document;
and according to the data to be searched and the search feedback text, searching the target document from the plurality of documents.
According to a second aspect of embodiments of the present specification, there is provided an automatic question-answering method, including:
Acquiring a question to be answered;
Retrieving at least one candidate document from the plurality of documents according to the questions to be answered;
Inputting the questions to be answered and at least one candidate document into a pre-training language model to obtain search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the questions to be answered and the at least one candidate document;
According to the questions to be answered and the retrieval feedback text, retrieving a target document from a plurality of documents;
And generating a reply result corresponding to the to-be-answered question according to the target document.
According to a third aspect of the embodiments of the present specification, there is provided a document retrieval apparatus comprising:
the first acquisition module is configured to acquire data to be retrieved;
the first retrieval module is configured to retrieve at least one candidate document from the plurality of documents according to the data to be retrieved;
The first input module is configured to input data to be searched and at least one candidate document into the pre-training language model to obtain search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document;
and the second retrieval module is configured to retrieve target documents from the plurality of documents according to the data to be retrieved and the retrieval feedback text.
According to a fourth aspect of embodiments of the present specification, there is provided an automatic question-answering apparatus, including:
the second acquisition module is configured to acquire a to-be-answered question;
a third retrieval module configured to retrieve at least one candidate document from the plurality of documents according to the question to be answered;
a second input module configured to input a question to be answered and at least one candidate document into a pre-trained language model, obtaining a search feedback text, wherein the search feedback text is used for describing a deviation between a search intention of the question to be answered and the at least one candidate document;
A fourth retrieval module configured to retrieve a target document from the plurality of documents according to the question to be answered and the retrieval feedback text;
And the generating module is configured to generate a reply result corresponding to the to-be-answered question according to the target document.
According to a fifth aspect of embodiments of the present specification, there is provided a computing device comprising:
A memory and a processor;
The memory is configured to store computer executable instructions that, when executed by the processor, implement the steps of the methods provided in the first or second aspects above.
According to a sixth aspect of embodiments of the present specification, there is provided a computer readable storage medium storing computer executable instructions which when executed by a processor implement the steps of the method provided in the first or second aspect above.
According to a seventh aspect of embodiments of the present specification, there is provided a computer program, wherein the computer program, when executed in a computer, causes the computer to perform the steps of the method provided in the first or second aspect described above.
According to the document retrieval method provided by the embodiment of the specification, data to be retrieved is obtained; according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents; inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document; and according to the data to be searched and the search feedback text, searching the target document from the plurality of documents. By introducing a pre-training language model as an evaluation object of at least one candidate document, and utilizing the strong text understanding and reasoning capability of the pre-training language model, feedback of deviation of at least one candidate document is provided in a natural language mode, a plurality of documents are searched again according to search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, and correlation between the target document and data to be searched is improved in an iterative mode.
Drawings
FIG. 1 is a block diagram of a document retrieval system according to one embodiment of the present disclosure;
FIG. 2 is a block diagram of another document retrieval system provided in one embodiment of the present disclosure;
FIG. 3 is a flow chart of a method for document retrieval provided in one embodiment of the present disclosure;
FIG. 4 is a flow chart of an automatic question-answering method provided by one embodiment of the present disclosure;
FIG. 5 is a process flow diagram of a document retrieval method according to one embodiment of the present disclosure;
FIG. 6 is a flowchart of a document retrieval model processing procedure in a document retrieval method according to one embodiment of the present disclosure;
FIG. 7 is an interface schematic diagram of an automated question-answering interface provided by one embodiment of the present disclosure;
FIG. 8 is a schematic diagram of a document retrieval apparatus according to an embodiment of the present disclosure;
Fig. 9 is a schematic structural diagram of an automatic question answering device according to one embodiment of the present disclosure;
FIG. 10 is a block diagram of a computing device provided in one embodiment of the present description.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many other forms than described herein and similarly generalized by those skilled in the art to whom this disclosure pertains without departing from the spirit of the disclosure and, therefore, this disclosure is not limited by the specific implementations disclosed below.
The terminology used in the one or more embodiments of the specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the specification. As used in this specification, one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "in response to a determination" depending on the context.
Furthermore, it should be noted that, user information (including, but not limited to, user equipment information, user personal information, etc.) and data (including, but not limited to, data for analysis, stored data, presented data, etc.) according to one or more embodiments of the present disclosure are information and data authorized by a user or sufficiently authorized by each party, and the collection, use, and processing of relevant data is required to comply with relevant laws and regulations and standards of relevant countries and regions, and is provided with corresponding operation entries for the user to select authorization or denial.
In one or more embodiments of the present description, a large model refers to a deep learning model with large scale model parameters, typically including hundreds of millions, billions, trillions, and even more than one billion model parameters. The large Model can be called as a Foundation Model, the large Model is pre-trained through a large-scale unlabeled corpus, a pre-trained Model with more than one hundred million parameters is produced, the Model can adapt to a wide downstream task, and the Model has better generalization capability, such as a large-scale language Model (LLM, large Language Model), a multi-modal pre-trained Model (multi-modal pre-training Model) and the like.
When the large model is actually applied, the pretrained model can be applied to different tasks by fine tuning with a small amount of samples, the large model can be widely applied to the fields of natural language processing (NLP, natural Language Processing), computer vision and the like, and particularly can be applied to the tasks of the computer vision fields such as vision question and answer (VQA, visual Question Answering), image description (IC), image generation and the like, and the tasks of the natural language processing fields such as emotion classification based on texts, text abstract generation, machine translation and the like, and main application scenes of the large model comprise digital assistants, intelligent robots, searching, online education, office software, electronic commerce, intelligent design and the like.
First, terms related to one or more embodiments of the present specification will be explained.
Dense search model: the dense search Model (DR, dense Retrieval Model) consists of a query encoder (query encoder) and a document encoder (document encoder). The two encoders vector-encode the query and the document, respectively, and calculate the relevance of the query and the document by a similarity function such as dot product.
The information retrieval is used as a basic task, and has wide application value in various project scenes such as web page search, large language model question-answering and the like. In real life, a variety of search tasks are included, each of which contains a different search intention. The existing dense search model often needs to be trained by a large amount of task related data to enable the model to perceive the search intention of a specific task so as to solve the search task under a related scene, and the dense search model cannot simultaneously solve different search tasks containing different intentions, and also cannot directly understand queries from different downstream search tasks, which may cause a certain deviation between the searched content and the actual search intention. Therefore, how to let the search model understand the search intention of the user is an important factor for determining whether the search result is good or bad.
At present, the instruction understanding capability of a dense retrieval model can be enhanced to better understand the related intention of a specific retrieval task, so that the relevance of a retrieval result is improved. However, the instruction is still a generalized abstract expression of the search intention, and when the natural language instruction input is processed, the instruction is simply added in front of the query, and the input format of the original dense search model is destroyed by this method, so that the potential capability of the instruction is sacrificed to a certain extent, and the search effect is poor.
In order to solve the above problems, the embodiments of the present disclosure provide an automated multi-round interactive search scheme, which uses a large model as an evaluator of a search result, and continuously optimizes a query by natural language feedback for the search result to better match a search intention, and further understand search requirements in different scenes, thereby directly solving various downstream search tasks.
Specifically, obtaining data to be retrieved; according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents; inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document; and according to the data to be searched and the search feedback text, searching the target document from the plurality of documents. By introducing the pre-training language model as an evaluation object of at least one candidate document, namely evaluating the at least one candidate document by utilizing the pre-training language model, and utilizing the strong text understanding and reasoning capability of the pre-training language model, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are searched again according to search feedback text to obtain a target document, so that fully-automatic multi-round search interaction is realized, and the correlation between the target document and data to be searched is improved in an iterative mode.
In the present specification, a document retrieval method is provided, and the present specification relates to an automatic question-answering method, a document retrieval apparatus, an automatic question-answering apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
Referring to fig. 1, fig. 1 illustrates an architecture diagram of a document retrieval system provided in one embodiment of the present description, which may include a client 100 and a server 200;
The client 100 is configured to send data to be retrieved to the server 200;
The server 200 is configured to retrieve at least one candidate document from the plurality of documents according to the data to be retrieved; inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document; according to the data to be searched and the search feedback text, searching a target document from a plurality of documents; sending the target document to the client 100;
The client 100 is further configured to receive the target document sent by the server 200.
By using the scheme of the embodiment of the specification, the pre-training language model is introduced as an evaluation object of at least one candidate document, the strong text understanding and reasoning capability is utilized, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are further searched again according to the search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, and the correlation between the target document and data to be searched is improved in an iterative mode.
Referring to fig. 2, fig. 2 illustrates an architecture diagram of another document retrieval system provided in one embodiment of the present disclosure, where the document retrieval system may include a plurality of clients 100 and a server 200, where the clients 100 may include an end-side device and the server 200 may include a cloud-side device. Communication connection can be established between the plurality of clients 100 through the server 200, in the document retrieval scenario, the server 200 is used to provide document retrieval services between the plurality of clients 100, and the plurality of clients 100 can respectively serve as a transmitting end or a receiving end, and communication is realized through the server 200.
The user may interact with the server 200 through the client 100 to receive data transmitted from other clients 100, or transmit data to other clients 100, etc. In the document retrieval scenario, it may be that the user issues a data stream to the server 200 through the client 100, and the server 200 generates a target document according to the data stream and pushes the target document to other clients establishing communication.
Wherein, the client 100 and the server 200 establish a connection through a network. The network provides a medium for a communication link between client 100 and server 200. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, etc. before being distributed to the server 200.
The client 100 may be a browser, APP (Application), or a web Application such as H5 (HyperText Markup Language, hypertext markup language (htv) 5 th edition) Application, or a light Application (also called applet, a lightweight Application) or cloud Application, etc., and the client 100 may be based on a software development kit (SDK, software Development Kit) of a corresponding service provided by the server 200, such as a real-time communication (RTC, real Time Communication) based SDK development acquisition, etc. The client 100 may be deployed in an electronic device, need to run depending on the device or some APP in the device, etc. The electronic device may for example have a display screen and support information browsing etc. as may be a personal mobile terminal such as a mobile phone, tablet computer, personal computer etc. Various other types of applications are also commonly deployed in electronic devices, such as human-machine conversation type applications, model training type applications, text processing type applications, web browser applications, shopping type applications, search type applications, instant messaging tools, mailbox clients, social platform software, and the like.
The server 200 may include a server that provides various services, such as a server that provides communication services for multiple clients, a server for background training that provides support for a model used on a client, a server that processes data sent by a client, and so on. It should be noted that, the server 200 may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. The server may also be a server of a distributed system or a server that incorporates a blockchain. The server may also be a cloud server for cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN, content Delivery Network), basic cloud computing services such as big data and artificial intelligence platforms, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.
It should be noted that, the document searching method provided in the embodiment of the present specification is generally executed by the server, but in other embodiments of the present specification, the client may have a similar function to the server, so as to execute the document searching method provided in the embodiment of the present specification. In other embodiments, the document retrieval method provided in the embodiments of the present disclosure may be performed by the client and the server together.
Referring to fig. 3, fig. 3 shows a flowchart of a document retrieval method according to an embodiment of the present disclosure, which specifically includes the following steps:
step 302: and obtaining data to be retrieved.
In one or more embodiments of the present disclosure, data to be retrieved may be obtained, so that document retrieval is performed based on the data to be retrieved, and a target document corresponding to the data to be retrieved is obtained.
Specifically, the data to be retrieved is used to describe a document retrieval intention to retrieve a target document from a plurality of documents. The data to be retrieved may be understood as query data. The data to be retrieved may be data in different formats, such as voice data, text data, video data, etc. The data to be retrieved may also be data in different languages, such as english data, chinese data, etc. The data to be retrieved can also be data of different scenes, such as commodity retrieval data of an electronic commerce scene, information retrieval data of a conference scene and the like.
In practical applications, there are various ways of obtaining the data to be retrieved, and the method is specifically selected according to practical situations, which is not limited in any way in the embodiment of the present specification. In one possible implementation manner of the present disclosure, data to be retrieved sent by a user may be received. In another possible implementation manner of the present specification, the data to be retrieved may be read from other data acquisition devices or databases.
Step 304: and retrieving at least one candidate document from the plurality of documents according to the data to be retrieved.
In one or more embodiments of the present disclosure, after the data to be retrieved is obtained, further, at least one candidate document may be retrieved from a plurality of documents according to the data to be retrieved.
Specifically, the plurality of documents refer to documents for retrieval, and the plurality of documents may be extracted from a knowledge base or may be sent by a user. The candidate document refers to a document related to data to be retrieved among a plurality of documents.
In practical applications, there are various ways of retrieving at least one candidate document from a plurality of documents in a knowledge base according to data to be retrieved, and the selection is specifically performed according to practical situations, which is not limited in any way in the embodiments of the present specification.
In one possible implementation of the present description, a search engine may be invoked to retrieve at least one candidate document from a plurality of documents that is related to data to be retrieved.
In another possible implementation manner of the present disclosure, the document retrieval model may be used to retrieve at least one candidate document corresponding to the data to be retrieved from the plurality of documents, that is, the retrieving at least one candidate document from the plurality of documents according to the data to be retrieved may include the following steps:
Inputting the data to be searched and the documents into a document searching model to obtain matching information corresponding to the documents respectively;
And screening at least one candidate document from the plurality of documents according to the matching information corresponding to the plurality of documents.
In particular, the document retrieval model may be a dense retrieval model, and further, to enhance the natural language feedback understanding capabilities of the dense retrieval model, a trainable pluggable module (pluggable module) may be introduced into the dense retrieval model to obtain a parameter-isolated dense retrieval model. The matching information is used for describing the similarity relationship between the data to be retrieved and the document, and the matching information includes, but is not limited to, matching similarity indexes and judging results of whether the data to be retrieved and the document are matched, and is specifically selected according to actual conditions, and the matching information is not limited in any way in the embodiment of the present specification.
It should be noted that, according to the matching information corresponding to each of the plurality of documents, there are various ways of screening at least one candidate document from the plurality of documents, and the selection is specifically performed according to the actual situation, which is not limited in any way in the embodiment of the present disclosure. In one possible implementation of the present disclosure, at least one candidate document may be randomly selected from documents matching the data to be retrieved. In another possible implementation manner of the present disclosure, the plurality of documents may be ranked from large to small according to the matching similarity index, and at least one document ranked first is used as a candidate document.
By applying the scheme of the embodiment of the specification, the data to be searched and a plurality of documents are input into a document searching model, and matching information corresponding to the documents is obtained; and screening at least one candidate document from the plurality of documents according to the matching information corresponding to the plurality of documents. By screening at least one candidate document from the plurality of documents according to the matching information, correlation between the candidate document and the data to be retrieved is ensured.
In an alternative embodiment of the present specification, a document retrieval model includes a retrieval encoding unit, a document encoding unit, and a matching unit; the above-mentioned inputting the data to be retrieved and the plurality of documents into the document retrieval model to obtain the matching information corresponding to the plurality of documents respectively may include the following steps:
the data to be searched is coded by a search coding unit to obtain a search embedded vector;
respectively encoding a plurality of documents by a document encoding unit to obtain document embedded vectors;
And determining matching information corresponding to the plurality of documents respectively according to the search embedded vector and the document embedded vector through a matching unit.
In particular, the search encoding unit may be understood as a query encoder, and the document encoding unit may be understood as a document encoder. The search coding unit is used for coding the data to be searched to obtain a search embedded vector. The document encoding unit is used for encoding a plurality of documents to obtain document embedded vectors.
In practical application, after obtaining the search embedded vector and the document embedded vector of each document, the search embedded vector and the document embedded vector may be input into a matching unit, where matching information between the data to be searched and the document is determined by using similarity functions such as dot product, euclidean distance, and the like.
It should be noted that, when determining matching information corresponding to each of the plurality of documents according to the search embedded vector and the document embedded vector, a similarity threshold may be set, and if a matching similarity index between the data to be searched and the document is greater than or equal to the similarity threshold, it is determined that the data to be searched and the document are matched; and if the matching similarity index between the data to be searched and the document is smaller than the similarity threshold value, determining that the data to be searched and the document are not matched.
By applying the scheme of the embodiment of the specification, the data to be searched is encoded by a search encoding unit to obtain a search embedded vector; respectively encoding a plurality of documents by a document encoding unit to obtain document embedded vectors; and the matching unit is used for determining matching information corresponding to the plurality of documents respectively according to the search embedded vector and the document embedded vector, and the two coding units are used for coding the data to be searched and the plurality of documents respectively, so that coding confusion is avoided, and meanwhile, the generation efficiency of the matching information is improved.
Step 306: and inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document.
In one or more embodiments of the present disclosure, data to be retrieved is obtained; further, after at least one candidate document is retrieved from a plurality of documents according to the data to be retrieved, the pre-training language model has a large-scale model parameter, so that the pre-training language model has strong text understanding and reasoning capability, feedback of deviation of the at least one candidate document can be provided in a natural language mode, and therefore the pre-training language model can be utilized to evaluate the at least one candidate document to obtain retrieval feedback text, namely, the data to be retrieved and the at least one candidate document are input into the pre-training language model to obtain retrieval feedback text.
It should be noted that the pre-training language model may be a large model, or may be a model obtained by training a neural network model of natural language with training search data, training documents, and training feedback text labels. The retrieval feedback text characterizes the problem feedback of at least one candidate document obtained by current retrieval and can be also understood as natural language feedback. The search intention may be understood as a query intention, which refers to a target that a user wants to reach when performing a document search or a document type that the user wants to acquire.
In practical application, when the data to be searched and at least one candidate document are input into the pre-training language model, a prompt learning mode or a zero sample learning or a small number of sample learning modes can be adopted, so that the pre-training language model accurately outputs the search feedback text. For example, search prompt information (e.g., the data to be searched sent by the user is [ data to be searched ] and the candidate document is [ candidate document ]. Please describe the deviation of the search intention of the candidate document and the data to be searched), the data to be searched and at least one candidate document are represented as a coherent input sequence to the pre-training language model by using the search prompt information, so as to obtain the search feedback text. For another example, a sample retrieval data and sample document pair with a sample retrieval feedback text label may be additionally taken as an example, and the data to be retrieved and at least one candidate document are input into a pre-training language model, so that the pre-training language model may learn from the example to a manner of generating the retrieval feedback text, thereby outputting the retrieval feedback text.
Step 308: and according to the data to be searched and the search feedback text, searching the target document from the plurality of documents.
In one or more embodiments of the present disclosure, data to be retrieved is obtained; according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents; and inputting the data to be searched and at least one candidate document into a pre-training language model to obtain a search feedback text, and further, searching a target document from a plurality of documents according to the data to be searched and the search feedback text.
It should be noted that the target document refers to a document, which is associated with the data to be retrieved, among the plurality of documents and satisfies the retrieval intention of the data to be retrieved.
By using the scheme of the embodiment of the specification, the pre-training language model is introduced as an evaluation object of at least one candidate document, the strong text understanding and reasoning capability is utilized, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are further searched again according to the search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, and the correlation between the target document and data to be searched is improved in an iterative mode.
In practical application, according to the data to be searched and the search feedback text, the mode of searching the target document from the plurality of documents is various, and the mode is specifically selected according to the practical situation, and the embodiment of the specification does not limit the mode. In one possible implementation manner of the present disclosure, a search engine may be invoked to retrieve a target document from a plurality of documents according to data to be retrieved and a retrieval feedback text. In another possible implementation manner of the present disclosure, the document retrieval model may be used to retrieve the target document from the plurality of documents according to the data to be retrieved and the retrieval feedback text.
In an alternative embodiment of the present disclosure, the target document may not be directly retrieved from the plurality of documents according to the data to be retrieved and the retrieval feedback text, so that multiple rounds of iterative retrieval may be performed according to the data to be retrieved and the retrieval feedback text, that is, the target document may be retrieved from the plurality of documents according to the data to be retrieved and the retrieval feedback text, which may include the following steps:
Determining updated matching information corresponding to the documents respectively according to the data to be searched, the search feedback text and the document embedded vectors of the documents through a document search model;
And screening at least one updated candidate document from the plurality of documents according to the updated matching information, and returning to the step of inputting the data to be retrieved and the at least one candidate document into the pre-training language model to obtain the retrieval feedback text until a first preset stopping condition is reached, thereby obtaining the target document.
Specifically, the first preset stopping condition includes, but is not limited to, that the iteration number reaches the first iteration number, that the search feedback text indicates that there is no deviation between the search intention of the data to be searched and at least one candidate document, that the at least one candidate document can meet the processing requirement of the downstream task, and that the selection is specifically performed according to the actual situation, and the embodiment of the present specification does not limit the process.
It should be noted that, when determining updated matching information corresponding to a plurality of documents respectively according to data to be searched, a search feedback text and document embedding vectors of the plurality of documents through a document search model, in one possible implementation manner, the document embedding vectors of the plurality of documents are obtained by encoding the search feedback text by encoding the document search model and encoding the plurality of documents, that is, the data to be searched can be directly input into a search encoding unit, and the search feedback text and the plurality of documents are input into the document encoding unit to obtain updated matching information corresponding to the plurality of documents respectively. In another possible implementation manner, since the document encoding unit in the document retrieval model has encoded a plurality of documents once to obtain the document embedded vector in the first round of retrieval, in order to avoid the time overhead required for recoding all the documents, in this embodiment of the present disclosure, the original parameters of the retrieval encoding unit may be frozen, and a trainable pluggable module, that is, the second encoding subunit may be cloned, and the retrieval feedback text is encoded by using the second encoding subunit, and the document embedded vector obtained by the first round of encoding is multiplexed, so that the encoded plurality of documents do not need to be encoded redundantly.
By applying the scheme of the embodiment of the specification, updated matching information corresponding to a plurality of documents respectively is determined through a document retrieval model according to the data to be retrieved, the retrieval feedback text and the document embedding vectors of the plurality of documents; according to the updated matching information, at least one candidate document after updating is screened out from the plurality of documents, the step of inputting the data to be searched and the at least one candidate document into a pre-training language model is returned to be executed, the search feedback text is obtained until a first preset stopping condition is reached, the target document is obtained, the plurality of documents are searched again according to the search feedback text, the target document is obtained, the full-automatic multi-cycle search interaction is realized, and the correlation between the target document and the data to be searched is improved in an iterative mode.
In an alternative embodiment of the present specification, a document retrieval model includes a retrieval encoding unit including a first encoding subunit, a second encoding subunit, and a fusion unit; the above-mentioned document retrieval model, according to the data to be retrieved, the retrieval feedback text and the document embedding vectors of the plurality of documents, determines updated matching information corresponding to the plurality of documents respectively, may include the following steps:
encoding the data to be retrieved by a first encoding subunit to obtain a first embedded vector;
Encoding the data to be retrieved and the retrieval feedback text by a second encoding subunit to obtain a second embedded vector;
The first embedded vector and the second embedded vector are fused through a fusion unit to obtain an updated retrieval embedded vector;
And determining updated matching information corresponding to the plurality of documents respectively according to the updated search embedded vector and the document embedded vectors of the plurality of documents.
Specifically, the first coding subunit refers to a coding unit for coding data to be retrieved in the dense retrieval model. The second encoding subunit refers to a trainable, pluggable module that additionally receives the search feedback text as input. The first coding subunit and the second coding subunit have the same structure, and the unit parameters may be the same or different.
When determining updated matching information corresponding to each of the plurality of documents according to the updated search embedded vector and the document embedded vectors of the plurality of documents, the search embedded vector and the document embedded vector may be input into a matching unit of the document search model to obtain updated matching information corresponding to each of the plurality of documents.
By applying the scheme of the embodiment of the specification, the first embedded vector is obtained by encoding the data to be retrieved through the first encoding subunit; encoding the data to be retrieved and the retrieval feedback text by a second encoding subunit to obtain a second embedded vector; the first embedded vector and the second embedded vector are fused through a fusion unit to obtain an updated retrieval embedded vector; and the root updated search embedded vector and the document embedded vectors of the plurality of documents determine updated matching information corresponding to the plurality of documents respectively. The input and output consistency of the second coding subunit and the original retrieval coding unit is ensured without introducing extra noise when the retrieval feedback text is introduced, and the output equality of the second coding subunit and the first coding subunit is ensured, so that the dense retrieval model has the new capability of controllable retrieval under the guidance of the retrieval feedback text while effectively retaining the original function.
In an alternative embodiment of the present disclosure, two sets of fully connected layers with parameter weights initialized to 0 are constructed in the document retrieval model, that is, the second coding subunit includes a first linear layer, a coding layer and a second linear layer; the encoding of the data to be retrieved and the retrieval feedback text by the second encoding subunit to obtain a second embedded vector may include the following steps:
Linearly mapping the search feedback text through a first linear layer to obtain a first mapping embedded vector;
The data to be retrieved and the first mapping embedded vector are encoded by an encoding layer to obtain an embedded vector;
And linearly mapping the embedded vector through a second linear layer to obtain a second embedded vector.
Specifically, the first linear layer is used for linear mapping retrieval of the input representation of the feedback text, and a first mapping embedded vector is obtained. The first mapped embedded vector and the retrieved embedded vector of the data to be retrieved are added as inputs to the encoding layer. The second linear layer is used for linearly mapping the output of the coding layer to obtain a second embedded vector.
By applying the scheme of the embodiment of the specification, the search feedback text is linearly mapped through the first linear layer to obtain a first mapping embedded vector; the data to be retrieved and the first mapping embedded vector are encoded by an encoding layer to obtain an embedded vector; the second embedded vector is obtained through the second linear layer by linear mapping of the embedded vector, so that the dense retrieval model has the new controllable retrieval capability under the guidance of the retrieval feedback text while the original functions are effectively reserved.
In an optional embodiment of the present disclosure, after retrieving the target document from the plurality of documents according to the data to be retrieved and the retrieval feedback text, the method may further include the following steps:
And receiving adjustment data sent by the user based on the target document, and adjusting model parameters of the pre-training language model according to the adjustment data.
It should be noted that, after obtaining the target document, the target document may be sent to the client, so that the client may display the target document to the user. The client may display the target document to the user in various manners, and the method is specifically selected according to the actual situation, which is not limited in any way in the embodiment of the present specification. In one possible implementation of the present description, the target document may be directly presented to the user. In another possible implementation manner of the present disclosure, the target document may be displayed to the user according to the display requirement information of the user. The display requirement information characterizes the requirement of a user for viewing the target document, and the display requirement information comprises, but is not limited to, displaying only the target document, displaying a storage path of the target document, displaying data to be retrieved and the target document.
In practical applications, the user may be dissatisfied with the target document, at this time, adjustment data sent by the user based on the target document may be received, and model parameters of the pre-training language model may be adjusted according to the adjustment data. Wherein the adjustment data includes, but is not limited to, the adjusted target document. Further, model parameters of the document retrieval model may also be adjusted based on the adjustment data.
By applying the scheme of the embodiment of the specification, the adjustment data sent by the user based on the target document is received, and the model parameters of the pre-training language model are adjusted according to the adjustment data, so that the pre-training language model can be updated based on the data fed back by the user, the accuracy of the pre-training language model is improved, and meanwhile, the user experience is improved.
In an optional embodiment of the present disclosure, before inputting the data to be retrieved and the plurality of documents into the document retrieval model to obtain the matching information corresponding to each of the plurality of documents, the method may further include the following steps:
Acquiring a sample set, wherein the sample set comprises a plurality of sample retrieval data and sample tag documents corresponding to the plurality of sample retrieval data respectively, and the sample retrieval data carries sample intention texts;
Inputting sample retrieval data and sample intention text carried by the sample retrieval data into an initial document retrieval model to obtain a prediction result;
and according to the prediction result and the sample label document, adjusting model parameters of the initial document retrieval model to obtain a trained document retrieval model.
Specifically, the sample intention text refers to text describing a sample retrieval intention. The training process of the document retrieval model is supervised training, namely, each sample retrieval data in the sample set corresponds to a real sample label document, and the sample label document accords with the sample retrieval intention of the sample retrieval data.
In practical applications, there are various ways of obtaining the sample set, and the sample set is specifically selected according to practical situations, which is not limited in any way in the embodiment of the present disclosure. In one possible implementation of the present disclosure, a sample set sent by a user may be received. In another possible implementation of the present description, the sample set may be read from other data acquisition devices or databases.
It should be noted that, the manner of inputting the sample retrieval data and the sample intention text carried by the sample retrieval data into the initial document retrieval model to obtain the prediction result may refer to the manner of inputting the data to be retrieved and the plurality of documents into the document retrieval model to obtain the matching information corresponding to the plurality of documents respectively; according to the matching information corresponding to each of the plurality of documents, the implementation manner of screening at least one candidate document from the plurality of documents is not described in detail in this specification.
Further, when the sample set is used for training the initial document retrieval model, a two-stage iterative comparison learning mode can be adopted. The first stage, the training of comparing and learning is carried out on an initial document retrieval model by utilizing a positive sample subset and a first negative sample subset, the parameters of a second linear layer and a coding layer are fixed in the training process, the parameters of the first linear layer are only adjusted, and the negative log likelihood of a positive sample intention text is optimized so as to strengthen the understanding capability of the model on the sample intention text; and in the second stage, the positive sample subset and the second negative sample subset are utilized to carry out the training of contrast learning on the initial document retrieval model, a first linear layer is fixed in the training process, the parameters of a second linear layer and a coding layer are adjusted, and the negative log likelihood of the positive sample label document is optimized so as to strengthen the controllable retrieval capability of the document retrieval model under the guidance of the sample intention text. The two stages are iterated, so that the performance of the model is fully enhanced.
By applying the scheme of the embodiment of the specification, the model parameters of the initial document retrieval model are adjusted according to the prediction result and the sample label document, the trained document retrieval model is obtained, and the finally obtained document retrieval model is more accurate by continuously adjusting the model parameters of the initial document retrieval model.
In an alternative embodiment of the present disclosure, a sample set utilized in an iterative contrast learning process includes a positive sample subset, a first negative sample subset, and a second negative sample subset; the acquiring the sample set may include the following steps:
acquiring a positive sample subset, wherein the positive sample subset comprises a plurality of positive sample retrieval data and positive sample label documents corresponding to the positive sample retrieval data, and the positive sample retrieval data carries positive sample intention texts;
Adjusting the positive sample intention text to negative sample intention text which does not match the positive sample intention text, and constructing a first negative sample subset according to the positive sample retrieval data, the positive sample label document and the negative sample intention text;
The positive sample tag document is adjusted to a negative sample tag document that does not match the positive sample tag document, and a second negative sample subset is constructed from the positive sample retrieval data, the negative sample tag document, and the positive sample intention text.
Specifically, the positive sample intention text refers to text that accurately describes the sample retrieval intention of the positive sample retrieval data. Negative sample intent text refers to text that erroneously describes sample retrieval intent of positive sample retrieval data. A positive sample tag document refers to a sample tag document that satisfies a sample retrieval intention of sample retrieval data. A positive sample tag document refers to a sample tag document that does not satisfy the sample retrieval intent of the sample retrieval data.
In practical applications, there are various ways to adjust the positive sample intention text to the negative sample intention text that does not match the positive sample intention text, and the embodiment of the present disclosure does not limit this in any way. In one possible implementation manner of the present disclosure, the intention keyword extraction may be performed on the positive sample intention text, and the intention keyword in the positive sample intention text may be randomly replaced by a word with contradictory word sense, so as to obtain the negative sample intention text. In another possible implementation manner of the present specification, word sense contradiction words may be directly added to the positive sample intention text, so as to obtain the negative sample intention text.
It should be noted that, the manner of "adjusting the positive sample tab document to the negative sample tab document that does not match the positive sample tab document" may refer to the implementation manner of "adjusting the positive sample intention text to the negative sample intention text that does not match the positive sample intention text" described above; the manner of "obtaining the positive sample subset" may refer to the implementation manner of "obtaining the sample set" described above, and the embodiments of this specification will not be repeated herein.
Applying the solution of the embodiment of the present specification, obtaining a positive sample subset; adjusting the positive sample intention text to negative sample intention text which does not match the positive sample intention text, and constructing a first negative sample subset according to the positive sample retrieval data, the positive sample label document and the negative sample intention text; and adjusting the positive sample tag document into a negative sample tag document which is not matched with the positive sample tag document, and constructing a second negative sample subset according to the positive sample retrieval data, the negative sample tag document and the positive sample intention text, so that a guarantee is provided for the iterative comparison learning process of the initial document retrieval model.
In an alternative embodiment of the present specification, a fine-grained sample intention text may be generated using a text generation model, and a positive sample subset may be constructed using the sample intention text, that is, the above-mentioned acquiring of the positive sample subset may include the steps of:
Acquiring a plurality of sample retrieval intents;
inputting text generation prompt information and a first sample retrieval intention into a text generation model aiming at the first sample retrieval intention to obtain a first positive sample intention text corresponding to the first sample retrieval intention, wherein the first sample retrieval intention is any one of a plurality of sample retrieval intents;
and constructing a positive sample subset according to the positive sample intention texts respectively corresponding to the plurality of sample retrieval intents.
It should be noted that the sample intention text may be understood as a retrieval requirement. The manner of obtaining the plurality of sample retrieval intents is various, and specifically selected according to the actual situation, and the embodiment of the present disclosure is not limited in any way. In one possible implementation of the present disclosure, a plurality of sample retrieval intents sent by a user may be received. In another possible implementation of the present description, multiple sample retrieval intents may be read from other data acquisition devices or databases. The text generation model may be a large model or a model obtained by training a natural language neural network model based on a plurality of training search intentions and training text labels corresponding to the training search intentions.
The text generation hint information is used to instruct the text generation model to generate positive sample intent text. The text generation hint information may include the generation requirements of the positive sample intent text. By way of example, the generation requirement of positive sample intent text may be: the generated positive sample intent text is to explicitly outline the sample retrieval intent, the positive sample intent text describing how the sample tag text is associated with the sample retrieval data, e.g., whether the sample tag text answers a question in the sample retrieval data. In positive sample intent text, it is desirable to specify the intended source or subject of the retrieved sample tag text, such as scientific encyclopedia or legal encyclopedia. In the generated positive sample intention text, a text block to be retrieved, such as a document or paragraph, needs to be defined.
In practical application, when a positive sample subset is constructed according to positive sample intention texts respectively corresponding to a plurality of sample search intents, positive sample search text pairs corresponding to the positive sample intention texts can be obtained, and the positive sample search text pairs comprise positive sample search data and positive sample label documents. The method for obtaining the positive sample retrieval text pair is various, and is specifically selected according to practical situations, and the embodiment of the present disclosure is not limited in any way. In one possible implementation manner of the present disclosure, a positive sample retrieval text pair corresponding to each of a plurality of positive sample intention texts sent by a user may be received. In another possible implementation manner of the present specification, a plurality of positive sample retrieval text pairs corresponding to the positive sample intention texts respectively may be read from other data acquisition devices or databases.
By applying the scheme of the embodiment of the specification, a plurality of sample retrieval intents are obtained; inputting text generation prompt information and the first sample retrieval intention into a text generation model aiming at the first sample retrieval intention; and constructing a positive sample subset according to the positive sample intention texts respectively corresponding to the plurality of sample retrieval intents. The method realizes efficient and accurate construction of the positive sample subset through the text generation model.
In an optional embodiment of the present disclosure, the constructing a positive sample subset according to the positive sample intention text corresponding to each of the plurality of sample retrieval intents may include the following steps:
inputting data generation prompt information and first positive sample intention text into a data generation model to obtain a first positive sample retrieval text pair, wherein the first positive sample retrieval text pair comprises first positive sample retrieval data and a first positive sample tag document, and the first positive sample intention text is a text corresponding to the first sample retrieval intention;
And constructing a positive sample subset according to the positive sample intention texts and the positive sample retrieval text pairs respectively corresponding to the positive sample intention texts.
Specifically, the data generation model may be a large model, or may be a model obtained by training a neural network model of a natural language based on a plurality of training sample intention texts and training sample intention text labels corresponding to the training sample intention texts.
The data generation hint information is used to instruct the data generation model to generate a positive sample retrieval text pair. The data generation hint information may include the generation requirements of the positive sample retrieval text pair. Illustratively, the generation requirement of the positive sample retrieval text pair may be: from the positive sample intent text, the positive sample tag document you generate should be < body >. The connection between the generated positive sample retrieval data and the positive sample tag document should correspond to the relationship specified in the positive sample intent text.
By applying the scheme of the embodiment of the specification, the data generation prompt message and the first positive sample intention text are input into a data generation model to obtain a first positive sample retrieval text pair; and constructing a positive sample subset according to the positive sample intention texts and the positive sample retrieval text pairs respectively corresponding to the positive sample intention texts. The method and the device realize that the data generation model is utilized to generate the positive sample retrieval text pairs consistent with the positive sample intention text theme and/or the organization format, and improve the accuracy of the positive sample subset.
The document searching method provided in the present specification will be further described with reference to fig. 4 by taking an application of the document searching method in an automatic question-answering scenario as an example. Fig. 4 shows a flowchart of an automatic question-answering method according to an embodiment of the present disclosure, which specifically includes the following steps:
Step 402: and acquiring the questions to be answered.
Step 404: at least one candidate document is retrieved from the plurality of documents based on the question to be answered.
Step 406: and inputting the questions to be answered and the at least one candidate document into a pre-training language model to obtain retrieval feedback text, wherein the retrieval feedback text is used for describing the deviation between the retrieval intention of the questions to be answered and the at least one candidate document.
Step 408: and according to the questions to be answered and the retrieval feedback text, retrieving the target document from the plurality of documents.
Step 410: and generating a reply result corresponding to the to-be-answered question according to the target document.
It should be noted that, the implementation manners of step 402 to step 408 may refer to the implementation manners of step 302 to step 308, and the description of the embodiment of the present disclosure is omitted. The answer result can be directly extracted from the target document, and can also be obtained by reasoning the target document based on the questions to be answered.
By using the scheme of the embodiment of the specification, the pre-training language model is introduced as an evaluation object of at least one candidate document, the strong text understanding and reasoning capability is utilized, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are searched again according to the search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, the correlation between the target document and a question to be answered is improved in an iterative mode, and the accuracy of a reply result is further improved.
Referring to fig. 5, fig. 5 shows a flowchart of a processing procedure of a document retrieval method provided in an embodiment of the present disclosure, in a document retrieval process, a document retrieval model and a pre-training language model are first combined and expanded into a multi-round interaction manner, and retrieval feedback text is used as an aid, so as to optimize a document retrieval result, for example, three rounds of interactions:
First round: inputting the data to be searched and the documents into a document searching model to obtain matching information corresponding to the documents respectively; screening candidate document 1 from the plurality of documents according to the matching information corresponding to the plurality of documents respectively; inputting the data to be searched and the candidate document 1 into a pre-training language model to obtain a search feedback text 1;
A second wheel: inputting the data to be searched and the search feedback text 1 into a document search model to obtain updated matching information corresponding to a plurality of documents respectively; screening candidate documents 2 from the plurality of documents according to the matching information corresponding to the plurality of documents respectively; inputting the data to be searched and the candidate document 2 into a pre-training language model to obtain a search feedback text 2;
Third wheel: inputting the data to be searched and the search feedback text 2 into a document search model to obtain updated matching information corresponding to a plurality of documents respectively; and screening candidate documents 3 from the plurality of documents according to the matching information corresponding to the plurality of documents respectively, and taking the candidate documents 3 as target documents.
By applying the scheme of the embodiment of the specification, the scheme provided by the embodiment of the specification constructs a multi-task universal multi-round automatic interactive document retrieval model, automatically realizes multi-round iterative optimization, and provides natural language feedback for each round of retrieval result by the pre-training language model on the basis of no manual intervention, so that the document retrieval model automatically improves the retrieval performance based on the current feedback to continuously optimize the retrieval result, thereby realizing a controllable retrieval process.
Referring to fig. 6, fig. 6 shows a flowchart of a processing procedure of a document retrieval model in a document retrieval method provided in an embodiment of the present specification, the document retrieval model including a retrieval encoding unit, a document encoding unit, and a matching unit; the retrieval coding unit comprises a first coding subunit, a second coding subunit and a fusion unit; the second coding subunit includes a first linear layer, a coding layer, and a second linear layer;
respectively encoding a plurality of documents by a document encoding unit to obtain document embedded vectors; encoding the data to be retrieved by a first encoding subunit to obtain a first embedded vector; through the first linear layer, linear mapping is carried out on the feedback text embedded vector for retrieving the feedback text to obtain a first mapped embedded vector; adding the first mapping embedded vector and the embedded vector of the data to be retrieved to obtain the data to be encoded; the coding layer codes the data to be coded to obtain an embedded vector; linearly mapping the embedded vector through a second linear layer to obtain a second embedded vector; adding the first embedded vector and the second embedded vector through a fusion unit to obtain a retrieval embedded vector; and determining matching information corresponding to the plurality of documents respectively according to the search embedded vector and the document embedded vector through a matching unit.
By applying the scheme of the embodiment of the specification, the embodiment of the specification provides a document retrieval model of a parameter isolation architecture, and by introducing a pluggable second coding subunit on the basis of not damaging the original dense retrieval model, on one hand, the original capability of the original dense retrieval model is reserved, and on the other hand, the novel capability of controllable retrieval according to natural language feedback is effectively given.
Referring to fig. 7, fig. 7 is an interface schematic diagram of an automatic question-answering interface according to one embodiment of the present disclosure. The automatic question-answering interface is divided into a request input interface and a result display interface. The request input interface includes a request input box, a "determine" control, and a "cancel" control. The result display interface comprises a result display frame.
The method comprises the steps that a user inputs an automatic question and answer request through a request input box displayed by a client, wherein the automatic question and answer request carries a to-be-answered question, the user clicks a 'determination' control, a server receives the to-be-answered question sent by the client, and at least one candidate document is retrieved from a plurality of documents according to the to-be-answered question; inputting the questions to be answered and at least one candidate document into a pre-training language model to obtain search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the questions to be answered and the at least one candidate document; according to the questions to be answered and the retrieval feedback text, retrieving a target document from a plurality of documents; and generating a reply result corresponding to the to-be-answered question according to the target document, and sending the reply result to the client. The client displays the reply result in the result display frame.
In practical applications, the manner in which the user operates the control includes any manner such as clicking, double clicking, touch control, mouse hovering, sliding, long pressing, voice control or shaking, and the like, and the selection is specifically performed according to the practical situation, which is not limited in any way in the embodiments of the present disclosure.
Corresponding to the above-mentioned document retrieval method embodiment, the present specification also provides a document retrieval apparatus embodiment, and fig. 8 shows a schematic structural diagram of a document retrieval apparatus provided in one embodiment of the present specification. As shown in fig. 8, the apparatus includes:
A first acquisition module 802 configured to acquire data to be retrieved;
A first retrieval module 804 configured to retrieve at least one candidate document from the plurality of documents according to the data to be retrieved;
A first input module 806 configured to input data to be retrieved and at least one candidate document into a pre-trained language model, obtaining a retrieval feedback text, wherein the retrieval feedback text is used to describe a deviation between a retrieval intent of the data to be retrieved and the at least one candidate document;
a second retrieval module 808 is configured to retrieve a target document from the plurality of documents based on the data to be retrieved and the retrieved feedback text.
Optionally, the first retrieval module 804 is further configured to input the data to be retrieved and the plurality of documents into a document retrieval model to obtain matching information corresponding to the plurality of documents respectively; and screening at least one candidate document from the plurality of documents according to the matching information corresponding to the plurality of documents.
Optionally, the document retrieval model includes a retrieval encoding unit, a document encoding unit, and a matching unit; the first search module 804 is further configured to obtain a search embedded vector by encoding the data to be searched through the search encoding unit; respectively encoding a plurality of documents by a document encoding unit to obtain document embedded vectors; and determining matching information corresponding to the plurality of documents respectively according to the search embedded vector and the document embedded vector through a matching unit.
Optionally, the second retrieving module 808 is further configured to determine updated matching information corresponding to the plurality of documents respectively according to the data to be retrieved, the retrieval feedback text and the document embedding vectors of the plurality of documents via the document retrieving model; and screening at least one updated candidate document from the plurality of documents according to the updated matching information, and returning to the step of inputting the data to be retrieved and the at least one candidate document into the pre-training language model to obtain the retrieval feedback text until a first preset stopping condition is reached, thereby obtaining the target document.
Optionally, the document retrieval model comprises a retrieval coding unit, and the retrieval coding unit comprises a first coding subunit, a second coding subunit and a fusion unit; the second retrieving module 808 is further configured to encode the data to be retrieved via the first encoding subunit to obtain a first embedded vector; encoding the data to be retrieved and the retrieval feedback text by a second encoding subunit to obtain a second embedded vector; the first embedded vector and the second embedded vector are fused through a fusion unit to obtain an updated retrieval embedded vector; and determining updated matching information corresponding to the plurality of documents respectively according to the updated search embedded vector and the document embedded vectors of the plurality of documents.
Optionally, the second coding subunit includes a first linear layer, a coding layer, and a second linear layer; the second retrieving module 808 is further configured to linearly map the retrieved feedback text to obtain a first mapped embedded vector via the first linear layer; the data to be retrieved and the first mapping embedded vector are encoded by an encoding layer to obtain an embedded vector; and linearly mapping the embedded vector through a second linear layer to obtain a second embedded vector.
Optionally, the apparatus further comprises: and the receiving module is configured to receive adjustment data sent by a user based on the target document and adjust model parameters of the pre-training language model according to the adjustment data.
Optionally, the apparatus further comprises: the document retrieval model training module is configured to acquire a sample set, wherein the sample set comprises a plurality of sample retrieval data and sample label documents respectively corresponding to the plurality of sample retrieval data, and the sample retrieval data carries sample intention text; inputting sample retrieval data and sample intention text carried by the sample retrieval data into an initial document retrieval model to obtain a prediction result; and according to the prediction result and the sample label document, adjusting model parameters of the initial document retrieval model to obtain a trained document retrieval model.
Optionally, the sample set comprises a positive sample subset, a first negative sample subset, and a second negative sample subset; the document retrieval model training module is further configured to acquire a positive sample subset, wherein the positive sample subset comprises a plurality of positive sample retrieval data and positive sample label documents corresponding to the positive sample retrieval data, and the positive sample retrieval data carries positive sample intention text; adjusting the positive sample intention text to negative sample intention text which does not match the positive sample intention text, and constructing a first negative sample subset according to the positive sample retrieval data, the positive sample label document and the negative sample intention text; the positive sample tag document is adjusted to a negative sample tag document that does not match the positive sample tag document, and a second negative sample subset is constructed from the positive sample retrieval data, the negative sample tag document, and the positive sample intention text.
Optionally, the document retrieval model training module is further configured to obtain a plurality of sample retrieval intents; inputting text generation prompt information and a first sample retrieval intention into a text generation model aiming at the first sample retrieval intention to obtain a first positive sample intention text corresponding to the first sample retrieval intention, wherein the first sample retrieval intention is any one of a plurality of sample retrieval intents; and constructing a positive sample subset according to the positive sample intention texts respectively corresponding to the plurality of sample retrieval intents.
Optionally, the document retrieval model training module is further configured to input the data generation prompt information and the first positive sample intention text into the data generation model to obtain a first positive sample retrieval text pair, wherein the first positive sample retrieval text pair comprises the first positive sample retrieval data and the first positive sample tag document, and the first positive sample intention text is a text corresponding to the first sample retrieval intention; and constructing a positive sample subset according to the positive sample intention texts and the positive sample retrieval text pairs respectively corresponding to the positive sample intention texts.
By using the scheme of the embodiment of the specification, the pre-training language model is introduced as an evaluation object of at least one candidate document, the strong text understanding and reasoning capability is utilized, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are further searched again according to the search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, and the correlation between the target document and data to be searched is improved in an iterative mode.
The above is an exemplary scheme of a document retrieving apparatus of the present embodiment. It should be noted that, the technical solution of the document retrieval device and the technical solution of the document retrieval method belong to the same concept, and details of the technical solution of the document retrieval device which are not described in detail can be referred to the description of the technical solution of the document retrieval method.
Corresponding to the above-mentioned automatic question-answering method embodiment, the present disclosure further provides an automatic question-answering device embodiment, and fig. 9 shows a schematic structural diagram of an automatic question-answering device provided in one embodiment of the present disclosure. As shown in fig. 9, the apparatus includes:
A second obtaining module 902 configured to obtain a question to be answered;
a third retrieving module 904 configured to retrieve at least one candidate document from the plurality of documents according to the question to be answered;
A second input module 906 configured to input the question to be answered and the at least one candidate document into a pre-trained language model, obtaining a search feedback text, wherein the search feedback text is used for describing a deviation between a search intention of the question to be answered and the at least one candidate document;
a fourth retrieval module 908 configured to retrieve a target document from the plurality of documents based on the question to be answered and the retrieved feedback text;
The generating module 910 is configured to generate a reply result corresponding to the to-be-answered question according to the target document.
By using the scheme of the embodiment of the specification, the pre-training language model is introduced as an evaluation object of at least one candidate document, the strong text understanding and reasoning capability is utilized, feedback of deviation of the at least one candidate document is provided in a natural language mode, a plurality of documents are searched again according to the search feedback text to obtain a target document, full-automatic multi-round search interaction is realized, the correlation between the target document and a question to be answered is improved in an iterative mode, and the accuracy of a reply result is further improved.
The above is a schematic scheme of an automatic question answering apparatus of this embodiment. It should be noted that, the technical solution of the automatic question-answering device and the technical solution of the automatic question-answering method belong to the same concept, and details of the technical solution of the automatic question-answering device, which are not described in detail, can be referred to the description of the technical solution of the automatic question-answering method.
FIG. 10 illustrates a block diagram of a computing device provided in one embodiment of the present description. The components of the computing device 1000 include, but are not limited to, a memory 1010 and a processor 1020. Processor 1020 is coupled to memory 1010 via bus 1030 and database 1050 is used to store data.
Computing device 1000 also includes access device 1040, which access device 1040 enables computing device 1000 to communicate via one or more networks 1060. Examples of such networks include public switched telephone networks (PSTN, public Switched Telephone Network), local area networks (LAN, local Area Network), wide area networks (WAN, wide Area Network), personal area networks (PAN, personal Area Network), or combinations of communication networks such as the internet. The access device 1040 may include one or more of any type of Network interface, wired or wireless, such as a Network interface card (NIC, network INTERFACE CARD), such as an IEEE802.11 wireless local area Network (WLAN, wireless Local Area Networks) wireless interface, a worldwide interoperability for microwave access (Wi-MAX, world Interoperability for Microwave Access) interface, an ethernet interface, a universal serial bus (USB, universal Serial Bus) interface, a cellular Network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 1000, as well as other components not shown in FIG. 10, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 10 is for exemplary purposes only and is not intended to limit the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 1000 may be any type of stationary or mobile computing device including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or personal computer (PC, personal Computer). Computing device 1000 may also be a mobile or stationary server.
Wherein the processor 1020 is configured to execute computer-executable instructions that, when executed by the processor, perform the steps of the document retrieval or automatic question-answering method described above.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device belongs to the same concept as the technical solution of the document searching method and the automatic question answering method, and details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the document searching or automatic question answering method.
An embodiment of the present specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the document retrieval or automatic question-answering method described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium belongs to the same concept as the technical solution of the document searching method and the automatic question-answering method, and details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the document searching or automatic question-answering method.
An embodiment of the present specification also provides a computer program, wherein the computer program, when executed in a computer, causes the computer to perform the steps of the document retrieval or automatic question-answering method described above.
The above is an exemplary version of a computer program of the present embodiment. It should be noted that, the technical solution of the computer program belongs to the same concept as the technical solution of the document searching method and the automatic question-answering method, and details of the technical solution of the computer program, which are not described in detail, can be referred to the description of the technical solution of the document searching or automatic question-answering method.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be increased or decreased appropriately according to the requirements of the patent practice, for example, in some areas, according to the patent practice, the computer readable medium does not include an electric carrier signal and a telecommunication signal.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the embodiments are not limited by the order of actions described, as some steps may be performed in other order or simultaneously according to the embodiments of the present disclosure. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the embodiments described in the specification.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are merely used to help clarify the present specification. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the teaching of the embodiments. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the invention. This specification is to be limited only by the claims and the full scope and equivalents thereof.

Claims (14)

1. A document retrieval method comprising:
Acquiring data to be retrieved;
according to the data to be retrieved, retrieving at least one candidate document from a plurality of documents;
Inputting the data to be searched and the at least one candidate document into a pre-training language model to obtain a search feedback text, wherein the search feedback text is used for describing the deviation between the search intention of the data to be searched and the at least one candidate document;
And according to the data to be searched and the search feedback text, searching the target document from the plurality of documents.
2. The method of claim 1, wherein the retrieving at least one candidate document from the plurality of documents according to the data to be retrieved comprises:
Inputting the data to be searched and the documents into a document searching model to obtain matching information corresponding to the documents respectively;
And screening at least one candidate document from the plurality of documents according to the matching information corresponding to the plurality of documents.
3. The method of claim 2, the document retrieval model comprising a retrieval encoding unit, a document encoding unit, and a matching unit;
The step of inputting the data to be retrieved and the plurality of documents into a document retrieval model to obtain matching information corresponding to the plurality of documents respectively, comprises the following steps:
the search coding unit codes the data to be searched to obtain a search embedded vector;
The document coding unit respectively codes the plurality of documents to obtain document embedded vectors;
And determining matching information corresponding to the plurality of documents respectively according to the search embedded vector and the document embedded vector through the matching unit.
4. The method of claim 1, wherein the retrieving, from the plurality of documents, the target document according to the data to be retrieved and the retrieval feedback text, comprises:
Determining updated matching information corresponding to the plurality of documents respectively according to the data to be searched, the search feedback text and the document embedding vectors of the plurality of documents through a document search model;
And screening at least one updated candidate document from the plurality of documents according to the updated matching information, and returning to execute the step of inputting the data to be searched and the at least one candidate document into a pre-training language model to obtain a search feedback text until a first preset stop condition is reached, so as to obtain a target document.
5. The method of claim 4, the document retrieval model comprising a retrieval encoding unit comprising a first encoding subunit, a second encoding subunit, and a fusion unit;
The determining, by the document retrieval model, updated matching information corresponding to the plurality of documents according to the data to be retrieved, the retrieval feedback text, and the document embedding vectors of the plurality of documents, includes:
encoding the data to be retrieved through the first encoding subunit to obtain a first embedded vector;
encoding the data to be retrieved and the retrieval feedback text by the second encoding subunit to obtain a second embedded vector;
fusing the first embedded vector and the second embedded vector by the fusing unit to obtain an updated search embedded vector;
and determining updated matching information corresponding to the plurality of documents respectively according to the updated search embedded vector and the document embedded vectors of the plurality of documents.
6. The method of claim 5, the second encoding subunit comprising a first linear layer, an encoding layer, and a second linear layer;
the encoding the data to be retrieved and the retrieval feedback text by the second encoding subunit to obtain a second embedded vector comprises the following steps:
Linearly mapping the search feedback text through the first linear layer to obtain a first mapping embedded vector;
encoding the data to be retrieved and the first mapping embedded vector through the encoding layer to obtain an embedded vector;
and linearly mapping the embedded vector through the second linear layer to obtain a second embedded vector.
7. The method of claim 1, further comprising, after retrieving a target document from the plurality of documents according to the data to be retrieved and the retrieval feedback text:
And receiving adjustment data sent by a user based on the target document, and adjusting model parameters of the pre-training language model according to the adjustment data.
8. The method of claim 2, before the data to be retrieved and the plurality of documents are input into a document retrieval model to obtain the matching information corresponding to the plurality of documents, further comprising:
acquiring a sample set, wherein the sample set comprises a plurality of sample retrieval data and sample tag documents respectively corresponding to the plurality of sample retrieval data, and the sample retrieval data carries sample intention text;
Inputting the sample retrieval data and the sample intention text carried by the sample retrieval data into an initial document retrieval model to obtain a prediction result;
and according to the prediction result and the sample label document, adjusting model parameters of the initial document retrieval model to obtain a trained document retrieval model.
9. The method of claim 8, the sample set comprising a positive sample subset, a first negative sample subset, and a second negative sample subset;
The acquiring a sample set includes:
Acquiring a positive sample subset, wherein the positive sample subset comprises a plurality of positive sample retrieval data and positive sample label documents corresponding to the positive sample retrieval data, and the positive sample retrieval data carries positive sample intention text;
Adjusting the positive sample intention text to negative sample intention text which does not match the positive sample intention text, and constructing a first negative sample subset according to the positive sample retrieval data, the positive sample label document and the negative sample intention text;
and adjusting the positive sample label document into a negative sample label document which is not matched with the positive sample label document, and constructing a second negative sample subset according to the positive sample retrieval data, the negative sample label document and the positive sample intention text.
10. The method of claim 9, the obtaining a positive sample subset comprising:
Acquiring a plurality of sample retrieval intents;
inputting text generation prompt information and the first sample retrieval intention into a text generation model aiming at the first sample retrieval intention, and obtaining a first positive sample intention text corresponding to the first sample retrieval intention, wherein the first sample retrieval intention is any one of the plurality of sample retrieval intents;
and constructing a positive sample subset according to the positive sample intention texts respectively corresponding to the plurality of sample retrieval intents.
11. The method of claim 10, the constructing a positive sample subset from positive sample intent text corresponding to the plurality of sample retrieval intents, respectively, comprising:
Inputting data generation prompt information and first positive sample intention text into a data generation model to obtain a first positive sample retrieval text pair, wherein the first positive sample retrieval text pair comprises first positive sample retrieval data and a first positive sample label document, and the first positive sample intention text is a text corresponding to the first sample retrieval intention;
And constructing a positive sample subset according to the plurality of positive sample intention texts and the positive sample retrieval text pairs respectively corresponding to the plurality of positive sample intention texts.
12. An automatic question-answering method, comprising:
Acquiring a question to be answered;
Retrieving at least one candidate document from a plurality of documents according to the questions to be answered;
inputting the questions to be answered and the at least one candidate document into a pre-training language model to obtain retrieval feedback text, wherein the retrieval feedback text is used for describing the deviation between the retrieval intention of the questions to be answered and the at least one candidate document;
according to the questions to be answered and the retrieval feedback text, retrieving a target document from the documents;
And generating a reply result corresponding to the to-be-answered question according to the target document.
13. A computing device, comprising:
A memory and a processor;
the memory is configured to store computer executable instructions, the processor being configured to execute the computer executable instructions, which when executed by the processor, implement the steps of the method of any one of claims 1 to 11 or claim 12.
14. A computer readable storage medium storing computer executable instructions which when executed by a processor implement the steps of the method of any one of claims 1 to 11 or claim 12.
CN202410032147.2A 2024-01-09 2024-01-09 Document retrieval method and automatic question-answering method Pending CN117972047A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410032147.2A CN117972047A (en) 2024-01-09 2024-01-09 Document retrieval method and automatic question-answering method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410032147.2A CN117972047A (en) 2024-01-09 2024-01-09 Document retrieval method and automatic question-answering method

Publications (1)

Publication Number Publication Date
CN117972047A true CN117972047A (en) 2024-05-03

Family

ID=90849086

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410032147.2A Pending CN117972047A (en) 2024-01-09 2024-01-09 Document retrieval method and automatic question-answering method

Country Status (1)

Country Link
CN (1) CN117972047A (en)

Similar Documents

Publication Publication Date Title
CN111241237A (en) Intelligent question and answer data processing method and device based on operation and maintenance service
CN116303558A (en) Query statement generation method, data query method and generation model training method
CN116050405A (en) Text processing, question-answer text processing and text processing model training method
CN116595154B (en) Task processing method and automatic question-answering method
CN117093864A (en) Text generation model training method and device
CN116610781A (en) Task model training method and device
CN116663565A (en) Information extraction, conference view extraction and information extraction model training method
CN116561270A (en) Question-answering method and question-answering model training method
CN117972047A (en) Document retrieval method and automatic question-answering method
CN117573842B (en) Document retrieval method and automatic question-answering method
CN117633540B (en) Sample data construction method and device
CN116467500B (en) Data relation identification, automatic question-answer and query sentence generation method
CN118212460A (en) Image classification method, automatic question-answering method, image class feature fusion model training method and information processing method based on deep learning model
CN117830447A (en) Image generation, automatic question and answer and parameter generation model training method
CN116522014B (en) Data processing method and device
CN118132988A (en) Machine learning model training method, text-based image searching method, automatic question-answering method, computing device, computer-readable storage medium, and computer program product
CN117636849A (en) Speech recognition method and speech recognition model training method
CN118013246A (en) Data processing method, computing device and computer readable storage medium
CN117851557A (en) Model processing method and question-answering system
CN116932742A (en) Digest extraction method and digest extraction device
CN117648079B (en) Task processing, code completion, code question answering and task processing model training method
CN118093808A (en) Question and answer method and device based on vector database
CN118227731A (en) Sample data construction method and question-answer model training method
CN117971420A (en) Task processing, traffic task processing and task processing model training method
CN116680357A (en) Information extraction method and device

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