WO2022166689A1 - 信息检索方法及相关系统、存储介质 - Google Patents

信息检索方法及相关系统、存储介质 Download PDF

Info

Publication number
WO2022166689A1
WO2022166689A1 PCT/CN2022/073819 CN2022073819W WO2022166689A1 WO 2022166689 A1 WO2022166689 A1 WO 2022166689A1 CN 2022073819 W CN2022073819 W CN 2022073819W WO 2022166689 A1 WO2022166689 A1 WO 2022166689A1
Authority
WO
WIPO (PCT)
Prior art keywords
hop
document
candidate
sample
samples
Prior art date
Application number
PCT/CN2022/073819
Other languages
English (en)
French (fr)
Inventor
张鑫宇
詹珂
罗兰
付成真
胡恩瑞
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022166689A1 publication Critical patent/WO2022166689A1/zh
Priority to US18/446,034 priority Critical patent/US20230385317A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/09Supervised learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3346Query execution using probabilistic model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/338Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/93Document management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06N3/0455Auto-encoder networks; Encoder-decoder networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Definitions

  • the present application relates to the technical field of artificial intelligence, and in particular, to an information retrieval method, a related system, and a storage medium.
  • Artificial Intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and basic AI theory.
  • Deep pre-training language models have become a necessary means for improving tasks such as search, recommendation, and natural language processing.
  • semantic search based on deep pre-trained language models is particularly prominent. It uses semantic search technology to represent Query as a semantic vector and then matches based on the similarity between the vectors, where the semantic vector can represent the implicit and fuzzy semantic information in the text.
  • the prior art provides an information retrieval method. As shown in Figure 1, for the retrieval text Query input by the user, multiple rounds of retrieval are performed from the candidate document library, the next round of search is performed based on the documents retrieved in the previous round, and the document set corresponding to the Query is finally output.
  • the document set corresponding to the Query output by the prior art is not a retrieval result that meets the requirements of the Query, and the retrieval effect is poor.
  • the present application discloses an information retrieval method, a related system, and a storage medium, which can improve the accuracy and efficiency of information retrieval.
  • an embodiment of the present application provides an information retrieval method, including: S1, obtaining Mi candidate documents of the i+1th hop according to the retrieval text Query and the Ki candidate documents of the ith hop; wherein, i, Ki, Mi is a positive integer, and the Ki is not greater than Mi; S2. Obtain the score of each candidate document in the candidate documents of the i+1th hop of the Mi, and the score is used to characterize the relationship between the candidate document and the Query. Relevance degree; S3.
  • steps S1-S4 are only used to indicate a part of the information retrieval method, and it is not limited that the execution order of S1-S4 must be executed in the description order of S1-S4.
  • the probability of calculating the path in step S3 can be the same as Step S2 is parallel and so on.
  • step S1 according to the retrieval text Query and Ki candidate documents of the ith hop, the candidate documents of Mi i+1 hops are obtained. Each of them is processed separately, and a total of Mi candidate documents of the i+1th hop are obtained.
  • the probability of the path in step S3 refers to the probability that the path is selected.
  • the path starts from the candidate document of the first hop and ends with any candidate document of the ith hop. It is used to indicate that the candidate document of the current jump is obtained based on the candidate document corresponding to the aforementioned path.
  • the path can be used to explain the candidate document of the current hop, so as to know the process of its acquisition.
  • a path that takes the candidate document of the first hop as the starting point and any candidate document of the fourth hop as the end point is used as an example for description.
  • the path includes four hops, and accordingly, the path includes four candidate documents.
  • the candidate document of the second hop corresponding to the path can be obtained according to the candidate document of the first hop.
  • the candidate document of the second hop the candidate document of the third hop corresponding to the path can be obtained.
  • the candidate document of the fourth hop corresponding to the path can be obtained.
  • each path is unique.
  • any candidate document Pjy(i+1) in step S3 is used to indicate random selection.
  • any candidate document is obtained based on the candidate document of the previous hop.
  • the j and y are only used for convenience of description, and they do not have the role of specific limitation.
  • Ki and K(i+1) may be the same or different, which are not specifically limited in this solution.
  • the probability of the path corresponding to the current hop of the candidate document is obtained by the score of each candidate document in the Mi candidate documents obtained based on the current hop, and the probability of the path of the previous hop corresponding to the candidate document, and then based on Multiple candidate documents with high probability are used to obtain the candidate documents of the next hop, and finally the retrieval result is obtained.
  • this solution can sort from the perspective of the global optimization of the global retrieval path, which improves the accuracy of information retrieval and improves the accuracy of information retrieval. efficiency.
  • the obtaining the retrieval result corresponding to the Query according to the K(i+1) candidate documents of the i+1 th hop includes: when the K(i+1) hops are The candidate documents of the i+1th hop reach the first preset stop condition, and the retrieval result corresponding to the Query is obtained according to the K(i+1) candidate documents of the i+1th hop.
  • obtaining the retrieval result corresponding to the Query according to the K(i+1) candidate documents of the i+1th hop includes: obtaining the K(i+1) candidates of the i+1th hop
  • the path corresponding to each candidate document in the document, the path corresponding to each candidate document is a path starting with the candidate document of the first hop and ending with the candidate document of the i+1th hop; wherein, The path corresponding to each candidate document is used as the retrieval result corresponding to the Query; or, the each candidate document is used as the retrieval result corresponding to the Query, and the path corresponding to each candidate document is used for the
  • the retrieval results corresponding to the candidate documents are explained.
  • the first preset stopping condition is that a stop symbol exists in at least one candidate document of the K(i+1) i+1 th hop candidate documents.
  • an embodiment of the present application provides a method for training a model, including: acquiring training samples, where the training samples include a retrieval text Query and a positive sample; the positive sample includes a sample corresponding to the first document sample of the N+1th hop path, the path corresponding to the first document sample of the N+1th hop is a path starting with the document sample of the first hop and ending with the first document sample of the N+1th hop; the The first document sample of the N+1 hop is the document sample corresponding to the path with a higher probability than the remaining K(N+1)-1 among the K(N+1) document samples of the N+1th hop; the The probability of the path corresponding to any document sample Pjy(N+1) in the K(N+1) document samples of the N+1th hop is obtained according to the score of the document sample Pjy(N+1) and the probability of the path T , where the score is used to characterize the degree of correlation between the document sample and the Query, and the path T starts from the document sample of the first hop,
  • the training of the first neural network according to the training samples, to obtain the trained first neural network includes: S1, according to the Query, corresponding to the positive samples
  • the document sample of the ith hop, the Ki-1 negative sample of the ith hop and the path negative sample of the ith hop obtain Mi candidate samples of the ith hop; any path negative sample in the path negative sample of the ith hop is negative
  • the sample includes a path starting with any one of the K1 document samples of the first hop and ending with any one of the Ki-1 negative samples of the i-th hop; i is not less than 1 , Ki is an integer not less than 2, and Mi is a positive integer;
  • S3, according to the candidate samples of the Mi th hops Obtain the probability of the path corresponding to each candidate sample by the score of each candidate sample in the +1 hop document sample, wherein the probabilities of the paths of the K(i+1) i+1th hop document samples are all higher than the probabilities
  • the top K candidate documents with a higher path probability are selected, and the negative samples of the next hop are determined based on the top K candidate documents.
  • this method is used to dynamically determine the negative samples of the next hop based on the top K candidate documents with a higher probability of the path of each hop, so that each round can be realized.
  • Dynamic adaptive selection of candidates enhances robustness; at the same time, in the process of training, after introducing the path supervision signal, the K candidates selected at each hop can dynamically change with the adjustment of the model by the supervision signal, and gradually increase the negative value.
  • the difficulty of the sample enhances the generalization ability of the model sorting and improves the model accuracy.
  • the adjusting the parameters of the first neural network according to the paths corresponding to the K(i+1) i+1 th hop document samples and the positive samples respectively includes: when the K(i +1) The document samples of the i+1th hop reach the second preset stop condition, and according to the paths corresponding to the K(i+1) document samples of the i+1th hop respectively and the positive samples, for all The parameters of the first neural network are adjusted.
  • the second preset stop condition is that there is a stop symbol in at least one candidate sample in the K(i+1) i+1 th hop document samples.
  • an embodiment of the present application provides an information retrieval method, including: receiving a Query input by a user; inputting the Query into a first neural network trained by the training method for processing, and obtaining a query corresponding to the Query search results.
  • an embodiment of the present application provides an information retrieval device, comprising: a retrieval module for S1, obtaining Mi candidate documents of the i+1th hop according to the retrieval text Query and Ki candidate documents of the ith hop; wherein , i, Ki, Mi are all positive integers, and the Ki is not greater than Mi; S2, obtain the score of each candidate document in the candidate documents of the i+1th hop of the Mi, and the score is used to characterize the candidate document The degree of correlation with the Query; S3.
  • the probability of L is the probability of the path corresponding to the candidate document Pjy(i+1).
  • the candidate document Pji is the path of the end point, the candidate document Pji is the jth among the Ki candidate documents of the ith hop, and the candidate document Pjy(i+1) is the candidate document according to the ith hop
  • j and y are both positive integers
  • S4 according to the probability of the paths corresponding to the Mi candidate documents of the i+1th hop respectively, obtain K(i +1) candidate documents of the i+1th hop, wherein the K(i+1) candidate documents of the i+1th hop are candidate documents in the Mi candidates of the i+1th hop, And the probabilities of the paths of the K(i+1) candidate documents of the i+1th hop are all higher than the probabilities of the paths of the remaining candidate documents in the Mi candidate documents, and the K(i+1) is A positive integer not greater than Mi; a determination module, used in S5, to obtain the retrieval result corresponding to the Query according to the candidate documents of the K(i+1)
  • the determining module is configured to: when the K(i+1) candidate documents of the i+1th hop reach the first preset stopping condition, according to the K(i+1) The candidate document of the i+1th hop obtains the retrieval result corresponding to the Query.
  • the determining module is further configured to: obtain a path corresponding to each candidate document in the candidate documents of the k(i+1) i+1th hop, where the path corresponding to each candidate document is: Taking the candidate document of the first hop as the starting point, and taking the candidate document of the i+1th hop as the end point; wherein, the path corresponding to each candidate document is used as the retrieval result corresponding to the Query; or , taking each candidate document as the retrieval result corresponding to the Query, and the path corresponding to each candidate document is used to interpret the retrieval result corresponding to the candidate document.
  • the first preset stop condition is that there is a stop symbol in at least one candidate document of the K(i+1) i+1 th hop candidate documents.
  • an embodiment of the present application provides a model training device, including: an acquisition module for acquiring training samples, where the training samples include a retrieval text Query and a positive sample; the positive sample includes the N+1th hop A path corresponding to a document sample, the path corresponding to the first document sample of the N+1th hop is a path starting with the document sample of the first hop and ending with the first document sample of the N+1th hop.
  • the first document sample of the N+1th hop is the path corresponding to the K(N+1) document sample of the N+1th hop whose probability is higher than the remaining K(N+1)-1 Document sample;
  • the probability of the path corresponding to any document sample Pjy(N+1) in the K(N+1) document samples of the N+1th hop is the score and path according to the document sample Pjy(N+1)
  • the probability of T is obtained, wherein the score is used to characterize the degree of correlation between the document sample and the Query, and the path T starts from the document sample of the first hop and takes the K(N+1)
  • the document sample PjN is the path of the end point
  • the document sample PjN is the jth of the KN document samples of the Nth hop
  • the document sample Pjy(N+1) is the yth among the document samples obtained according to the document sample PjN
  • the training sample also includes K1-1 negative samples of the first jump, and the K1-1 negative samples of the first jump are
  • the training module is used for: S1, according to the Query, the document sample of the ith hop corresponding to the positive sample, Ki-1 negative samples of the ith hop and the ith hop
  • the path negative sample of the hop obtains the candidate sample of the i th hop; any path negative sample in the path negative sample of the ith hop includes any document sample in the K1 document samples of the first hop as a starting point, And take any negative sample in the Ki-1 negative samples of the i-th hop as the path of the end point;
  • i is an integer not less than 1
  • Ki is an integer not less than 2
  • Mi is a positive integer;
  • S2 obtain all The score of each candidate sample in the candidate samples of the Mi ith hops;
  • S3 obtain the probability of the path corresponding to each candidate sample according to the score of each candidate sample in the candidate samples of the Mi ith hops S4, obtain the document sample of K(i+1) ith+1 hop according to the probability of the corresponding path of the candidate sample of described Mi ith hop, wherein,
  • the training module is further configured to: when the K(i+1) i+1th hop document samples reach the second preset stopping condition, according to the K(i+1) i+1th hop document samples One-hop document samples correspond to the path and the positive sample respectively, and the parameters of the first neural network are adjusted.
  • the second preset stopping condition is that a stop symbol exists in at least one candidate sample in the K(i+1) i+1 th hop document samples.
  • an embodiment of the present application provides an information retrieval system, comprising: a receiving module for receiving a Query input by a user; a processing module for inputting the Query into a first query obtained by training with the training method The processing is performed in the neural network to obtain the retrieval result corresponding to the Query.
  • the present application provides a computer storage medium, comprising computer instructions, which, when the computer instructions are executed on an electronic device, cause the electronic device to perform any possible implementation and/or implementation of the first aspect.
  • the embodiments of the present application provide a computer program product, which, when the computer program product runs on a computer, enables the computer to execute any possible implementation manner of the first aspect and/or any possible implementation manner of the second aspect.
  • an embodiment of the present application provides an information retrieval apparatus, including a processor and a memory; wherein, the memory is used to store program codes, and the processor is used to call the program codes to execute any of the methods described in the first aspect.
  • the memory is used to store program codes
  • the processor is used to call the program codes to execute any of the methods described in the first aspect.
  • the device according to the fourth aspect, the device according to the fifth aspect, the system according to the sixth aspect, the computer storage medium according to the seventh aspect, and the computer program product according to the eighth aspect are provided above.
  • the apparatuses described in the ninth aspect are all configured to perform any one of the methods provided in the first aspect, any one of the methods provided in the second aspect, and any one of the methods provided in the third aspect. Therefore, for the beneficial effects that can be achieved, reference may be made to the beneficial effects in the corresponding method, which will not be repeated here.
  • FIG. 2a is a schematic diagram of an artificial intelligence main body framework provided by an embodiment of the application.
  • FIG. 2b is a schematic diagram of an application environment provided by an embodiment of the present application.
  • 2c is a schematic structural diagram of a neural network processor provided by an embodiment of the application.
  • FIG. 3 is a schematic flowchart of an information retrieval method provided by an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a model training method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of an information retrieval method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a web page hyperlink provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an information retrieval method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a sample provided by an embodiment of the present application.
  • FIG. 9 is another schematic diagram of a sample provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of an information retrieval apparatus provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of an information retrieval apparatus provided by an embodiment of the present application.
  • Figure 2a shows a schematic diagram of an artificial intelligence main frame, the main frame describes the overall workflow of the artificial intelligence system, and is suitable for general artificial intelligence field requirements.
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data has gone through the process of "data-information-knowledge-wisdom".
  • the "IT value chain” reflects the value brought by artificial intelligence to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecological process of the system.
  • the infrastructure provides computing power support for the artificial intelligence system, realizes the communication with the outside world, and realizes the support through the basic platform. Communication with the outside world through sensors; computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA); the basic platform includes distributed computing framework and network-related platform guarantee and support, which can include cloud storage and computing, interconnection networks, etc. For example, sensors communicate with external parties to obtain data, and these data are provided to the intelligent chips in the distributed computing system provided by the basic platform for calculation.
  • smart chips hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA
  • the basic platform includes distributed computing framework and network-related platform guarantee and support, which can include cloud storage and computing, interconnection networks, etc. For example, sensors communicate with external parties to obtain data, and these data are provided to the intelligent chips in the distributed computing system provided by the basic platform for calculation.
  • the data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, and text, as well as IoT data from traditional devices, including business data from existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
  • machine learning and deep learning can perform symbolic and formalized intelligent information modeling, extraction, preprocessing, training, etc. on data.
  • Reasoning refers to the process of simulating human's intelligent reasoning method in a computer or intelligent system, using formalized information to carry out machine thinking and solving problems according to the reasoning control strategy, and the typical function is search and matching.
  • Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, image identification, etc.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, and the productization of intelligent information decision-making and implementation of applications. Its application areas mainly include: intelligent manufacturing, intelligent transportation, Smart home, smart medical care, smart security, autonomous driving, safe city, smart terminals, etc.
  • an embodiment of the present invention provides a system architecture 200.
  • the data collection device 260 is used to collect webpage/text paragraph data and store it in the database 230 , and the training device 220 generates the target model/rule 201 based on the webpage/text paragraph data maintained in the database 230 .
  • the following will describe in more detail how the training device 220 obtains the target model/rule 201 based on the webpage/text paragraph data, and the target model/rule 201 can obtain the corresponding retrieval result based on the retrieval text input by the user.
  • the work of each layer in a deep neural network can be expressed mathematically To describe: from the physical level, the work of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column through five operations on the input space (set of input vectors). Space), these five operations include: 1. Dimension raising/lowering; 2. Enlarging/reducing; 3. Rotation; 4. Translation; 5. "Bending”. Among them, the operations of 1, 2, and 3 are determined by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a().
  • W is the weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer.
  • the vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed.
  • the purpose of training the deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, and more specifically, learning the weight matrix.
  • the weight vector of the network (of course, there is usually an initialization process before the first update, that is, the parameters are pre-configured for each layer in the deep neural network), for example, if the predicted value of the network is high, adjust the weight vector to make it Predict lower and keep adjusting until the neural network can predict the actual desired target value.
  • the target models/rules obtained by training the device 220 can be applied in different systems or devices.
  • the execution device 210 is configured with an I/O interface 212 for data interaction with external devices, and a “user” can input data to the I/O interface 212 through the client device 240 .
  • the execution device 210 can call data, codes, etc. in the data storage system 250 , and can also store data, instructions, etc. in the data storage system 250 .
  • the calculation module 211 uses the target model/rule 201 to process the input data, including: S1, obtain the candidate document of the i-th hop of the Mi ith+1 hop according to the retrieval text Query input by the user and the candidate document of the K th th hop; wherein, i, K and Mi are all positive integers, and the K is not greater than Mi; S2. Obtain the score of each candidate document in the candidate documents of the i+1th hop of the Mi, and the score is used to characterize the relationship between the candidate document and the candidate document. The degree of relevance of the Query; S3.
  • the correlation function module 213 may perform corresponding processing on the retrieval result corresponding to the Query to obtain the processed result. For example, the path with the highest probability can be used as the processing result.
  • the association function module 214 may also extract the target answer based on the above-mentioned path with the highest probability.
  • the I/O interface 212 returns the processing result to the client device 240, which is provided to the user.
  • the training device 220 can generate corresponding target models/rules 201 based on different data for different targets, so as to provide users with better results.
  • the user can manually specify the data in the input execution device 210 , eg, operate in the interface provided by the I/O interface 212 .
  • the client device 240 can automatically input data to the I/O interface 212 and obtain the result. If the client device 240 automatically inputs data and needs to obtain the user's authorization, the user can set the corresponding permission in the client device 240 .
  • the user can view the result output by the execution device 210 on the client device 240, and the specific presentation form can be a specific manner such as display, sound, and action.
  • the client device 240 can also act as a data collection terminal to store the collected web page/text paragraph data into the database 230 .
  • FIG. 2b is only a schematic diagram of a system architecture provided by an embodiment of the present invention, and the positional relationship among the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data storage system 250 is an external memory relative to the execution device 210 , and in other cases, the data storage system 250 may also be placed in the execution device 210 .
  • FIG. 2c it is a schematic structural diagram of a neural network processor provided by an embodiment of the present invention.
  • Neural network processor NPU 50 NPU is mounted on the main CPU (Host CPU) as a co-processor, and tasks are assigned by the Host CPU.
  • the core part of the NPU is the operation circuit 503, and the controller 504 controls the operation circuit 503 to extract the data in the memory (weight memory or input memory) and perform operations.
  • the arithmetic circuit 503 includes multiple processing units (Process Engine, PE). In some implementations, arithmetic circuit 503 is a two-dimensional systolic array. The arithmetic circuit 503 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 503 is a general-purpose matrix processor.
  • PE Processing Unit
  • arithmetic circuit 503 is a two-dimensional systolic array. The arithmetic circuit 503 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 503 is a general-purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight memory 502 and buffers it on each PE in the operation circuit.
  • the arithmetic circuit fetches the matrix A data from the input memory 501 and performs the matrix operation on the matrix B, and the obtained partial result or final result of the matrix is stored in the accumulator 508 accumulator.
  • the vector calculation unit 507 can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on.
  • the vector calculation unit 507 can be used for network calculation of non-convolutional/non-FC layers in the neural network, such as pooling (Pooling), batch normalization (Batch Normalization), local response normalization (Local Response Normalization), etc. .
  • vector computation unit 507 stores the processed output vectors to unified memory 506 .
  • the vector calculation unit 507 may apply a nonlinear function to the output of the arithmetic circuit 503, such as a vector of accumulated values, to generate activation values.
  • vector computation unit 507 generates normalized values, merged values, or both.
  • the vector of processed outputs can be used as activation input to the arithmetic circuit 503, eg, for use in subsequent layers in a neural network.
  • Unified memory 506 is used to store input data and output data.
  • the storage unit access controller 505 (Direct Memory Access Controller, DMAC) transfers the input data in the external memory to the input memory 501 and/or the unified memory 506, stores the weight data in the external memory into the weight memory 502, and stores the unified memory.
  • the data in 506 is stored in external memory.
  • a bus interface unit (Bus Interface Unit, BIU) 510 is used to realize the interaction between the main CPU, the DMAC and the instruction fetch memory 509 through the bus.
  • the instruction fetch memory (instruction fetch buffer) 509 connected with the controller 504 is used to store the instructions used by the controller 504;
  • the controller 504 is used for invoking the instructions cached in the instruction fetch memory 509 to realize and control the working process of the operation accelerator.
  • the unified memory 506, the input memory 501, the weight memory 502 and the instruction fetch memory 509 are all on-chip (On-Chip) memories, and the external memory is the memory outside the NPU, and the external memory can be double data rate synchronous dynamic random access Memory (Double Data Rate Synchronous Dynamic Random Access Memory, referred to as DDR SDRAM), high bandwidth memory (High Bandwidth Memory, HBM) or other readable and writable memory.
  • DDR SDRAM Double Data rate synchronous dynamic random access Memory
  • HBM High Bandwidth Memory
  • FIG. 3 it is a schematic flowchart of an information retrieval method provided by an embodiment of the present application. As shown in Figure 3, the method includes steps 301-305, which are as follows:
  • the above-mentioned retrieval text Query may be the text content input by the user in the search box.
  • the method further includes:
  • the above-mentioned candidate document library includes documents with the granularity of paragraphs. That is, any candidate document in the candidate document library is composed of a piece of content.
  • Mi candidate documents are obtained.
  • a deep pre-trained language model is used to calculate a representation vector for each pre-selected document in the massive pre-selected documents, and each representation vector is stored and indexed; then the representation vector of each Query is obtained for different Query; finally, according to the vector
  • the index is a fast search method to obtain multiple documents that are most relevant to the Query.
  • the retriever composed of the deep pre-trained language model may score each candidate document based on the degree of relevancy between the candidate document and the Query, and then output the score of each candidate document in the Mi i+1th hop candidate documents.
  • the deep pre-training language model adopts the open-source deep pre-training language model Bert of Google as an example for illustration.
  • the model Bert is obtained by stacking some basic network units, such as Transformer network, into a huge network model, and pre-training with massive data.
  • input Query and the r-th candidate document Pri obtained by the i-th hop, and the output is the model's score for the candidate document Pri under the condition of input Q, as shown in the following formula (1):
  • any candidate document Pjy(i+1) in the Mi candidate documents of the i+1th hop obtain the candidate document according to the score of the candidate document Pjy(i+1) and the probability of the path L The probability of the path corresponding to Pjy(i+1), wherein the path L is the path starting from the candidate document of the first hop and ending with the candidate document Pji in the Ki ith hop candidate document,
  • the candidate document Pji is the jth in the Ki candidate documents of the ith jump
  • the candidate document Pjy(i+1) is the yth in the candidate documents obtained according to the candidate document Pji;
  • any one of the above-mentioned candidate documents Pjy(i+1) is used to indicate random selection. Wherein, any candidate document is obtained based on the candidate document of the previous hop.
  • the j and y are only used for convenience of description, and they do not have the role of specific limitation.
  • the score of each candidate document and the probability of the path corresponding to each candidate document are obtained respectively.
  • the probability of the path refers to the probability of the path being chosen.
  • the path starts from the candidate document of the first hop and ends with any candidate document of the ith hop. It is used to indicate that the candidate document of the current jump is obtained based on the candidate document corresponding to the aforementioned path.
  • the path can be used to explain the candidate document of the current hop, so as to know the process of its acquisition.
  • the path includes four hops, and accordingly, the path includes four candidate documents.
  • the candidate document of the second hop corresponding to the path can be obtained according to the candidate document of the first hop.
  • the candidate document of the second hop the candidate document of the third hop corresponding to the path can be obtained.
  • the candidate document of the fourth hop corresponding to the path can be obtained.
  • each path is unique.
  • the scores of the K candidate documents may be normalized by the Softmax function to obtain K probabilities.
  • the probability of the path corresponding to any candidate document s1 among the K candidate documents in the first hop can be expressed as:
  • Q) Softmax(TopK(Score(Ps1
  • Q))), where, s1 1, 2,...K;
  • the probability of the path of the first hop takes the probability of the path of the first hop as an example for description.
  • the probability of the path corresponding to the candidate document Pst2 of the second hop can be expressed as:
  • Q) G(Pst2
  • Q), where, st2 1, 2,...N2; (3)
  • the candidate document Pst2 of the second hop is obtained based on the candidate document Ps1 of the first hop.
  • the probability of the path corresponding to any candidate document Pjy(i+1) in the candidate document of the i+1th hop can be obtained.
  • K(i+1) candidate documents of the i+1th hop according to the probabilities of the paths corresponding to the Mi candidate documents of the i+1th hop, wherein the K(i+1)th candidate documents are The candidate documents of the i+1 hop are the candidate documents in the Mi candidate documents of the i+1 th hop, and the path probabilities of the K(i+1) candidate documents of the i+1 th hop are all higher than the probability of the paths of the remaining candidate documents in the Mi candidate documents, the K(i+1) is a positive integer not greater than Mi;
  • M2 candidate documents of the second hop are generated based on the K paths corresponding to the K candidate documents of the first hop. Based on the score of each candidate document of the second hop and the probability of the path of the previous hop corresponding to each candidate document, the probability of the path corresponding to each candidate document of the second hop is obtained. Taking the K paths with higher probability of the path as the basic path of the next hop, multiple candidate documents are obtained, and by analogy, the K documents with higher probability of the path i+1 hop are obtained.
  • the probabilities of the paths of the K candidate documents of the i+1th hop are all higher than the probabilities of the paths of the remaining candidate documents in the Mi candidate documents.
  • the embodiment of the present application takes selecting K for each hop as an example for description, and it may also select a different number for each hop, which is not specifically limited in this solution.
  • the method for generating the next-hop candidate document may use the hyperlinked document in the previous-hop document as the next-hop candidate document.
  • the document of the web page hyperlink in the previous hop document as the candidate document of the next hop.
  • Web page hyperlinks refer to hyperlinks in Internet web pages, which can be jumped to another web page or web page paragraph by clicking. Of course, it may also be a candidate document for obtaining the next hop through other forms, which is not specifically limited in this solution.
  • step 305 may include:
  • the retriever used for each hop retrieval in this solution may not be the same, which is not specifically limited in this solution.
  • stop character can be any document with a special mark, so that the model can automatically stop iterative retrieval.
  • step 305 may include the following two implementation forms:
  • the path corresponding to each candidate document is the candidate document of the first hop as the starting point, and take the candidate document of the i+1th hop as the path of the end point; take the path corresponding to each candidate document as the retrieval result corresponding to the Query.
  • each text includes the candidate document of the i+1th hop and the candidate document of the previous i hop corresponding to the candidate document. Specifically, each text corresponds to i+1 candidate documents of the i+1 hop, and the i+1 candidate documents start from the candidate document of the first hop, and use the candidate document of the i+1th hop as the starting point. Documentation is the end point.
  • sorting can be performed based on the probabilities of the paths corresponding to the above-mentioned K candidate documents of the i+1th hop, and then the sorted K texts are output.
  • each candidate document in the K i+1th hop candidate documents is used as the retrieval result corresponding to the Query, wherein the path corresponding to each candidate document is used for Explain the retrieval result corresponding to the candidate document.
  • the retrieval result includes each candidate document in the K candidate documents of the i+1th hop, and the path corresponding to each candidate document is used to explain the retrieval result corresponding to the candidate document, which is convenient for users, etc. Know the process by which the search results are obtained.
  • the retrieval result includes a candidate document of two hops and a candidate document including i+1 hops as an example for description, which may also be other arbitrary hops, which are not specifically limited in this solution.
  • the probability of the path corresponding to the current hop of the candidate document is obtained by the score of each candidate document in the Mi candidate documents obtained based on the current hop, and the probability of the path of the previous hop corresponding to the candidate document, and then based on Multiple candidate documents with high probability are used to obtain the candidate documents of the next hop, and finally the retrieval result is obtained.
  • this solution can sort from the perspective of the global optimization of the global retrieval path, which improves the accuracy of information retrieval and improves the accuracy of information retrieval. efficiency.
  • the Query may be input into the first neural network for processing, so as to obtain the retrieval result corresponding to the above-mentioned Query.
  • the first neural network may be obtained by training the model training method shown in FIG. 4 .
  • the model training method provided by the embodiment of the present application is described in detail below. Referring to FIG. 4 , it is a schematic flowchart of a model training method provided by an embodiment of the present application. The method includes steps 401-402, as follows:
  • the training sample includes a retrieval text Query and a positive sample;
  • the positive sample includes a path corresponding to the first document sample of the N+1th hop, and the first document sample of the N+1th hop corresponds to The path is the path starting with the document sample of the first hop and ending with the first document sample of the N+1th hop;
  • the first document sample of the N+1th hop is the N+1th hop.
  • the probability is higher than the document samples corresponding to the other K(N+1)-1 paths; the K(N+1) document samples of the N+1th hop
  • the probability of the path corresponding to any document sample Pjy(N+1) is obtained according to the score of the document sample Pjy(N+1) and the probability of the path T, wherein the score is used to characterize the relationship between the document sample and the The degree of relevance of Query, the path T is the path starting from the document sample of the first hop and ending with the document sample PjN in the document samples of the K(N+1)th N+1th hop.
  • the document sample PjN is the jth among the KN document samples of the Nth hop, and the document sample Pjy(N+1) is the yth among the document samples obtained according to the document sample PjN; the training The samples also include K1-1 negative samples of the first hop, and the K1-1 negative samples of the first hop are the K1 document samples of the jump except for the document sample of the current jump corresponding to the positive sample.
  • Document sample; N is a positive integer
  • K1 and K(N+1) are integers not less than 2
  • j and y are both positive integers;
  • the number of document samples in each hop is K as an example for description.
  • the training sample includes Query, a path corresponding to the first document sample of the N+1th hop, and K-1 negative samples of the first hop.
  • the above positive samples may include positive document samples corresponding to each of the N+1 hops.
  • the positive document samples of each hop are obtained based on the positive document samples of the previous hop.
  • N+1 is the number of hops, or the number of rounds, corresponding to obtaining the retrieval result corresponding to the Query. That is to say, after N+1 rounds of retrieval, the final retrieval result is obtained.
  • step 402 may specifically include:
  • the document sample of the ith hop corresponding to the positive sample, the negative sample of Ki-1 hop of the ith hop, and the negative sample of the path of the ith hop, obtain the candidate sample of the ith hop of Mi;
  • the Any path negative sample in the path negative samples of the ith hop includes any document sample in the K1 document samples of the first hop as a starting point, and any of the Ki-1 negative samples of the ith hop is taken as the starting point.
  • a negative sample is the path of the end point; i is an integer not less than 1, Ki is an integer not less than 2, and Mi is a positive integer;
  • the document sample of the i+1th jump includes the document sample of the i+1th jump corresponding to the positive sample and the negative sample of the K(i+1)-1th i+1th jump;
  • step S5 may include: when the K(i+1) document samples of the i+1th hop reach the second preset stop condition, according to the path and For the positive sample, the parameters of the first neural network are adjusted to obtain the trained first neural network.
  • the above-mentioned second preset condition may be that there is a stop symbol in at least one candidate sample in the K(i+1) i+1 th hop document samples.
  • a stop symbol for the relevant description of the stop symbol, reference may be made to the foregoing embodiments, which will not be repeated here.
  • the path negative sample of the first hop does not exist, that is, the first hop does not input the path negative sample when inputting.
  • the scores of the candidate samples and the probability of the paths corresponding to the candidate samples are determined, and reference may be made to the relevant descriptions in the foregoing embodiments, which will not be repeated here.
  • each hop may include K samples, one of the K samples is the positive sample of the hop, and the remaining K-1 samples are the negative samples of the hop.
  • K may be a value set arbitrarily.
  • the correct candidate documents and a fixed number of incorrect candidate documents of the current hop are applied.
  • the deep pre-trained language model corresponding to each hop can be trained according to the positive and negative sample pairs formed by each hop.
  • the above-mentioned fixed number of wrong candidate documents are the above-mentioned K-1 negative samples of each hop.
  • the negative sample is dynamically generated based on the sample of the previous hop.
  • the probability is used to globally model and score multiple rounds of retrieval paths, so that all paths before the current round can be supervised through the supervision signal of each hop during training, which enhances the retrieval accuracy of the model.
  • Any path negative sample in the path negative samples of the i-th hop includes any document sample in the K document samples of the first hop as a starting point, and is based on the K-1 negative samples of the i-th hop. A path with any negative sample as the end point.
  • the correct path at the current hop and the wrong path at the current hop are applied to the K paths expressed by the probability of the path in each hop.
  • the positive samples corresponding to the first jump are Pagei +
  • the negative samples are Pagei 1- , Pagei 2- ... to Pagei K
  • the positive samples corresponding to the second jump are Pagej +
  • the negative samples are Pagej 1- , Pagej 2- ...
  • the positive sample of the retrieval path to Pagej K for the second hop is (Pagei + ,Pagej + ), then the negative sample of the second hop path is (Pagei + ,Pagej 1- ),(Pagei + ,Pagej 2- )...(Pagei 1- , Pagej - ), (Pagei 2- , Pagej - )...
  • the deep pre-trained language model corresponding to each hop can be supervised according to the positive and negative paths formed by each hop.
  • the path negative samples of the third hop include starting from the samples of the first hop, and ending with other samples in the third hop except the document samples of the third hop corresponding to the positive samples, that is, starting from the third hop.
  • the negative sample of the jump is the end point.
  • the path supervision signal is applied when the model dynamically selects the top K candidates, so that the path arriving in the current round can be supervised at the moment, and then cooperate with the local supervision signal to greatly improve the model accuracy, and at the same time, the K candidates can be continuously changed with the supervision signal. The robustness of the model is enhanced.
  • the negative samples in the training samples input in the embodiment of the present application are obtained from K samples with higher probability. Compared with training based on randomly selected negative samples in the prior art, this solution can improve the accuracy of the model.
  • This scheme determines the negative sample of the next hop based on the top K candidate documents with higher probability of the path. Compared with the random determination of the negative samples of each hop in the prior art, this method is used to dynamically determine the negative samples of the next hop based on the top K candidate documents with a higher probability of the path of each hop, so that each round can be realized. Dynamic adaptive selection of candidates enhances robustness; at the same time, in the process of training, after introducing the path supervision signal, the K candidates selected at each hop can dynamically change with the adjustment of the model by the supervision signal, and gradually increase the negative value. The difficulty of the sample enhances the generalization ability of the model sorting and improves the model accuracy.
  • FIG. 5 it is a schematic flowchart of an information retrieval method provided by an embodiment of the present application. This method is applied in question and answer scenarios. It includes steps 501-504, as follows:
  • the candidate document library is constructed by establishing an index.
  • the above paragraphs have hyperlinks to other web pages. As shown in Figure 6.
  • the question answering system receives a Query input by the user, such as "where did Norway qualify for the first time into the round of 16?", that is, where did Norway enter the top 16 for the first time.
  • the first hop retrieval is performed on Query to obtain M1 candidate documents, and the score of each candidate document is obtained.
  • the deep pre-training language model is selected as Bert, and Bert1 represents the model used in the first-hop retrieval, and the correct document is "Wiki: Norway at the FIFA World Cup”.
  • the scores of each candidate document in the first hop are sorted from high to low, and K candidate documents with higher scores are selected.
  • the K scores are normalized to probabilities using the Softmax function.
  • the embodiments of the present application are described with K being 4.
  • the hyperlinks of the first-hop retrieval results (Z1, Z2, Z3, and Z4) of Top4 are simultaneously used to constitute candidate documents for the second-hop retrieval.
  • wiki: 2014 FIFA World Cup is a document linked to by a hyperlink in the paragraph of wiki: Amsterdam at the FIFA World Cup), as shown in the document content corresponding to Mz in Figure 7.
  • the scores of the candidate documents calculated by the second hop are normalized to bzpij by the Softmax function, and the probability api ⁇ bzpij of the first and second hop retrieval paths is calculated, as shown in Figure 7.
  • the documents in the retrieved path are spliced and input to the answer extraction model for answer extraction. If the retrieved path is wiki:Algeria at the FIFA World Cup->wiki:2014 FIFA World Cup, and the latter wiki document contains "Brazil", the answer can be extracted by machine reading comprehension and returned to the user .
  • the above implementation method is obtained by inputting the Query into the first neural network for processing.
  • the first neural network is trained based on the following training method:
  • the correct candidate path at the current round and the wrong candidate path corresponding to the current round candidate document corresponding to the retrieval result of the previous round are applied to the K retrieval path scores expressed by probability in each round, as shown in Fig. 9 shown.
  • the correct and wrong path supervision signals are applied to the first and second rounds of deep pre-training language models at the same time.
  • the correct signal is wiki:Algeria at the FIFA World Cup->wiki:2014 FIFA World Cup
  • the error signal of the second round is generated by the Top4 candidates of the first round.
  • FIG. 10 it is a schematic structural diagram of an information retrieval apparatus according to an embodiment of the present application.
  • the apparatus includes a retrieval module 1001 and a determination module 1002, as follows:
  • Retrieval module 100 used for S1 to obtain Mi candidate documents of the i+1th hop according to the retrieval text Query and the candidate documents of the ith hop of Ki; wherein, i, Ki, Mi are all positive integers, and the Ki is not greater than Mi; S2, obtain the score of each candidate document in the candidate documents of the i+1 th hop of the Mi, and the score is used to represent the degree of correlation between the candidate document and the Query; S3, for the Mi th th For any candidate document Pjy(i+1) in the candidate documents of i+1 hops, according to the score of the candidate document Pjy(i+1) and the probability of the path L, the corresponding value of the candidate document Pjy(i+1) is obtained.
  • the probability of the path wherein the path L is the path starting from the candidate document of the first hop and ending with the candidate document Pji in the candidate documents of the Ki th hop, and the candidate document Pji is the The jth among the Ki candidate documents of the ith hop, and the candidate document Pjy(i+1) is the yth yth among the candidate documents of the ith+1th hop obtained according to the candidate document Pji of the ith hop , j and y are both positive integers; S4.
  • K(i+1) candidate documents of the i+1th hop according to the probabilities of the paths corresponding to the Mi candidate documents of the i+1th hop, wherein all The K(i+1) candidate documents of the i+1th hop are candidate documents in the Mi candidates of the i+1th hop, and the K(i+1) i+1th hops are The probabilities of the paths of the candidate documents are all higher than the probabilities of the paths of the remaining candidate documents in the Mi candidate documents, and the K(i+1) is a positive integer not greater than Mi;
  • the determination module 1002 is used for S5 to obtain the retrieval result corresponding to the Query according to the K(i+1) candidate documents of the i+1th hop.
  • the determining module 1002 is used for:
  • the Query is obtained according to the K(i+1) candidate documents of the i+1th hop corresponding search results.
  • the determining module 1002 is further configured to:
  • the path corresponding to each candidate document in the candidate documents of the k(i+1) i+1th hop is the candidate document of the first hop as the starting point and the The candidate document of the i+1th hop is the path of the end point; wherein, the path corresponding to each candidate document is used as the retrieval result corresponding to the Query; or, the each candidate document is used as the corresponding Query.
  • the retrieval result corresponding to each candidate document is used to explain the retrieval result corresponding to the candidate document.
  • the determining module 1002 is further configured to:
  • the first preset stop condition is that a stop symbol exists in at least one candidate document of the K(i+1) i+1 th hop candidate documents.
  • An embodiment of the present application provides a model training device, including: an acquisition module for acquiring training samples, where the training samples include a retrieval text Query and a positive sample; the positive sample includes the first document sample corresponding to the N+1th hop
  • the path corresponding to the first document sample of the N+1th hop is a path starting with the document sample of the first hop and ending with the first document sample of the N+1th hop; the The first document sample of the N+1th hop is the document sample corresponding to the path whose probability is higher than the remaining K(N+1)-1 among the K(N+1) document samples of the N+1th hop; so
  • the probability of the path corresponding to any document sample Pjy(N+1) in the K(N+1) document samples of the N+1th hop is obtained according to the score of the document sample Pjy(N+1) and the probability of the path T , where the score is used to characterize the degree of correlation between the document sample and the Query, the path T is the document sample of the first hop as the starting point, and the K
  • a training module configured to train the first neural network according to the training samples to obtain the trained first neural network.
  • the training module is used for: S1, according to the Query, the document sample of the ith hop corresponding to the positive sample, Ki-1 negative samples of the ith hop and the ith hop
  • the path negative sample of the hop obtains the candidate sample of the i th hop; any path negative sample in the path negative sample of the ith hop includes any document sample in the K1 document samples of the first hop as a starting point, And take any negative sample in the Ki-1 negative samples of the i-th hop as the path of the end point;
  • i is an integer not less than 1
  • Ki is an integer not less than 2
  • Mi is a positive integer;
  • S2 obtain all The score of each candidate sample in the candidate samples of the Mi ith hops;
  • S3 obtain the probability of the path corresponding to each candidate sample according to the score of each candidate sample in the candidate samples of the Mi ith hops S4, obtain the document sample of K(i+1) ith+1 hop according to the probability of the corresponding path of the candidate sample of described Mi ith hop, wherein,
  • the training module is further configured to: when the K(i+1) i+1th hop document samples reach the second preset stopping condition, according to the K(i+1) i+1th hop document samples 1-hop document samples correspond to the paths and the positive samples respectively, and adjust the parameters of the first neural network.
  • the second preset stopping condition is that a stop symbol exists in at least one candidate sample in the K(i+1) i+1 th hop document samples.
  • the apparatus 1100 includes at least one processor 1101 , at least one memory 1102 and at least one communication interface 1103 .
  • the processor 1101, the memory 1102 and the communication interface 1103 are connected through the communication bus and complete the communication with each other.
  • the processor 1101 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the above programs.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • the communication interface 1103 is used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (Wireless Local Area Networks, WLAN).
  • RAN radio access network
  • WLAN Wireless Local Area Networks
  • the memory 1102 may be read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (RAM) or other type of static storage device that can store information and instructions It can also be an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of being executed by a computer Access any other medium without limitation.
  • the memory can exist independently and be connected to the processor through a bus.
  • the memory can also be integrated with the processor.
  • the memory 1102 is used to store the application code for executing the above solution, and the execution is controlled by the processor 1101 .
  • the processor 1101 is used for executing the application code stored in the memory 1102 .
  • Code stored in memory 1102 may perform any of the information retrieval methods provided above.
  • An embodiment of the present application provides an information retrieval system, comprising: a receiving module for receiving a Query input by a user; a processing module for inputting the Query into a first neural network trained by the training method for processing processing to obtain a retrieval result corresponding to the Query.
  • An embodiment of the present application further provides a chip system, which is applied to an electronic device; the chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor pass through line interconnection; the interface circuit is used to receive signals from the memory of the electronic device and send the signals to the processor, the signals include computer instructions stored in the memory; when the processor executes the When executing the computer instructions, the electronic device performs the method.
  • Embodiments of the present application further provide a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, when the computer or processor runs on the computer, the computer or the processor causes the computer or processor to execute any one of the above methods. or multiple steps.
  • Embodiments of the present application also provide a computer program product including instructions.
  • the computer program product when run on a computer or processor, causes the computer or processor to perform one or more steps of any of the above methods.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted over a computer-readable storage medium. The computer instructions can be sent from one website site, computer, server or data center to another website site, computer, server or data center for transmission.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)), and the like.
  • the process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium.
  • the program When the program is executed , which may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供一种信息检索方法及相关系统、存储介质,包括:S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分;S3、根据候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档;根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。本方案可以从全局检索路径全局最优的角度进行排序,提高了信息检索的准确度以及效率。

Description

信息检索方法及相关系统、存储介质
本申请要求于2021年2月8日提交中国专利局、申请号为202110172627.5、申请名称为“信息检索方法及相关系统、存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,尤其涉及一种信息检索方法及相关系统、存储介质。
背景技术
人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。
深度预训练语言模型已经成为目前搜索、推荐、自然语言处理等任务提升的必要手段,它通过海量的语料进行预训练,使其具备极强的文本表示能力。
在搜索业务上,基于深度预训练语言模型的语义搜索尤为突出。其使用语义搜索技术即可将Query表征为语义向量进而依靠向量之间的相似关系进行匹配,其中语义向量即可表征文本内隐含且模糊的语义信息。
目前的深度预训练语言模型仍然存在一些棘手的问题,比如当用户输入的Query十分复杂时,如需要一定的多轮推理问题:“where did Algeria qualify for the first time into the round of 16?”中文翻译为“阿尔及利亚在哪里第一次进入16强”,要想正确地回答该问题,只通过语义搜索到一个文档是不够的,它至少首先需要搜索到“阿尔及利亚国家足球队”文档后,理解为问题中的“阿尔及利亚”指的是“阿尔及利亚国家足球队”,且该队“在2014年世界杯进了16强”,之后需要再搜索到“2014年世界杯”的文档,并从该文档中理解出该年世界杯的举办地是“巴西”,通过一系列的多轮检索后方可找到正确答案“巴西”。但在使用目前深度预训练语言模型改进的搜索引擎进行检索后,检索出的前3个文档均未提到地点“巴西”的关键词,而在第4个文档才第一次出现巴西,而这对于答案的产生会带来较大的噪声和影响,检索效果不好。
搜索由单轮搜索改进为多轮搜索后便更有机会找到带有答案的支撑文档,因此目前也存在很多的基于深度预训练语言模型的多轮检索技术。现有技术提供了一种信息检索方法。如图1所示,其针对用户输入的检索文本Query,从候选文档库中进行多轮检索,基于前一轮检索出的文档进行下一轮搜索,最终输出该Query对应的文档集合。
然而现有技术输出的Query对应的文档集合,并不是较符合Query的要求的检索结果,检索效果较差。
发明内容
本申请公开了一种信息检索方法及相关系统、存储介质,可以提高信息检索的准确度以及效率。
第一方面,本申请实施例提供一种信息检索方法,包括:S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个,j、y均为正整数;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;S5、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
需要说明的是,步骤S1-S4只是用来指示该信息检索方法中的一部分,并不限定S1-S4的执行顺序一定按S1-S4的描述顺序执行,例如步骤S3中计算路径的概率可以和步骤S2并行等。
其中,步骤S1中,根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档,可以理解为,根据检索文本Query和Ki个第i跳的候选文档中的每个分别进行处理,一共得到Mi个第i+1跳的候选文档。
步骤S3中路径的概率是指该路径被选择的几率。路径为以第一跳的候选文档为起点,并以第i跳的任一候选文档为终点。其用于指示当前跳的候选文档是基于前述路径对应的候选文档得到的。路径可用于对该当前跳的候选文档进行解释,便于知晓其得到的过程。
例如,以第一跳的候选文档为起点,并以第四跳的任一候选文档为终点的路径为例进行说明。该条路径包括四跳,相应地,该条路径包括四个候选文档。其中,根据第一跳的候选文档可得到该条路径对应的第二跳的候选文档。根据该第二跳的候选文档可得到该条路径对应的第三跳的候选文档。根据该第三跳的候选文档可得到该条路径对应的第四跳的候选文档。其中,每一条路径均是唯一的。
且,步骤S3中任一候选文档Pjy(i+1)用于指示随机选取的。其中,该任一候选文档是基于上一跳的候选文档得到的。该j、y仅用于便于描述,其并不具备特定限制的作用。
上述Ki和K(i+1)可以是相同的,也可以是不同的,本方案对此不做具体限定。
本申请实施例,通过基于当前跳获得的Mi个候选文档中每个候选文档的得分,以及该候选文档对应的上一跳的路径的概率得到当前跳该候选文档对应的路径的概率,进而基于概率较高的多个候选文档来获取下一跳的候选文档,并最终得到检索结果。相较于现有技术中每跳获取的多个候选文档仅依赖每个候选文档的得分进行排序筛选,本方案可以从全局检索路径全局最优的角度进行排序,提高了信息检索的准确度以及效率。
作为一种可选的实现方式,所述根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果,包括:当所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
其中,所述根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果,包括:获取所述K(i+1)个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选 文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;其中,将所述每个候选文档对应的路径作为所述Query对应的检索结果;或者,将所述每个候选文档作为所述Query对应的检索结果,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
相较于现有技术中最终输出文档集合,采用本方案,通过输出整条路径进而使得检索结果具备可解释性。
作为一种可选的实现方式,若所述K(i+1)个第i+1跳的候选文档未达到所述第一预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第一预设停止条件。
所述第一预设停止条件为所述K(i+1)个第i+1跳的候选文档中的至少一个候选文档中存在停止符。
第二方面,本申请实施例提供一种模型训练方法,包括:获取训练样本,所述训练样本包括检索文本Query、正样本;所述正样本包括第N+1跳的第一文档样本对应的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
作为一种可选的实现方式,所述根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络,包括:S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
本申请实施例,通过在进行模型训练时,选择路径的概率较高的前K个候选文档,基于该前K个候选文档确定下一跳的负样本。相较于现有技术中随机确定每一跳的负样本,采用该手段,基于每一跳的路径的概率较高的前K个候选文档来动态确定下一跳的负样本,实现 了每轮候选动态的自适应选取,增强鲁棒性;同时本方案在训练的过程中,引入路径监督信号后可以使每跳选取的K个候选随着监督信号对模型的调整而动态变化,逐步提升负样本的难度,增强模型排序的泛化能力,提升了模型精度。
所述根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,包括:当所述K(i+1)个第i+1跳的文档样本达到第二预设停止条件,根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整。
可选的,若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
可选的,所述第二预设停止条件为所述K(i+1)个第i+1跳的文档样本中的至少一个候选样本中存在停止符。
第三方面,本申请实施例提供一种信息检索方法,包括:接收用户输入的Query;将所述Query输入至所述训练方法训练得到的第一神经网络中进行处理,得到与所述Query对应的检索结果。
第四方面,本申请实施例提供一种信息检索装置,包括:检索模块,用于S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个,j、y均为正整数;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;确定模块,用于S5、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
可选的,所述确定模块,用于:当所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
可选的,所述确定模块,还用于:获取所述K(i+1)个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;其中,将所述每个候选文档对应的路径作为所述Query对应的检索结果;或者,将所述每个候选文档作为所述Query对应的检索结果,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
可选的,所述确定模块,还用于:若所述K(i+1)个第i+1跳的候选文档未达到所述第一预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第一预设停止条件。
其中,所述第一预设停止条件为所述K(i+1)个第i+1跳的候选文档中的至少一个候选文档中存在停止符。
第五方面,本申请实施例提供一种模型训练装置,包括:获取模块,用于获取训练样本,所述训练样本包括检索文本Query、正样本;所述正样本包括第N+1跳的第一文档样本对应 的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;训练模块,用于根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
作为一种可选的实现方式,所述训练模块,用于:S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
其中,所述训练模块,还用于:当所述K(i+1)个第i+1跳的文档样本达到第二预设停止条件,根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整。
所述训练模块,还用于:若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
所述第二预设停止条件为所述K(i+1)个第i+1跳的文档样本中的至少一个候选样本中存在停止符。
第六方面,本申请实施例提供一种信息检索系统,包括:接收模块,用于接收用户输入的Query;处理模块,用于将所述Query输入至经所述的训练方法训练得到的第一神经网络中进行处理,得到与所述Query对应的检索结果。
第七方面,本申请提供了一种计算机存储介质,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如第一方面任一种可能的实施方式和/或第二方面任一种可能的实施方式提供的方法和/或第三方面任一种可能的实施方式提供的方法。
第八方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行如第一方面任一种可能的实施方式和/或第二方面任一种可能的实施方式提供的方法和/或第三方面任一种可能的实施方式提供的方法。
第九方面,本申请实施例提供一种信息检索装置,包括处理器和存储器;其中,所述存储器用于存储程序代码,所述处理器用于调用所述程序代码,以执行如第一方面任一种可能的实施方式和/或第二方面任一种可能的实施方式提供的方法和/或第三方面任一种可能的实施方式提供的方法。
可以理解地,上述提供的第四方面所述的装置、第五方面所述的装置、第六方面所述的系统、第七方面所述的计算机存储介质、第八方面所述的计算机程序产品或者第九方面所述的装置均用于执行第一方面中任一所提供的方法、第二方面中任一所提供的方法以及第三方面中任一所提供的方法。因此,其所能达到的有益效果可参考对应方法中的有益效果,此处不再赘述。
附图说明
下面对本申请实施例用到的附图进行介绍。
图1是现有技术中进行信息检索的示意图;
图2a为本申请实施例提供的一种人工智能主体框架示意图;
图2b为本申请实施例提供的一种应用环境示意图;
图2c为本申请实施例提供的一种神经网络处理器的结构示意图;
图3是本申请实施例提供的一种信息检索方法的流程示意图;
图4是本申请实施例提供的一种模型训练方法的流程示意图;
图5是本申请实施例提供的一种信息检索方法的流程示意图;
图6是本申请实施例提供的一种网页超链的示意图;
图7是本申请实施例提供的一种信息检索方法的示意图;
图8是本申请实施例提供的一种样本示意图;
图9是本申请实施例提供的另一种样本示意图;
图10是本申请实施例提供的一种信息检索装置的结构示意图;
图11是本申请实施例提供的一种信息检索装置的结构示意图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。本申请实施例的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。
图2a示出一种人工智能主体框架示意图,该主体框架描述了人工智能系统总体工作流程,适用于通用的人工智能领域需求。
下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。
“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。
“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。
(1)基础设施
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台 实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。
(2)数据
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。
(3)数据处理
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。
(4)通用能力
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。
(5)智能产品及行业应用
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能制造、智能交通、智能家居、智能医疗、智能安防、自动驾驶,平安城市,智能终端等。
参见附图2b,本发明实施例提供了一种系统架构200。数据采集设备260用于采集网页/文本段落数据并存入数据库230,训练设备220基于数据库230中维护的网页/文本段落数据生成目标模型/规则201。下面将更详细地描述训练设备220如何基于网页/文本段落数据得到目标模型/规则201,目标模型/规则201能够基于用户输入的检索文本得到与其对应的检索结果。
深度神经网络中的每一层的工作可以用数学表达式
Figure PCTCN2022073819-appb-000001
来描述:从物理层面深度神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure PCTCN2022073819-appb-000002
完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权 重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。
训练设备220得到的目标模型/规则可以应用不同的系统或设备中。在附图2b中,执行设备210配置有I/O接口212,与外部设备进行数据交互,“用户”可以通过客户设备240向I/O接口212输入数据。
执行设备210可以调用数据存储系统250中的数据、代码等,也可以将数据、指令等存入数据存储系统250中。
计算模块211使用目标模型/规则201对输入的数据进行处理,包括:S1、根据用户输入的检索文本Query和K个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、K、Mi均为正整数,所述K不大于Mi;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述K个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的K个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K个第i+1跳的候选文档,其中,所述K个第i+1跳的候选文档为所述Mi个候选文档中路径的概率较高的K个文档;根据所述K个第i跳的候选文档和所述K个第i+1跳的候选文档得到所述Query对应的检索结果。
关联功能模块213可以对所述Query对应的检索结果进行相应处理,以得到处理后的结果。例如,可以将概率最高的路径作为处理结果。
关联功能模块214还可以基于上述概率最高的路径提取出目标答案。
最后,I/O接口212将处理结果返回给客户设备240,提供给用户。
更深层地,训练设备220可以针对不同的目标,基于不同的数据生成相应的目标模型/规则201,以给用户提供更佳的结果。
在附图2b中所示情况下,用户可以手动指定输入执行设备210中的数据,例如,在I/O接口212提供的界面中操作。另一种情况下,客户设备240可以自动地向I/O接口212输入数据并获得结果,如果客户设备240自动输入数据需要获得用户的授权,用户可以在客户设备240中设置相应权限。用户可以在客户设备240查看执行设备210输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备240也可以作为数据采集端将采集到网页/文本段落数据存入数据库230。
值得注意的,附图2b仅是本发明实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在附图2b中,数据存储系统250相对执行设备210是外部存储器,在其它情况下,也可以将数据存储系统250置于执行设备210中。
参照图2c所示,是本发明实施例提供的一种神经网络处理器的结构示意图。
神经网络处理器NPU 50 NPU作为协处理器挂载到主CPU(Host CPU)上,由Host CPU 分配任务。NPU的核心部分为运算电路503,控制器504控制运算电路503提取存储器(权重存储器或输入存储器)中的数据并进行运算。
在一些实现中,运算电路503内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路503是二维脉动阵列。运算电路503还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路503是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器502中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器501中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器508 accumulator中。
向量计算单元507可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元507可以用于神经网络中非卷积/非FC层的网络计算,如池化(Pooling),批归一化(Batch Normalization),局部响应归一化(Local Response Normalization)等。
在一些实现种,向量计算单元507将经处理的输出的向量存储到统一存储器506。例如,向量计算单元507可以将非线性函数应用到运算电路503的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元507生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路503的激活输入,例如用于在神经网络中的后续层中的使用。
统一存储器506用于存放输入数据以及输出数据。
存储单元访问控制器505(Direct Memory Access Controller,DMAC)将外部存储器中的输入数据搬运到输入存储器501和/或统一存储器506、将外部存储器中的权重数据存入权重存储器502,以及将统一存储器506中的数据存入外部存储器。
总线接口单元(Bus Interface Unit,BIU)510,用于通过总线实现主CPU、DMAC和取指存储器509之间进行交互。
与控制器504连接的取指存储器(instruction fetch buffer)509,用于存储控制器504使用的指令;
控制器504,用于调用取指存储器509中缓存的指令,实现控制该运算加速器的工作过程。
一般地,统一存储器506,输入存储器501,权重存储器502以及取指存储器509均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(Double Data Rate Synchronous Dynamic Random Access Memory,简称DDR SDRAM)、高带宽存储器(High Bandwidth Memory,HBM)或其他可读可写的存储器。
下面对本申请实施例提供的信息检索方法进行详细说明。参照图3所示,为本申请实施例提供的一种信息检索方法的流程示意图。如图3所示,该方法包括步骤301-305,具体如下:
301、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;
上述检索文本Query可以是用户在搜索框输入的文本内容。
作为一种可选的实现方式,在步骤301之前,所述方法还包括:
构建候选文档库。
上述候选文档库包括以段落为粒度的文档。也就是说,该候选文档库中的任一候选文档是由一段内容组成的。
可选的,通过收集多个网页或者文本,并将每个网页或者文本中的内容打散至段落,以标题作为每个段落的标签,通过将所有添加标签的段落建立索引,进而得到上述候选文档库。
可选的,通过将Query和K个第i跳的候选文档输入至深度预训练语言模型构成的检索器中,进而得到Mi个候选文档。
作为一种可选的实现方式,通过将Query与K个第i跳的候选文档中的每个候选文档进行直接拼接,然后将拼接后得到的K个文本通过检索器进行检索,得到Mi个第i+1跳的候选文档。
具体地,利用深度预训练语言模型对海量预选文档中的每个预选文档计算表示向量,并将各表示向量进行存储和构建索引;再针对不同的Query获得每个Query的表示向量;最后根据向量索引快速搜索的方式获得与该Query最相关的多个文档。
上述仅以将Query与K个第i跳的候选文档中的每个候选文档进行直接拼接为例进行说明,其还可以是其他形式,本方案对此不做具体限定。
302、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;
可选的,深度预训练语言模型构成的检索器可基于候选文档与Query的相关程度对每个候选文档进行打分,进而输出Mi个第i+1跳的候选文档中每个候选文档的得分。
作为一种可选的实现方式,以深度预训练语言模型采用谷歌开源的深度预训练语言模型Bert为例进行说明。该模型Bert经过一些基础的网络单元,如Transformer网络堆叠成巨大的网络模型,并利用海量数据进行预训练等处理得到。以第i跳为例,输入Query以及第i跳获取到的第r个候选文档Pri,输出为模型在输入Q的条件下对候选文档Pri的打分,可参照如下公式(1)所示:
Score(Pri|Q)=Model([Pri,Q]),其中,ri=1,2,…Ni;   (1)
303、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述候选文档Pji得到的候选文档中的第y个;
需要说明的是,上述任一候选文档Pjy(i+1)用于指示随机选取的。其中,该任一候选文档是基于上一跳的候选文档得到的。该j、y仅用于便于描述,其并不具备特定限制的作用。
具体地,当i=1(即第一跳)时,输入Query以及第一跳获取到的第r个候选文档Pr1,输出为模型在输入Q的条件下对候选文档Pr1的打分Score(Pr1|Q),可参照上述公式(1)所示。
基于第一跳获取到的M1个候选文档,分别获取每个候选文档的得分以及每个候选文档对应的路径的概率。
该路径的概率是指该路径被选择的几率。路径为以第一跳的候选文档为起点,并以第i跳的任一候选文档为终点。其用于指示当前跳的候选文档是基于前述路径对应的候选文档得到的。路径可用于对该当前跳的候选文档进行解释,便于知晓其得到的过程。
例如,以第一跳的候选文档为起点,并以第四跳的任一候选文档为终点的路径为例进行 说明。该条路径包括四跳,相应地,该条路径包括四个候选文档。其中,根据第一跳的候选文档可得到该条路径对应的第二跳的候选文档。根据该第二跳的候选文档可得到该条路径对应的第三跳的候选文档。根据该第三跳的候选文档可得到该条路径对应的第四跳的候选文档。其中,每一条路径均是唯一的。
其中,当i=1时,获取所述M1个候选文档中得分较高的K个,并将该K个候选文档的分数归一化为概率,即可获得在输入Q的条件下第一跳检索路径的K个概率(条件概率)。
具体地,可将该K个候选文档的分数利用Softmax函数进行归一化,得到K个概率。
相应地,上述第一跳中K个候选文档中的任一候选文档s1对应的路径的概率可表示为:
G(Ps1|Q)=Softmax(TopK(Score(Ps1|Q))),其中,s1=1,2,…K;    (2)
上述以第一跳的路径的概率为例进行说明。相应地,第二跳的候选文档Pst2对应的路径的概率可表示为:
G(Pst2,Ps1|Q)=G(Pst2|Q,Ps1)*G(Ps1|Q),其中,st2=1,2,…N2;    (3)
其中,第二跳的候选文档Pst2是基于第一跳的候选文档Ps1得到的。
以此类推,可得到第i+1跳的候选文档中任一候选文档Pjy(i+1)对应的路径的概率。
304、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;
具体地,基于第一跳的K个候选文档对应的K个路径生成M2个第二跳的候选文档。基于该第二跳的每个候选文档的分数以及每个候选文档对应的上一跳的路径的概率,得到该第二跳的每个候选文档对应的路径的概率。将路径的概率较高的K个路径作为下一跳的基础路径,得到多个候选文档,进而以此类推,得到第i+1跳的路径的概率较高的K个文档。
也即是说,该K个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率。
需要说明的是,本申请实施例以每跳均选择K个为例进行说明,其还可以是每跳选择不同数量,本方案对此不作具体限定。
其中,生成下一跳候选文档的方法可以使用前一跳文档中超链链接的文档作为下一跳的候选文档。例如,使用前一跳文档中网页超链的文档作为下一跳的候选文档。网页超链是指互联网网页中的超链接,通过点击即可跳转到另外一个网页或网页段落。当然其还可以是通过其他形式获取到下一跳的候选文档,本方案对此不做具体限定。
305、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
可选的,步骤305可包括:
3051、确认所述K(i+1)个第i+1跳的候选文档是否达到第一预设停止条件;
3052、若所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
上述第一预设停止条件,可以是判断K个候选文档中是否至少有一个候选文档存在停止符,如果是,则返回所述Query对应的检索结果。如果不存在,则令i=i+1,并重复执行步骤301-304,例如将用户输入的所述Query与上述得到的K个候选文档进行融合,并将融合后的文本作为上述检索器的新的输入,进行新一轮检索进而得到下一跳的候选文档。其中,本方案中每一跳检索采用的检索器也可以不是同一个,本方案对此不做具体限定。
需要说明的是,停止符可以是任意带有特殊标记的文档等,以便模型能够自动停止迭代 检索。
上述步骤305可包括以下两种实现形式:
作为一种可选的实现方式,通过获取所述K个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;将所述每个候选文档对应的路径作为所述Query对应的检索结果。
相较于现有技术中最终输出文档集合,采用本方案,通过输出整条路径进而使得检索结果具备可解释性。
也就是说,根据用户输入的所述Query,输出K个文本。其中,每个文本均包括第i+1跳的候选文档和该候选文档对应的前i跳的候选文档。具体地,每个文本对应该i+1跳的i+1个候选文档,且该i+1个候选文档以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点。
进一步地,可基于上述K个第i+1跳的候选文档对应的路径的概率的大小进行排序,进而输出排序后的K个文本。
作为另一种可选的实现方式,将所述K个第i+1跳的候选文档中每个候选文档作为所述Query对应的检索结果,其中,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
也就是说,检索结果包括所述K个第i+1跳的候选文档中的每个候选文档,上述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释,方便用户等知晓该检索结果得到的过程。
该实施例以检索结果包含两跳的候选文档以及包含i+1跳的候选文档为例进行说明,其还可以是其他任意跳,本方案对此不做具体限定。
本申请实施例,通过基于当前跳获得的Mi个候选文档中每个候选文档的得分,以及该候选文档对应的上一跳的路径的概率得到当前跳该候选文档对应的路径的概率,进而基于概率较高的多个候选文档来获取下一跳的候选文档,并最终得到检索结果。相较于现有技术中每跳获取的多个候选文档仅依赖每个候选文档的得分进行排序筛选,本方案可以从全局检索路径全局最优的角度进行排序,提高了信息检索的准确度以及效率。
作为一种可选的实现方式,上述图3所示实施例可以是通过将Query输入至第一神经网络中进行处理,进而得到上述Query对应的检索结果。其中,该第一神经网络可以是经图4所示的模型训练方法训练得到的。下面对本申请实施例提供的模型训练方法进行详细介绍。参照图4,为本申请实施例提供的一种模型训练方法的流程示意图。该方法包括步骤401-402,具体如下:
401、获取训练样本,所述训练样本包括检索文本Query、正样本;所述正样本包括第N+1跳的第一文档样本对应的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得 到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;
需要说明的是,上述每一跳的文档样本的数量可以相同,也可以不同,本方案对此不做具体限定。
下面以每一跳的文档样本的数量均为K为例进行说明。
具体地,该训练样本包括Query、第N+1跳的第一文档样本对应的路径和第一跳的K-1个负样本。相应地,可以理解为,上述正样本可包括N+1跳中每一跳对应的正文档样本。其中,每一跳的正文档样本是基于其上一跳的正文档样本得到的。
上述N+1即为得到所述Query对应的检索结果所对应的跳数,或者轮数。也就是说,经过N+1轮的检索,得到了最终的检索结果。
402、根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
其中,步骤402具体可包括:
S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;
S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;
S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;
S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;
S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
其中步骤S5可包括:当所述K(i+1)个第i+1跳的文档样本达到第二预设停止条件,根据所述K个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络。
若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
上述第二预设条件可以是所述K(i+1)个第i+1跳的文档样本中的至少一个候选样本中存在停止符。其中,针对停止符的相关描述可参阅前述实施例,在此不再赘述。
上述i=1时,所述第一跳的路径负样本不存在,也就是说,在输入时第一跳不输入路径负样本。
上述训练过程中确定候选样本的得分、候选样本对应的路径的概率等,可参阅前述实施例中的相关描述,在此不再赘述。
可以理解的,每一跳可包括K个样本,该K个样本中其中一个为该跳的正样本,其余K-1个即为该跳的负样本。上述K可以是任意设定的值。
也就是说,在训练过程中,针对每一跳的检索,均施加当前跳的正确的候选文档和固定数量的错误候选文档。具体可根据每跳构成的正负样本对来训练每跳对应的深度预训练语言模型。上述固定数量的错误候选文档即为上述K-1个每一跳的负样本。其中该负样本是基于上一跳的样本动态生成的。同时,利用概率对多轮检索路径进行全局建模和打分,使得在训练时通过每跳的监督信号即可对当前轮之前的全部路径进行监督,增强了模型的检索精度。
上述第i跳的路径负样本中的任一路径负样本包括以第一跳的K个文档样本中的任一文档样本为起点,并以所述第i跳的K-1个负样本中的任一负样本为终点的路径。
也就是说,在训练过程中,针对每跳中利用路径的概率表达的K条路径均施加当前跳处正确的路径和当前跳处错误的路径。例如,第一跳对应的正样本为Pagei +,负样本为Pagei 1-,Pagei 2-…到Pagei K,第二跳对应的正样本为Pagej +,负样本为Pagej 1-,Pagej 2-…到Pagej K对于第二跳检索路径的正样本为(Pagei +,Pagej +),则第二跳的路径负样本为(Pagei +,Pagej 1-),(Pagei +,Pagej 2-)…(Pagei 1-,Pagej -),(Pagei 2-,Pagej -)…具体可根据每跳构成的正负路径对每跳对应的深度预训练语言模型形成监督。相应地,第三跳的路径负样本包括以第一跳的样本为起点,以第三跳中除正样本对应的第三跳的文档样本外的其他样本为终点,也就是说,以第三跳的负样本为终点。通过训练时在模型动态选择前K个候选时施加路径监督信号,使得当前轮到达的路径时刻获得监督,再与局部监督信号配合可大幅提升模型精度,同时实现K个候选随监督信号不断变化,增强了模型的鲁棒性。
本申请实施例输入的训练样本中的负样本为根据概率较高的K个样本得到的。相较于现有技术中基于随机选取的负样本进行训练,本方案可提高模型的精度。
本方案基于路径的概率较高的前K个候选文档来确定下一跳的负样本。相较于现有技术中随机确定每一跳的负样本,采用该手段,基于每一跳的路径的概率较高的前K个候选文档来动态确定下一跳的负样本,实现了每轮候选动态的自适应选取,增强鲁棒性;同时本方案在训练的过程中,引入路径监督信号后可以使每跳选取的K个候选随着监督信号对模型的调整而动态变化,逐步提升负样本的难度,增强模型排序的泛化能力,提升了模型精度。
参照图5,为本申请实施例提供的一种信息检索方法的流程示意图。该方法应用于问答场景。其包括步骤501-504,具体如下:
501、构建候选文档库;
以wiki网页作为数据源,以其段落为粒度打散,并以标题作为每个段落的标签,通过建立索引进而构造候选文档库。可选的,上述段落中具有其他网页的超链。如图6所示。
502、接收用户输入的Query;
可选的,问答系统接收用户输入的Query,该Query例如为“where did Algeria qualify for the first time into the round of 16?”,即阿尔及利亚在哪里第一次进入16强。
503、获取与所述Query对应的检索结果;
具体地,首先对Query进行第一跳检索得到M1个候选文档,并获取每个候选文档的得分。本实施例中深度预训练语言模型选择为Bert,Bert1代表第一跳检索时使用的模型,其中正确文档为“Wiki:Algeria at the FIFA World Cup”。
将第一跳的每个候选文档的得分按照从高至低进行排序,并选取得分较高的K个候选文档。对该K个得分利用Softmax函数归一化为概率。本申请实施例以K为4进行说明。如图7中所示,同时采用Top4的第一跳检索结果(Z1、Z2、Z3和Z4)的超链构成第二跳检索的候选文档。例如,wiki:2014 FIFA World Cup是wiki:Algeria at the FIFA World Cup段落中某个 超链链接到的文档),如图7中Mz对应的文档内容。
确认第一跳的候选文档中是否存在停止符,若不存在停止符,则利用第二跳深度预训练语言模型计算从Z-Mz路径的分数,例如将Query与第一跳检索文档Zi和第二跳检索文档Mzij进行拼接输入Bert中进行打分,所得结果为bij。
将第二跳计算出的候选文档的分数利用Softmax函数归一化为bzpij,并计算第一、二跳检索构成路径的概率api×bzpij,如图7所示。
根据第一、二跳检索构成路径的概率api×bzpij选择前Top4路径,再进行下一跳概率的计算和路径筛选,直至检索的候选文档中出现停止符后返回每条检索路径及其对应的概率。
504、根据所述Query对应的检索结果提取答案,并发送至所述用户。
将检索出的路径中的文档进行拼接,输入至答案提取模型进行答案提取。如检索出的路径为wiki:Algeria at the FIFA World Cup->wiki:2014 FIFA World Cup,后者wiki文档中包含“Brazil”,则可采用机器阅读理解的方式提取答案,并将答案返回给用户。
可选的,上述实现方法是将所述Query输入至第一神经网络进行处理得到的。
该第一神经网络是基于如下训练方法训练得到的:
在训练时针对每轮对应深度预训练语言模型施加当轮正确的文档监督信号,如图8所示,在训练第一轮深度预训练语言模型时会告知模型wiki:Algeria at the FIFA World Cup是正样本,并为之选择固定的负样本,第二轮检索同理。
且,在训练过程中,针对每轮中的利用概率表达的K条检索路径分数均施加当前轮处正确的候选路径和上一轮检索结果对应当前轮候选文档作为的错误候选路径,如图9所示。在第二轮检索出Mz系列后对第一、二轮深度预训练语言模型同时施加正确和错误的路径监督信号,正确信号为wiki:Algeria at the FIFA World Cup->wiki:2014 FIFA World Cup,第二轮的错误信号由第一轮候选的Top4来生成。
参照图10,为本申请实施例提供的一种信息检索装置的结构示意图。如图10所示,该装置包括检索模块1001和确定模块1002,具体如下:
检索模块1001,用于S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个,j、y均为正整数;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;
确定模块1002,用于S5、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
其中,所述确定模块1002,用于:
当所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1) 个第i+1跳的候选文档得到所述Query对应的检索结果。
所述确定模块1002,还用于:
获取所述K(i+1)个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;其中,将所述每个候选文档对应的路径作为所述Query对应的检索结果;或者,将所述每个候选文档作为所述Query对应的检索结果,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
可选的,所述确定模块1002,还用于:
若所述K(i+1)个第i+1跳的候选文档未达到所述第一预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第一预设停止条件。
可选的,所述第一预设停止条件为所述K(i+1)个第i+1跳的候选文档中的至少一个候选文档中存在停止符。
本申请实施例提供一种模型训练装置,包括:获取模块,用于获取训练样本,所述训练样本包括检索文本Query、正样本;所述正样本包括第N+1跳的第一文档样本对应的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;
训练模块,用于根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
作为一种可选的实现方式,所述训练模块,用于:S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
其中,所述训练模块,还用于:当所述K(i+1)个第i+1跳的文档样本达到第二预设停 止条件,根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整。
所述训练模块,还用于:若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
所述第二预设停止条件为所述K(i+1)个第i+1跳的文档样本中的至少一个候选样本中存在停止符。
参照图11所示,为本申请实施例提供的一种信息检索装置。如图11所示,该装置1100包括至少一个处理器1101,至少一个存储器1102以及至少一个通信接口1103。所述处理器1101、所述存储器1102和所述通信接口1103通过所述通信总线连接并完成相互间的通信。
处理器1101可以是通用中央处理器(CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制以上方案程序执行的集成电路。
通信接口1103,用于与其他设备或通信网络通信,如以太网,无线接入网(RAN),无线局域网(Wireless Local Area Networks,WLAN)等。
存储器1102可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。
其中,所述存储器1102用于存储执行以上方案的应用程序代码,并由处理器1101来控制执行。所述处理器1101用于执行所述存储器1102中存储的应用程序代码。
存储器1102存储的代码可执行以上提供的任一种信息检索方法。
本申请实施例提供一种信息检索系统,包括:接收模块,用于接收用户输入的Query;处理模块,用于将所述Query输入至经所述的训练方法训练得到的第一神经网络中进行处理,得到与所述Query对应的检索结果。
本申请实施例还提供一种芯片系统,所述芯片系统应用于电子设备;所述芯片系统包括一个或多个接口电路,以及一个或多个处理器;所述接口电路和所述处理器通过线路互联;所述接口电路用于从所述电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括所述存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,所述电子设备执行所述方法。
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机或处理器上运行时,使得计算机或处理器执行上述任一个方法中的一个或多个步骤。
本申请实施例还提供了一种包含指令的计算机程序产品。当该计算机程序产品在计算机或处理器上运行时,使得计算机或处理器执行上述任一个方法中的一个或多个步骤。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产 生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者通过所述计算机可读存储介质进行传输。所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如,固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。
以上所述,仅为本申请实施例的具体实施方式,但本申请实施例的保护范围并不局限于此,任何在本申请实施例揭露的技术范围内的变化或替换,都应涵盖在本申请实施例的保护范围之内。因此,本申请实施例的保护范围应以所述权利要求的保护范围为准。

Claims (25)

  1. 一种信息检索方法,其特征在于,包括:
    S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;
    S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;
    S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个,j、y均为正整数;
    S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;
    S5、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果,包括:
    当所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果,包括:
    获取所述K(i+1)个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;
    其中,将所述每个候选文档对应的路径作为所述Query对应的检索结果;
    或者,将所述每个候选文档作为所述Query对应的检索结果,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
  4. 根据权利要求2或3所述的方法,其特征在于,所述方法还包括:
    若所述K(i+1)个第i+1跳的候选文档未达到所述第一预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第一预设停止条件。
  5. 根据权利要求2至4任一项所述的方法,其特征在于,所述第一预设停止条件为所述K(i+1)个第i+1跳的候选文档中的至少一个候选文档中存在停止符。
  6. 一种模型训练方法,其特征在于,包括:
    获取训练样本,所述训练样本包括检索文本Query、正样本;所述正样本包括第N+1跳 的第一文档样本对应的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;
    根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络,包括:
    S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;
    S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;
    S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;
    S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;
    S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,包括:
    当所述K(i+1)个第i+1跳的文档样本达到第二预设停止条件,根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
  10. 根据权利要求8或9所述的方法,其特征在于,所述第二预设停止条件为所述K(i+1) 个第i+1跳的文档样本中的至少一个候选样本中存在停止符。
  11. 一种信息检索方法,其特征在于,包括:
    接收用户输入的Query;
    将所述Query输入至经权利要求6至10任一项所述的训练方法训练得到的第一神经网络中进行处理,得到与所述Query对应的检索结果。
  12. 一种信息检索装置,其特征在于,包括:
    检索模块,用于S1、根据检索文本Query和Ki个第i跳的候选文档得到Mi个第i+1跳的候选文档;其中,i、Ki、Mi均为正整数,所述Ki不大于Mi;S2、获取所述Mi个第i+1跳的候选文档中每个候选文档的得分,所述得分用于表征该候选文档与所述Query的相关程度;S3、对于所述Mi个第i+1跳的候选文档中任一候选文档Pjy(i+1),根据所述候选文档Pjy(i+1)的得分和路径L的概率得到所述候选文档Pjy(i+1)对应的路径的概率,其中,所述路径L为以第一跳的候选文档为起点,并以所述Ki个第i跳的候选文档中候选文档Pji为终点的路径,所述候选文档Pji为所述第i跳的Ki个候选文档中的第j个,所述候选文档Pjy(i+1)为根据所述第i跳的候选文档Pji得到的第i+1跳的候选文档中的第y个,j、y均为正整数;S4、根据所述Mi个第i+1跳的候选文档分别对应的路径的概率得到K(i+1)个第i+1跳的候选文档,其中,所述K(i+1)个第i+1跳的候选文档为所述Mi个第i+1跳的候选文档中的候选文档,且所述K(i+1)个第i+1跳的候选文档的路径的概率均高于所述Mi个候选文档中的其余候选文档的路径的概率,所述K(i+1)为不大于Mi的正整数;
    确定模块,用于S5、根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
  13. 根据权利要求12所述的装置,其特征在于,所述确定模块,用于:
    当所述K(i+1)个第i+1跳的候选文档达到所述第一预设停止条件,根据所述K(i+1)个第i+1跳的候选文档得到所述Query对应的检索结果。
  14. 根据权利要求13所述的装置,其特征在于,所述确定模块,还用于:
    获取所述K(i+1)个第i+1跳的候选文档中每个候选文档对应的路径,所述每个候选文档对应的路径为以第一跳的候选文档为起点,并以所述第i+1跳的该候选文档为终点的路径;
    其中,将所述每个候选文档对应的路径作为所述Query对应的检索结果;
    或者,将所述每个候选文档作为所述Query对应的检索结果,所述每个候选文档对应的路径用于对该候选文档对应的检索结果进行解释。
  15. 根据权利要求13或14所述的装置,其特征在于,所述确定模块,还用于:
    若所述K(i+1)个第i+1跳的候选文档未达到所述第一预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第一预设停止条件。
  16. 根据权利要求13至15任一项所述的装置,其特征在于,所述第一预设停止条件为所述K(i+1)个第i+1跳的候选文档中的至少一个候选文档中存在停止符。
  17. 一种模型训练装置,其特征在于,包括:
    获取模块,用于获取训练样本,所述训练样本包括检索文本Query和正样本;所述正样本包括第N+1跳的第一文档样本对应的路径,所述第N+1跳的第一文档样本对应的路径为以第一跳的文档样本为起点,并以所述第N+1跳的第一文档样本为终点的路径;所述第N+1跳的第一文档样本为所述第N+1跳的K(N+1)个文档样本中概率高于其余K(N+1)-1个的路径对应的文档样本;所述第N+1跳的K(N+1)个文档样本中任一文档样本Pjy(N+1)对应的路径的概率为根据文档样本Pjy(N+1)的得分和路径T的概率得到的,其中,所述得分用于表征该文档样本与所述Query的相关程度,所述路径T为以第一跳的文档样本为起点,并以所述K(N+1)个第N+1跳的文档样本中文档样本PjN为终点的路径,所述文档样本PjN为所述第N跳的KN个文档样本中的第j个,所述文档样本Pjy(N+1)为根据所述文档样本PjN得到的文档样本中的第y个;所述训练样本还包括K1-1个第一跳的负样本,所述K1-1个第一跳的负样本为该跳的K1个文档样本中除所述正样本对应的当前跳的文档样本之外的文档样本;N为正整数,K1、K(N+1)均为不小于2的整数,j、y均为正整数;
    训练模块,用于根据所述训练样本对第一神经网络进行训练,得到训练完的所述第一神经网络。
  18. 根据权利要求17所述的装置,其特征在于,所述训练模块,用于:
    S1、根据所述Query、所述正样本对应的第i跳的文档样本、Ki-1个第i跳的负样本和第i跳的路径负样本得到Mi个第i跳的候选样本;所述第i跳的路径负样本中的任一路径负样本包括以第一跳的K1个文档样本中的任一文档样本为起点,并以所述第i跳的Ki-1个负样本中的任一负样本为终点的路径;i为不小于1的整数,Ki为不小于2的整数,Mi为正整数;
    S2、获取所述Mi个第i跳的候选样本中每个候选样本的得分;
    S3、根据所述Mi个第i跳的候选样本中每个候选样本的得分获取所述每个候选样本分别对应的路径的概率;
    S4、根据所述Mi个第i跳的候选样本分别对应的路径的概率得到K(i+1)个第i+1跳的文档样本,其中,所述K(i+1)个第i+1跳的文档样本的路径的概率均高于所述Mi个候选样本中的其余候选样本的路径的概率,所述K(i+1)为不大于Mi的正整数,所述K(i+1)个第i+1跳的文档样本包括所述正样本对应的第i+1跳的文档样本和K(i+1)-1个第i+1跳的负样本;
    S5、根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整,得到所述训练完的第一神经网络;其中,i=1时,所述第一跳的路径负样本不存在。
  19. 根据权利要求18所述的装置,其特征在于,所述训练模块,还用于:
    当所述K(i+1)个第i+1跳的文档样本达到第二预设停止条件,根据所述K(i+1)个第i+1跳的文档样本分别对应的路径和所述正样本,对所述第一神经网络的参数进行调整。
  20. 根据权利要求18或19所述的装置,其特征在于,所述训练模块,还用于:
    若所述K(i+1)个第i+1跳的文档样本未达到所述第二预设停止条件,令i=i+1,并重复执行步骤S1-S4,直到达到所述第二预设停止条件。
  21. 根据权利要求18至20任一项所述的装置,其特征在于,所述第二预设停止条件为所述K(i+1)个第i+1跳的文档样本中的至少一个候选样本中存在停止符。
  22. 一种信息检索系统,其特征在于,包括:
    接收模块,用于接收用户输入的Query;
    处理模块,用于将所述Query输入至经权利要求6至10任一项所述的训练方法训练得到的第一神经网络中进行处理,得到与所述Query对应的检索结果。
  23. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行以实现权利要求1至11任意一项所述的方法。
  24. 一种计算机程序产品,其特征在于,当计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1至11任意一项所述的方法。
  25. 一种信息检索装置,其特征在于,包括处理器和存储器;其中,所述存储器用于存储程序代码,所述处理器用于调用所述程序代码,以执行如权利要求1至11任一项所述的方法。
PCT/CN2022/073819 2021-02-08 2022-01-25 信息检索方法及相关系统、存储介质 WO2022166689A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/446,034 US20230385317A1 (en) 2021-02-08 2023-08-08 Information Retrieval Method, Related System, and Storage Medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110172627.5 2021-02-08
CN202110172627.5A CN114911894A (zh) 2021-02-08 2021-02-08 信息检索方法及相关系统、存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/446,034 Continuation US20230385317A1 (en) 2021-02-08 2023-08-08 Information Retrieval Method, Related System, and Storage Medium

Publications (1)

Publication Number Publication Date
WO2022166689A1 true WO2022166689A1 (zh) 2022-08-11

Family

ID=82740898

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/073819 WO2022166689A1 (zh) 2021-02-08 2022-01-25 信息检索方法及相关系统、存储介质

Country Status (3)

Country Link
US (1) US20230385317A1 (zh)
CN (1) CN114911894A (zh)
WO (1) WO2022166689A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115438193A (zh) * 2022-09-23 2022-12-06 苏州爱语认知智能科技有限公司 一种路径推理模型的训练方法及路径推理方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118013020B (zh) * 2024-04-09 2024-06-18 北京知呱呱科技有限公司 一种基于检索生成联合式训练的专利查询方法及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080319973A1 (en) * 2007-06-20 2008-12-25 Microsoft Corporation Recommending content using discriminatively trained document similarity
CN111538819A (zh) * 2020-03-27 2020-08-14 北京工商大学 一种基于文档集多跳推理的问答系统的构建方法
CN111782961A (zh) * 2020-08-05 2020-10-16 中国人民解放军国防科技大学 一种面向机器阅读理解的答案推荐方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080319973A1 (en) * 2007-06-20 2008-12-25 Microsoft Corporation Recommending content using discriminatively trained document similarity
CN111538819A (zh) * 2020-03-27 2020-08-14 北京工商大学 一种基于文档集多跳推理的问答系统的构建方法
CN111782961A (zh) * 2020-08-05 2020-10-16 中国人民解放军国防科技大学 一种面向机器阅读理解的答案推荐方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115438193A (zh) * 2022-09-23 2022-12-06 苏州爱语认知智能科技有限公司 一种路径推理模型的训练方法及路径推理方法
CN115438193B (zh) * 2022-09-23 2023-05-16 苏州爱语认知智能科技有限公司 一种路径推理模型的训练方法及路径推理方法

Also Published As

Publication number Publication date
US20230385317A1 (en) 2023-11-30
CN114911894A (zh) 2022-08-16

Similar Documents

Publication Publication Date Title
WO2020228376A1 (zh) 文本处理方法、模型训练方法和装置
US10133729B2 (en) Semantically-relevant discovery of solutions
JP6892389B2 (ja) ビデオのための代表ビデオフレームの選択
US20220012297A1 (en) Embedding Based Retrieval for Image Search
CN110083693B (zh) 机器人对话回复方法及装置
WO2022166689A1 (zh) 信息检索方法及相关系统、存储介质
CN110795527B (zh) 候选实体排序方法、训练方法及相关装置
CN112084789B (zh) 文本处理方法、装置、设备及存储介质
CN117521814B (zh) 一种基于多模态输入和知识图谱的问答方法及装置
US20230117973A1 (en) Data processing method and apparatus
CN108536735B (zh) 基于多通道自编码器的多模态词汇表示方法与系统
JP2022024102A (ja) 検索モデルのトレーニング方法、目標対象の検索方法及びその装置
CN116310318B (zh) 交互式的图像分割方法、装置、计算机设备和存储介质
WO2024041483A1 (zh) 一种推荐方法及相关装置
WO2023185925A1 (zh) 一种数据处理方法及相关装置
WO2021248068A1 (en) Machine learning algorithm search with symbolic programming
WO2024114659A1 (zh) 一种摘要生成方法及其相关设备
CN116702784B (zh) 实体链接方法、装置、计算机设备和存储介质
CN117131273A (zh) 资源搜索方法、装置、计算机设备、介质及产品
WO2024007119A1 (zh) 文本处理模型的训练方法、文本处理的方法及装置
WO2023051678A1 (zh) 一种推荐方法及相关装置
CN117009621A (zh) 信息搜索方法、装置、电子设备、存储介质及程序产品
CN115618950A (zh) 一种数据处理方法及相关装置
JP2024507029A (ja) ウェブページ識別方法、装置、電子機器、媒体およびコンピュータプログラム
CN114969253A (zh) 市场主体与政策的匹配方法、装置、计算设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22748968

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22748968

Country of ref document: EP

Kind code of ref document: A1