Question-answer processing method and apparatus

By converting multi-modal resources into text resources and using matching models to generate answers, the accuracy and performance problems of question and answer processing in the existing technology are solved, and cross-modal reasoning and efficiency improvements are achieved.

WO2024220031A1PCT designated stage expired Publication Date: 2024-10-24ALIBABA INNOVATION PRIVATE LIMITED

Patent Information

Application Number
PCT/SG2024/050202
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-10
Filing Date
2024-03-29
Publication Date
2024-10-24

AI Technical Summary

Technical Problem

When existing technology uses multi-modal data for question and answer processing, it is difficult to generate accurate answers, puts pressure on storage performance and computing performance, and cannot achieve cross-modal reasoning.

Method used

Convert multi-modal resources into text resources, use question text to match text resources, and generate answers through retrieval and sorting models, which reduces dependence on different modalities and improves the accuracy of answers.

Benefits of technology

It realizes cross-modal reasoning, improves the accuracy of answers, reduces the pressure on storage and computing performance, and improves the efficiency of the question and answer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SG2024050202_24102024_PF_FP_ABST
    Figure SG2024050202_24102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present disclosure are a question-answer processing method and apparatus. The main technical solution involves: acquiring question text; matching the question text in a resource library, so as to obtain N text resources matching the question text, N being a preset positive integer, and the resource library comprising text resources, and text resources which are converted from resources of other modalities; and inputting the question text and the N text resources into an answer generation model, and acquiring answer text corresponding to the question text, which answer text is generated by the answer generation model using the N text resources.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Cross-Reference to Question and Answer Processing Method and Apparatus This disclosure claims priority to Chinese patent application No. 202310413954.4, filed with the China Patent Office on April 10, 2023, entitled "Question and Answer Processing Method and Apparatus," the entire contents of which are incorporated herein by reference. Technical Field This disclosure relates to the field of artificial intelligence technology, and more particularly to a question and answer processing method and apparatus. Background: Intelligent question and answering (Q&A) is a very popular application in the field of artificial intelligence, requiring intelligent Q&A systems to automatically answer questions in natural language. With the explosive growth of multimodal data such as images, text, and videos, the diversification of content formats has provided opportunities for intelligent Q&A systems to better answer user questions. However, how to leverage multimodal data to provide users with accurate answers has become an urgent issue. SUMMARY This disclosure provides a question and answer processing method and apparatus to facilitate leveraging multimodal data to provide users with accurate answers. The present disclosure provides the following solutions: In a first aspect, a question-answering processing method is provided, comprising: obtaining a question text; matching the question text against a resource list to obtain N text resources that match the question text, where N is a preset positive integer and the resource list includes text resources and text resources converted from other modal resources; inputting the question text and the N text resources into an answer generation model to obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources. According to an achievable method in an embodiment of the present disclosure, the method further comprises pre-building the resource library using the following processing: obtaining resources of multiple modalities from a multimodal data list; storing text resources contained in the multiple modal resources in a resource library; converting modal resources other than text resources contained in the multiple modal resources into text resources, and storing the converted text resources in the resource library.According to an implementable manner in an embodiment of the present disclosure, converting other modal resources other than text resources included in the multiple modal resources into text resources includes: for image resources, using a description generation model to obtain a text description of the image resource, and using the text description as a text resource converted from the image resource; and / or, for image resources, using a target detection model to obtain target information in the image resource, and using text corresponding to the target information as a text resource converted from the image resource; and / or, for image resources, using a description generation model to obtain a text description of the image resource, using a target detection model to obtain target information in the image resource, splicing the text description and the text corresponding to the target information to obtain a text resource converted from the image resource; and / or, for table resources, using a table parser to parse the table resource into one-dimensional text content, and using the one-dimensional text content as a text resource converted from the table resource. According to one possible implementation of the present disclosure, matching the question text in the resource library to obtain N text resources matching the question text includes: using a retrieval model to search the resource library to determine K text resources whose corresponding feature representations meet a preset relevance requirement; using a ranking model to sort the K text resources, and selecting N text resources based on the sorting results, where K is a positive integer greater than N. According to one possible implementation of the present disclosure, sorting the K text resources using the ranking model and selecting N text resources based on the sorting results includes: concatenating the K text resources with the question text to obtain K text sequences; using the ranking model to obtain feature representations for each of the K text sequences, and using the feature representations of the K text sequences to predict ranking scores for each of the K text resources; and selecting the top N text resources based on the ranking scores.According to an achievable method in an embodiment of the present disclosure, the retrieval model is pre-trained in the following manner: first training data comprising a plurality of positive sample pairs and negative sample pairs is obtained, each sample pair comprising a first question sample and a first text resource sample, wherein the first text resource sample is derived from the resource rhino; and a retrieval model is trained using the first training data, wherein the retrieval model obtains a feature representation of the first question sample and a feature representation of the first text resource sample, and determines a correlation between the feature representation of the first question sample and the feature representation of the first text resource sample. The training objectives include maximizing the similarity between the feature representation of the first question sample and the feature representation of the first text resource sample in the positive sample pairs, and minimizing the similarity between the feature representation of the first question sample and the feature representation of the first text resource sample in the negative sample pairs. According to one possible implementation of the present disclosure, the ranking model is pre-trained in the following manner: second training data comprising multiple positive and negative sample pairs is obtained, each sample pair comprising a second question sample and a second text resource sample, the second text resource sample being derived from the resource rhino; the ranking model is trained using the second training data, wherein the ranking model obtains a feature representation of a text sequence obtained by concatenating the second question sample and the second text resource sample in the sample pair, and uses this feature representation to predict a ranking score for the corresponding second text resource sample. The training objective includes maximizing the difference between the ranking score of the second text resource sample in the positive sample pair corresponding to the same second question sample and the ranking score of the second text resource sample in the corresponding negative sample pair. According to one possible implementation of the present disclosure, the answer generation model includes an encoding module and a decoding module; the encoding module concatenates the question text and the N text resources and performs an attention-based encoding process on the concatenated text sequence to obtain a feature representation of each token in the text sequence; the decoding module uses the feature representation of each token in the text sequence to perform decoding to obtain the answer text corresponding to the question text.According to an implementable method in an embodiment of the present disclosure, the answer generation model is pre-trained in the following manner: third training data including multiple training samples is obtained, where the training samples include a third question sample, N text resources in the resource library that match the third question sample, and an answer sample corresponding to the third question sample; the answer generation model is trained using the third training data, where the third question sample and the N text resources that match the third question sample are input into the answer generation model, and the answer generation model generates an answer text for the third question sample, and the goal of the training is to minimize the difference between the answer text generated by the answer generation model for the third question sample and the answer sample corresponding to the third question sample. In a second aspect, a question-answering processing method is provided, which is applied to an intelligent question-answering system, and the method includes: obtaining a question text corresponding to a question input by a user into the intelligent question-answering system; matching the question text in a resource source to obtain N text resources matching the question text, where N is a preset positive integer, and the resource source includes text resources and text resources converted from other modal resources; inputting the question text and the N text resources into an answer generation model, and obtaining an answer text corresponding to the question text generated by the answer generation model using the N text resources; and returning an answer to the user using the answer text. According to a third aspect, a question-answering processing method is provided, which is executed by a cloud server. The method includes: obtaining a question text from a user device, or obtaining a question text corresponding to a question voice from the user device; matching the obtained question text in a resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resources include text resources and text resources converted from other modal resources; inputting the question text and the N text resources into an answer generation model, and obtaining an answer text corresponding to the question text generated by the answer generation model using the N text resources; returning the answer text to the user device, or returning the answer voice generated using the answer text to the user device.In a fourth aspect, a question-and-answer processing apparatus is provided, comprising: a question acquisition unit configured to acquire a question text; a resource matching unit configured to match the question text against a resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resource library includes text resources and text resources converted from other modal resources; and an answer generation unit configured to input the question text and the N text resources into an answer generation model, and obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources. According to a fifth aspect, a computer-readable storage medium is provided, storing a computer program, which, when executed by a processor, implements the steps of the method described in any one of the first to third aspects. According to a sixth aspect, an electronic device is provided, comprising: one or more processors; and a memory associated with the one or more processors, the memory configured to store program instructions, which, when read and executed by the one or more processors, implements the steps of the method described in any one of the first to third aspects. According to specific embodiments provided by the present disclosure, the present disclosure provides the following technical effects:

[0002] 1) This paper adopts a clever approach: converting multimodal resources into text resources, matching the text resources with the question text, and then using the matched text resources and the question text to generate the answer. This approach enables cross-modal reasoning, thereby improving the accuracy of the answer. It also eliminates the need to train separate answer generation models for different modalities, reducing the pressure on storage and computing performance.

[0003] 2) The answer generation model in this disclosure needs to process question text and text resources, that is, it involves text input and does not involve the combination of multiple modalities, so the model implementation is easier.

[0004] 3) The method provided by this disclosure is to convert resources in other modalities, such as image resources and table resources, into text resources and store them in a resource library. Feature representations of text resources are extracted and stored in advance. Compared with the feature representations of resources in other modalities, such as image resources and table resources, the feature representations of text resources require fewer storage resources and are therefore more efficient in both resource storage and retrieval.

[0005] 4) In this disclosure, both the retrieval model and the ranking model are trained using a comparative learning approach, reducing reliance on labeled data and lowering the difficulty of model training. Of course, any product implementing this disclosure does not necessarily need to achieve all of the advantages described above. BRIEF DESCRIPTION OF THE DRAWINGS: To more clearly illustrate the embodiments of this disclosure or the technical solutions in the prior art, the following briefly introduces the figures required for use in the embodiments. Obviously, the figures described below represent some embodiments of this disclosure. Those skilled in the art can also derive other figures based on these figures without inventive effort. Figure 1 is a system architecture diagram applicable to the embodiments of this disclosure; Figure 2 is a flow chart of the question-and-answer processing method provided in the embodiments of this disclosure; Figure 3 is a schematic diagram of the structure of the retrieval model provided in the embodiments of this disclosure; Figure 4 is a schematic diagram of the structure of the ranking model provided in the embodiments of this disclosure; Figure 5 is a schematic diagram of the structure of the answer generation model provided in the embodiments of this disclosure; Figure 6 is a schematic diagram of the overall architecture of the question-and-answer processing provided in the embodiments of this disclosure; Figure 7 is a schematic block diagram of the question processing device provided in the embodiments of this disclosure; and Figure 8 is a schematic block diagram of the electronic device provided in the embodiments of this disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The technical solutions in the embodiments of the present disclosure will be described clearly and completely below, in conjunction with the accompanying drawings. It should be understood that the described embodiments are only some of the embodiments of the present disclosure, and are not exhaustive. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure are within the scope of protection of the present disclosure. The terms used in the embodiments of the present disclosure are for the purpose of describing specific embodiments and are not intended to limit the present disclosure. The singular forms "a," "an," "the," and "the" used in the embodiments of the present disclosure and the appended claims are intended to include the plural forms, unless the context clearly indicates otherwise. It should be understood that the term "and / or" as used herein describes an association relationship between associated objects, indicating that three possible relationships can exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " as used herein generally indicates that the associated objects are in an "or" relationship. Depending on the context, the term "if" as used herein can be interpreted as "when," "when," "in response to a determination," or "in response to a detection." Similarly, the phrases “if determined” or “if (stated condition or event) is detected” may be interpreted as “when determined” or “in response to determining” or “when detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.Existing methods for question-answering using multimodal data primarily include the following two approaches: The first involves training separate models for multimodal data, such as text, tables, and images, and then using a classifier to determine which modality's model should be used to generate the answer. This approach requires training separate models for each modality, which places pressure on both storage and computing performance, and cannot implement cross-modal reasoning. Therefore, the accuracy of generated answers remains to be improved. The second approach involves training a multimodal model capable of simultaneously accepting multimodal inputs, such as text, tables, and images, and then generating answers using this multimodal data. However, such models are extremely difficult to train. In light of this, the present disclosure provides a novel approach for question-answering using multimodal data. To facilitate understanding of the present disclosure, a brief description of the system architecture to which the present disclosure applies is first provided. Figure 1 illustrates an exemplary system architecture to which embodiments of the present disclosure can be applied. As shown in Figure 1 , the system architecture may include a user device and a question-answering processing device located on a server. A user can input a question text or a voice message containing a question through a user device, which then sends the question text or voice message containing a question to the server. User devices may include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, and PCs (Personal Computers). Smart mobile devices may include, for example, mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), and internet-connected cars. Smart home devices may include smart TVs, smart speakers, and smart refrigerators. Wearable devices may include, for example, smart watches, smart glasses, virtual reality devices, augmented reality devices, and mixed reality devices (i.e., devices that support both virtual reality and augmented reality). The server provides the received question text to a question-and-answer processing device. Alternatively, the server performs speech recognition on the received voice message containing the question and provides the question text obtained through speech recognition to the question-and-answer processing device. The question-and-answer processing device may employ the method provided in the embodiments of the present disclosure, utilizing multimodal data in the resource source to perform question-and-answer processing on the question text and generate a textual answer. The question-and-answer processing device utilizes retrieval models, ranking models, and answer generation models during question-and-answer processing. After obtaining the answer text generated by the question-and-answer processing device, the server can return the answer text to the user device via the network. Alternatively, the server can perform speech synthesis on the answer text to generate a speech containing the answer, which it then returns to the user device.The question-and-answer processing device can be configured as a standalone server, within a server cluster, or within a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product within a cloud computing service system. It addresses the management difficulties and weak service scalability of traditional physical hosts and virtual private servers (VPS) services. In addition to the architecture shown in Figure 1 , the question-and-answer processing device can also be configured within a computer terminal with significant computing power. It should be understood that the number of user devices, question-and-answer processing devices, retrieval models, ranking models, answer generation models, and resource repositories shown in Figure 1 is illustrative. Any number of user devices, question-and-answer processing devices, retrieval models, ranking models, answer generation models, and resource repositories can be implemented as needed. Figure 2 is a flow chart of a question-and-answer processing method according to an embodiment of the present disclosure. This method can be executed by the question-and-answer processing device in the system shown in Figure 1 . As shown in Figure 2 , the method may include the following steps: Step 202: Obtaining question text. Step 204: Match the question text against the resource source to obtain N text resources that match the question text, where N is a preset positive integer. The resource library includes text resources as well as text resources converted from resources in other modalities. Step 206: Input the question text and the N text resources into the answer generation model to obtain the answer text corresponding to the question text, generated by the answer generation model using the N text resources. As can be seen from the above process, the present disclosure employs a clever approach: converting multimodal resources into text resources, matching the text resources with the question text, and then generating answers using the matched text resources and the question text. This approach enables cross-modal reasoning, thereby improving answer accuracy. It also eliminates the need to train separate question-answering models for different modalities, reducing the pressure on storage and computing performance. Each step in the above process is described in detail below. First, step 202, "obtaining the question text," is described in detail in conjunction with an embodiment. Question text typically comes from the user, and the source of the obtained question text can vary in different application scenarios. For example, a user can enter a question text into a text box provided by the intelligent question-answering system through a user device. Alternatively, the user can enter a question voiced into the user device. The question-answering processing device on the server side obtains the question text from the user device, or performs voice recognition on the question voiced from the user device to obtain the question text. The following describes in detail step 204, "matching the question text against the resource library to obtain N text resources matching the question text," in conjunction with an embodiment.The resource library involved in the embodiments of this disclosure comes from a multimodal database, which contains resources of various modalities, such as text resources, image resources, and table resources. The resource library contains only text resources, some of which are text resources from the multimodal database, while others are text resources converted from non-text resources in the multimodal database. One possible implementation involves first obtaining multimodal resources from the multimodal database, then storing the text resources contained in the multimodal resources in the resource library, and then converting modal resources other than text resources contained in the multimodal resources into text resources, which are then stored in the resource library. In addition to the above method, other methods can also be used to obtain multimodal resources, such as crawling multimodal resources from the internet. If the text resources are pure text, they can be directly stored in the resource library. However, some text resources contain images and tables in addition to pure text. In this case, the image and table resources can be extracted and converted into text resources. Image resources can be converted into text resources using, but not limited to, the following methods: First, a description generation model is used to obtain a text description of the image resource, and this text description is used as the text resource converted from the image resource. Currently, some description generation models exist that can generate a text description of an image resource upon input. The text description of an image resource primarily uses natural language to describe the content of the image. For example, for an image resource depicting horse racing, a description generation model can automatically generate a text description such as "a group of people on horseback." Given the numerous existing implementations of description generation models, this embodiment utilizes an existing description generation model to obtain a text description of an image resource, and therefore will not be described in detail. In addition to using a description generation model to obtain a text description of an image, other methods can also be used. For example, in some documents, a line of text containing an image introduction or explanation is located below the image location; this line of text can be used as the text description of the image. Second, an object detection model is used to obtain target information from the image resource, and the text corresponding to the target information is used as the text resource converted from the image resource. The object detection model is primarily used to detect target information such as the location, type, and attributes of an object in an image. In the embodiments of the present disclosure, the target information obtained through object detection in an image can be used as a text resource converted from the image resource. For example, in an image resource of horse racing, the object detection model can detect that the target information includes: a brown racehorse, a large white stadium, and a jockey."Brown racehorse; large white stadium; jockey" can be used as the text resource after the image is converted. Given the numerous existing implementations of object detection models, this disclosed embodiment utilizes existing object detection models to obtain the object information of image resources, and therefore does not describe these models in detail. A third approach involves utilizing a description generation model to obtain a text description of the image resource, utilizing an object detection model to obtain the object information within the image resource, and then concatenating the text description with the text corresponding to the object information to obtain a text resource converted from the image resource. This approach is essentially a combination of the two approaches above. Still using the image in the example above, concatenating the text description with the object information yields "a group of people on horseback; brown racehorse; large white stadium; jockey" as the text resource for the image. In addition to the aforementioned approaches, other approaches can be combined to obtain a text resource converted from an image resource. For example, if the image has a title, the title can be used as or incorporated into the text resource converted from the image resource. For table resources, a table parser can be used to parse them into one-dimensional text content, which is then used as the text resource converted from the table resource. Table resources typically consist of two-dimensional rows and columns, while text resources are typically one-dimensional text content. The conversion from two-dimensional content to one-dimensional content performed by a table parser is often referred to as "table linearization." Table parsers typically implement this conversion based on pre-set rules. For example, "header" and "row" may be used to separate the header from the content of each row, respectively. If there is no header, the "header" section can be omitted. Take Table 1 as an example: Table 1. Converting Table 1 above into text resources yields "The name of the competition in the first row is the AAA Cup, and the venue is XXX Church. The name of the competition in the second row is the BBB Cup, and the venue is YYY Stadium." Similar concepts can be used to convert other types of resources into text resources. For example, for video resources, keyframe images can be extracted from the video resource. These keyframe images are then converted into text resources using the method provided in the above embodiment and then spliced ​​together to form the text resource converted from the video resource. This step, when matching the question text within the resource pool, can include two processes: retrieval and sorting. This primarily includes the following sub-steps: Step 2042: Utilize a retrieval model to search the resource pool and identify K text resources whose corresponding feature representations meet a preset relevance requirement. The retrieval model involved in the embodiments of this disclosure can be shown in Figure 3 and includes an encoding module and a relevance determination module. The encoding module is used to encode the question text to obtain its feature representation and to encode each text resource in the resource pool to obtain its feature representation. In one preferred embodiment, the encoding module can pre-encode each text resource in the resource library, obtain a feature representation for each text resource, and then store the feature representation of each text resource in the resource library. This allows real-time encoding of the question text during the actual matching process, reducing computational effort and improving efficiency. Before encoding the input text (i.e., question text or text resource), the encoding module can first perform embedding on the input text. For example, word-based embedding or position-based embedding can be used. Word embedding involves encoding each token (element) using a word vector to obtain a word vector representation. Position embedding involves encoding the position of each token in the input text to obtain a position representation. Tokens in a text refer to the elements that constitute the text.For text, the text is segmented into character or word sequences. Each character or word, as well as the start symbol and separator in the text sequence, is considered a token. The encoding module can be trained based on a pre-trained language model. Pre-trained language models such as the T5 (Transfer Text-to-Text Transformer), BERT (Bidirectional Encoder Representation from Transformers), XLNet (an autoregressive model that implements bidirectional contextual information through a permutation language model), and GPT (Generative Pre-Training) are used as the initial encoding module, and further training is performed on this basis. The similarity determination module is used to calculate the similarity between the feature representation of the question text and the feature representations of various text resources. K text resources are identified whose correlation between their corresponding feature representations and the feature representation of the question text meets a preset correlation requirement, where K is a preset positive integer. The correlation between feature representations can be measured using metrics such as cosine similarity and Euclidean distance. The aforementioned relevance requirement can be that the correlations between feature representations are ranked in the top K, or that the correlations between feature representations are greater than or equal to a preset relevance threshold, etc. When pre-training the aforementioned retrieval model, first training data comprising multiple positive and negative sample pairs can be obtained. Each sample pair includes a first question sample and a first text resource sample, with the first text resource sample originating from a resource library. It should be noted that the definitions of "first" and "second" in the embodiments of this disclosure do not restrict size, order, or quantity, but are used to distinguish between two training data sets. For example, "first training data" and "second training data" are used to distinguish two training data sets by name. For another example, "first question sample" and "second question sample" are used to distinguish two question samples by name. For another example, "first text resource sample" and "second text resource sample" are used to distinguish two text resource samples by name. Positive sample pairs can be manually constructed, for example, by constructing a first question sample and manually selecting text resources from the resource library that semantically match the first question text as positive samples. In addition to manual construction, other methods can also be used to obtain, for example, obtaining the user's search text from historical search logs as the first question sample and the text resource clicked by the user from the search results as the first text resource sample in the positive sample pair.Negative sample pairs can be constructed artificially, or using any one or any combination of the following methods, but not limited to: First, combine the first question sample from one positive sample pair with the first text resource sample from another positive sample pair to form a negative sample pair. For example, given the positive sample pair (q1, k1) and (q2, k2), (q1, k2) and (q2, k1) can be used as negative samples. Second, take the first question sample and the first text resource sample from the positive sample pair, randomly sample a text resource sample different from the first text resource sample from the resource library, and combine the first question sample and the randomly sampled text resource sample to form a member sample pair. For example, given the positive sample pair (q1, k1), randomly sample a text resource sample k3 from the resource library, and use (q1, k3) as the negative sample pair. The third method: Take the first question sample and the first text resource sample from the positive sample pair. Use the BM25 algorithm to identify text resources from the resource library whose similarity to the first question sample exceeds a preset similarity threshold. Select a text resource from the identified text resources that is different from the first text resource sample in the positive sample pair. This first question sample and the selected text resource constitute a negative sample pair. For example, given a positive sample pair (ql, kl), use the BM25 algorithm to identify a Wensi resource from the resource library whose similarity to ql exceeds a preset similarity threshold. Randomly select a document knowledge from the identified text resources that is not kl, for example, k2. (ql, k2) constitutes a negative sample pair.

[0006] The BM25 algorithm is a classic algorithm for calculating the similarity between two texts. It is an improved text similarity calculation method based on the TF (Term Frequency)-IDF (Inverse Document Fraction) method. Since this algorithm is well-known, it will not be described in detail here. The above method can construct a large number of negative sample pairs, reducing the labor cost of manually constructing negative sample pairs. The retrieval model is trained using the first training data. Comparative learning is employed in retrieval model training. The retrieval model obtains feature representations of the first question sample and the first text resource sample, and determines the correlation between the feature representations of the first question sample and the first text resource sample. The training objectives include maximizing the similarity between the feature representations of the first question sample and the first text resource sample in the positive sample pair, and minimizing the similarity between the feature representations of the first question sample and the first text resource sample in the negative sample pair. In the disclosed embodiment, a loss function can be constructed based on the above training objectives. The loss function value is used in each iteration to update the retrieval model parameters using methods such as gradient descent until the preset training end conditions are met. The training termination conditions may include, for example, the loss function value being less than or equal to a preset loss function threshold, the number of iterations reaching a preset threshold, etc. Step 2044: Rank K text resources using the ranking model, and select N text resources based on the ranking results, where K is a positive integer greater than N, and N is a positive integer. When ranking the K text resources using the ranking model, as one possible implementation, as shown in FIG4 , the K text resources can be concatenated with the question text to obtain K text sequences. The feature extraction network in the ranking model is used to obtain feature representations for each of the K text sequences. The prediction network in the ranking model then uses the feature representations of the K text sequences to predict ranking scores for each of the K text resources. The feature extraction network may also utilize pre-trained language models such as T5, BERT, XLNet, or GPT. Before encoding, the feature extraction network may first perform embedding processing on the input text sequence. For example, word-based embedding or position-based embedding may be used. Among them, word embedding is to encode each token into a word vector to obtain a word vector representation. Position embedding is to encode the position of each token in the input text sequence to obtain a position representation.When pre-training the ranking model, the ranking model can first obtain second training data comprising multiple positive and negative sample pairs. Each sample pair includes a second question sample and a second text resource sample, with the second text resource sample originating from the aforementioned resource library. Positive sample pairs can be constructed manually or obtained through other methods, such as obtaining a user's search text from historical search logs as the second question sample, and the text resource clicked by the user from the search results as the second text resource sample in the positive sample pair. The construction of negative sample pairs is similar to the construction of negative samples in the first training data described in the above embodiment and will not be elaborated here. In the disclosed embodiments, contrastive learning can also be employed when training the ranking model using the second training data. The ranking model obtains a feature representation of the text sequence obtained by concatenating the second question sample and the second text resource sample in the sample pair. This feature representation is used to predict the ranking score for the corresponding second text resource sample. The training objective includes maximizing the difference between the ranking score of the second text resource sample in the positive sample pair corresponding to the same second question sample and the ranking score of the second text resource sample in the corresponding negative sample pair. In the disclosed embodiments, a loss function can be constructed based on the aforementioned training objectives. The loss function value is used in each iteration to update the parameters of the ranking model using methods such as gradient descent until preset training termination conditions are met. These termination conditions may include, for example, the loss function value being less than or equal to a preset loss function threshold, the number of iterations reaching a preset threshold, and so on. It should be noted that the training data used to train the retrieval model and the ranking model can be the same dataset or different datasets. After the ranking scores of the K text resources are obtained using the ranking model, the top N text resources can be selected as reference resources for answer generation. In addition to the ranking model implementation methods provided in the aforementioned embodiments, other types of ranking models can also be used to select N text resources from the K text resources with a higher degree of match with the question text. The aforementioned 206, "inputting the question text and N text resources into the answer generation model to obtain the answer text corresponding to the question text generated by the answer generation model using the N text resources," will be described in detail below in conjunction with the embodiments. As one possible implementation, the structure of the answer generation model provided by the embodiments of the present disclosure may be as shown in FIG5 , comprising an encoding module and a decoding module. The encoding module is configured to concatenate the question text and N text resources and perform an attention-based encoding process on the resulting text sequence to obtain feature representations for each token in the text sequence.Before encoding the input text (i.e., question text or text resources), the encoding module can first perform embedding on the input text. This encoding module can be trained based on a pretrained language model, using models such as the T5 (Transfer Text-to-Text Transformer), BERT (Bidirectional Encoder Representation from Transformers), XLNet (an autoregressive model that implements bidirectional contextual information through a permutation language model), and GPT (Generative Pre-Training) as the initial encoding module for further training. The decoding module uses the feature representations of each token in the text sequence to perform decoding, obtaining the answer text corresponding to the question text. For example, a user inputs the question "What animal is the BBB Cup held at YYY Stadium?" Retrieval and sorting yields two text resources: "The name of the competition in the first line is the AAA Cup, and the venue is XXX Church. The name of the competition in the second line is the BBB Cup, and the venue is YYY Stadium" and "A group of people on horseback; a brown racehorse; a large white stadium; a jockey." The input question and these two text resources are concatenated and input into the answer generation model to generate the answer text "The BBB Cup held at YYY Stadium is a horse competition." When pre-training the answer generation model, third training data can be used. This third training data includes multiple training samples, each of which includes a third question sample, N text resources, and answer samples. The N text resources are derived from the resource source. The training samples can be manually annotated or obtained by other methods, such as obtaining user questions and answers with high user feedback from historical question-and-answer logs as third question samples and answer samples, respectively. The N text resources can be obtained by inputting question texts into the trained retrieval model and ranking model. The answer generation model is trained using the third training data, wherein the third question sample and N text resources are input into the answer generation model, and the answer sample is used as the target output of the answer generation model, that is, the difference between the answer text generated by the answer generation model for the third question sample and the answer sample corresponding to the third question sample is minimized.In the embodiments of the present disclosure, a loss function can be constructed based on the aforementioned training objectives. In each iteration, the loss function value is used to update the parameters of the answer generation model using methods such as gradient descent until preset training termination conditions are met. These termination conditions may include, for example, the loss function value being less than or equal to a preset loss function threshold, the number of iterations reaching a preset threshold, and so on. In addition to the aforementioned implementation methods of the answer generation model, the answer generation model may also employ other methods to generate answer text, such as combining the question text with the content of N text resources using preset wording. The methods provided in the embodiments of the present disclosure can be applied to a variety of application scenarios. Here, a brief description of the methods is given using an intelligent question-and-answer system as an example. Intelligent question-and-answer systems are now being embedded in an increasing number of applications, such as e-commerce platforms using online customer service and smart speakers equipped with intelligent question-and-answer functionality. Users can enter questions into the intelligent question-and-answer system. For example, the intelligent question-and-answer system provides a page or client, and the user enters questions through a component such as an input box on the page or client, or by voice. An intelligent question-answering system located on a server (which can be a cloud server) uses user input to generate question text. For example, questions entered by users through an input box or other components can be used as question text. Another example is voice recognition of questions entered by users via speech to generate question text. Intelligent question-answering systems can be targeted at specific fields, such as medicine, education, or insurance, or they can be general-purpose intelligent question-answering systems. For example, an intelligent question-answering system targeting a specific field can employ the methods described in the embodiments of this disclosure to pre-convert all multimodal resources in that specific field into text resources to construct a resource library corresponding to that specific field. For example, in the medical field, text resources such as medical papers, pathology reports, medical treatment orders, and device instruction manuals can be acquired and added to the resource library. However, medical papers, pathology reports, and medical records may also contain images (such as medical imaging) or tables. Therefore, a description generation model can be used to obtain text descriptions from the images. The target information (such as organ name, type, lesion name, type, etc.) detected from the images using the object detection model is combined with the text descriptions and the resulting text resource to be used as the text resource for the image conversion and added to the resource library. A table parser is used to parse the table into one-dimensional text content, which is then added to the resource library as the text resource for the table conversion. As shown in Figure 6, the intelligent question-answering system uses a retrieval model to search the resource library corresponding to a specific domain, obtaining K document resources, for example, 10 document resources.The ranking model is then used to rank the 10 document resources to obtain a ranking score. Based on the ranking score, N document resources are obtained, for example, the two document resources with the highest ranking scores are selected. The intelligent question-answering system then inputs the question text and the two document resources into the answer generation model, which generates a textual answer. This textual answer can be returned to the user in text form, or it can be returned to the user via speech synthesis. As can be seen, the methods described in the embodiments of this disclosure enable cross-modal reasoning, thereby improving the accuracy of answers. Users can quickly, conveniently, and accurately obtain the desired answers in the intelligent question-answering system, significantly improving efficiency and user experience. The above description of specific embodiments of this specification describes other embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the figures do not necessarily require the specific or sequential order shown to achieve the desired results. In certain embodiments, multi-tasking and parallel processing are also possible or may be advantageous. According to another embodiment, a question processing device is provided. Figure 7 shows a schematic block diagram of a question processing apparatus according to one embodiment. As shown in Figure 7, apparatus 700 includes a question acquisition unit 701, a resource matching unit 702, and an answer generation unit 703. It may further include a resource library construction unit 704, a first training unit 705, a second training unit 706, and a third training unit 707. The primary functions of each component are as follows: Question acquisition unit 701 is configured to acquire question text. Resource matching unit 702 is configured to match the question text against resources to obtain N text resources that match the question text, where N is a preset positive integer and the resources include text resources and text resources converted from other modal resources. Answer generation unit 703 is configured to input the question text and N text resources into an answer generation model and obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources. The resource library construction unit 704 is configured to pre-construct a resource library by using the following processing: obtaining resources of multiple modalities from a multimodal database; storing text resources contained in the resources of multiple modalities in a resource database; converting modal resources other than text resources contained in the resources of multiple modalities into text resources, and storing the converted text resources in a resource database.As one possible implementation, when converting modal resources other than text resources included in multiple modal resources into text resources, the resource library construction unit 704 may: For image resources, utilize a description generation model to obtain a text description of the image resource, and use the text description as the text resource converted from the image resource; and / or, utilize an object detection model to obtain object information in the image resource, and use the text corresponding to the object information as the text resource converted from the image resource; and / or, utilize a description generation model to obtain a text description of the image resource, utilize an object detection model to obtain object information in the image resource, and concatenate the text description and the text corresponding to the object information to obtain the text resource converted from the image resource; and / or, utilize a table resource, utilize a table parser to parse the table resource into one-dimensional text content, and use the one-dimensional text content as the text resource converted from the table resource. As one possible implementation, the resource matching unit 702 may specifically include a retrieval subunit 7021 and a sorting subunit 7022. The retrieval subunit 7021 can be configured to: use the retrieval model to search the resource source and identify K text resources whose corresponding feature representations meet a preset relevance requirement. The ranking subunit 7022 can be configured to: use the ranking model to rank the K text resources and select N text resources based on the ranking results, where K is a positive integer greater than N. As one possible implementation, the ranking subunit 7022 can be specifically configured to: concatenate the K text resources with the question text to obtain K text sequences; use the ranking model to obtain feature representations for each of the K text sequences, and use the feature representations of the K text sequences to predict ranking scores for each of the K text resources; and select the top N text resources based on the ranking scores. As one possible implementation, the first training unit 705 is configured to: obtain first training data including multiple positive sample pairs and negative sample pairs, each sample pair including a first problem sample and a first text resource sample, where the first text resource sample is from a resource library; and train a retrieval model using the first training data, wherein the retrieval model obtains a feature representation of the first problem sample and a feature representation of the first text resource sample, and determines a correlation between the feature representation of the first problem sample and the feature representation of the first text resource sample. The training objectives include maximizing the similarity between the feature representation of the first problem sample and the feature representation of the first text resource sample in the positive sample pair, and minimizing the similarity between the feature representation of the first problem sample and the feature representation of the first text resource sample in the negative sample pair.In one possible implementation, the second training unit 706 is configured to: obtain second training data comprising multiple positive and negative sample pairs, each sample pair comprising a second question sample and a second text resource sample, the second text resource sample being sourced from a resource library; and train a ranking model using the second training data. The ranking model obtains a feature representation of a text sequence obtained by concatenating the second question sample and the second text resource sample in the sample pair, and uses this feature representation to predict a ranking score for the corresponding second text resource sample. The training objective includes maximizing the difference between the ranking score of the second text resource sample in the positive sample pair corresponding to the same second question sample and the ranking score of the second text resource sample in the corresponding negative sample pair. In one possible implementation, the answer generation model may include an encoding module and a decoding module. The encoding module concatenates the question text and N text resources and performs an attention-based encoding process on the resulting text sequence to obtain a feature representation of each token in the text sequence. The decoding module uses the feature representation of each token in the text sequence to perform decoding to obtain the answer text corresponding to the question text. As one possible implementation, the third training unit 707 can be configured to: obtain third training data comprising multiple training samples, the training samples comprising a third question sample, N text resources in the resource source that match the third question sample, and an answer sample corresponding to the third question sample; and train an answer generation model using the third training data, wherein the third question sample and the N text resources that match the third question sample are input into the answer generation model, and the answer generation model generates an answer text for the third question sample. The training objective is to minimize the difference between the answer text generated by the answer generation model for the third question sample and the answer sample corresponding to the third question sample. The various embodiments in this specification are described in a progressive manner. References to the common and similar parts between the various embodiments are sufficient. Each embodiment focuses on the differences from other embodiments. In particular, since the apparatus embodiment is substantially similar to the method embodiment, its description is relatively simple. For relevant details, references to the description of the method embodiment are sufficient. The device embodiments described above are illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the solutions in this embodiment. Persons of ordinary skill in the art can understand and implement the present invention without inventive effort.It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, storage, and display) referred to in this disclosure are all information and data authorized by the user or fully authorized by all parties. The collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or deny. In addition, embodiments of the present disclosure further provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the aforementioned method embodiments. Also provided is an electronic device comprising: one or more processors; and a memory associated with the one or more processors, the memory storing program instructions that, when read and executed by the one or more processors, implement the steps of any of the aforementioned method embodiments. This disclosure further provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of any of the aforementioned method embodiments. FIG8 exemplarily illustrates the architecture of an electronic device, which may include a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, and a memory 820. The processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820 may be communicatively connected via a communication bus 830. The processor 810 may be implemented using a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and may be configured to execute related programs to implement the technical solutions provided herein. The memory 820 may be implemented using ROM (Read Only Memory), RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 820 may store an operating system 821 configured to control the operation of the electronic device 800 and a basic input / output system (BIOS) 822 configured to control low-level operations of the electronic device 800. Furthermore, the memory 820 may store a web browser 823, a data storage management system 824, and a question-and-answer processing device 825, etc.The aforementioned question-and-answer processing device 825 can be an application program that specifically implements the aforementioned steps in the embodiments of the present disclosure. In short, when implementing the technical solutions provided by the present disclosure through software or firmware, the relevant program code is stored in the memory 820 and is called and executed by the processor 810. The input / output interface 813 is configured to connect to an input / output module to implement information input and output. The input / output module can be configured as a component within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., while output devices may include a display, speaker, vibrator, indicator light, etc. The network interface 814 is configured to connect to a communication module (not shown in the figure) to enable communication between the device and other devices. The communication module can achieve communication via wired means (e.g., USB, network cable, etc.) or wireless means (e.g., mobile network, Wi-Fi, Bluetooth, etc.). The bus 830 comprises a pathway for transmitting information between the various components of the device (e.g., the processor 810, the video display adapter 811, the disk drive 812, the input / output interface 813, the network interface 814, and the memory 820). It should be noted that, although the above device illustrates the processor 810, the video display adapter 811, the disk drive 812, the input / output interface 813, the network interface 814, the memory 820, the bus 830, and the like, in a specific implementation, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will appreciate that the above device may include the components necessary to implement the disclosed solution, rather than all of the components shown in the figures. As can be seen from the above description of the embodiments, those skilled in the art will clearly understand that the present disclosure can be implemented using software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solution of the present disclosure, or the portion that contributes to the prior art, can be embodied in the form of a computer program product. The computer program product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain portions of the embodiments of the present disclosure.The technical solutions provided by the present disclosure have been described in detail above. Specific examples have been used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above examples is intended only to facilitate understanding of the methods and core concepts of the present disclosure. Furthermore, those skilled in the art will appreciate that the specific implementation methods and scope of application may vary based on the principles of the present disclosure. In summary, the contents of this specification should not be construed as limiting the present disclosure. Industrial Applicability: The question-answering processing method and apparatus provided in the embodiments of the present disclosure are applied to intelligent question-answering scenarios. By converting multimodal resources into text resources, matching the text resources with the question text, and then generating answers using the matched text resources and the question text, this approach enables cross-modal reasoning, thereby improving answer accuracy. It also eliminates the need to train separate answer generation models for different modalities, reducing the pressure on storage and computing performance.

Claims

Claims 1. A question-answering processing method, the method comprising: Get the question text; Match the question text in the resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resource library includes historical resources and text resources converted from other modal resources; input the question text and the N text resources into the answer generation model to obtain the answer text corresponding to the question text generated by the answer generation model using the N text resources.

2. The method according to claim 1, wherein: The method also includes pre-building the resource library by the following processing: obtaining resources of multiple modalities from a multimodal database; storing text resources contained in the resources of multiple modalities into the resource library; converting other modal resources except text resources contained in the resources of multiple modalities into text resources, and storing the converted text resources into the resource library.

3. The method according to claim 2, wherein: Converting other modal resources except text resources included in the multiple modal resources into text resources includes: for image resources, using a description generation model to obtain a text description of the image resource, and using the text description as a text resource converted from the image resource; and / or, for image resources, using a target detection model to obtain target information in the image resource, and using a text corresponding to the target information as a text resource converted from the image resource; and / or, for image resources, using a description generation model to obtain a text description of the image resource, using a target detection model to obtain target information in the image resource, splicing the text description and the text corresponding to the target information to obtain a text resource converted from the image resource; and / or, for table resources, using a table parser to parse the table resource into one-dimensional text content, and using the one-dimensional text content as a text resource converted from the table resource.

4. The method according to claim 1, wherein: Matching the question text in a resource library to obtain N text resources matching the question text includes: using a retrieval model to search in the resource library to determine K text resources whose correlations between corresponding feature representations and feature representations of the question text meet preset correlation requirements; using a sorting model to sort the K text resources, and selecting N text resources based on the sorting result, where K is a positive integer greater than N.

5. The method according to claim 4, wherein: The step of using the sorting model to sort the K text resources and selecting N text resources according to the sorting results includes: respectively concatenating the K text resources with the question text to obtain K text sequences; respectively obtaining feature representations of the K text sequences using the sorting model, and respectively predicting the sorting scores of the K text resources using the feature representations of the K text sequences; and selecting the top N text resources according to the sorting scores.

6. The method according to claim 4, wherein: The retrieval model is pre-trained in the following manner: obtaining first training data including a plurality of positive sample pairs and negative sample pairs, each sample pair including a first problem sample and a first text resource sample, and the first text resource sample originating from the resource library; using the first training data to train the retrieval model, wherein the retrieval model obtains a feature representation of the first problem sample and a feature representation of the first text resource sample, and determines a correlation between the feature representation of the first problem sample and the feature representation of the first text resource sample, and the objectives of the training include maximizing the similarity between the feature representation of the first problem sample in the positive sample pair and the feature representation of the first text resource sample, and minimizing the similarity between the feature representation of the first problem sample and the feature representation of the first text resource sample in the negative sample pair.

7. The method according to claim 4 or 5, wherein: The ranking model is pre-trained in the following manner: obtaining second training data including a plurality of positive sample pairs and negative sample pairs, each sample pair including a second problem sample and a second text resource sample, and the second text resource sample originating from the resource library; using the second training data to train the ranking model, wherein the ranking model obtains a feature representation of a text sequence obtained by concatenating the second problem sample and the second text resource sample in the sample pair, and uses the feature representation to predict a ranking score corresponding to the second text resource sample, and the training objectives include: maximizing the difference between the ranking score of the second text resource sample in the positive sample pair corresponding to the same second problem sample and the ranking score of the second text resource sample in the corresponding negative sample pair.

8. The method according to claim 1, wherein: The answer generation model includes an encoding module and a decoding module; the encoding module concatenates the question text and the N text resources, and performs an encoding process based on the attention mechanism on the concatenated text sequence to obtain a feature representation of each element Token in the text sequence; the decoding module uses the feature representation of each Token in the text sequence to perform decoding processing to obtain an answer text corresponding to the question text.

9. The method according to claim 1 or 8, wherein: The answer generation model is obtained by pre-training as follows: obtaining third training data including multiple training samples, the training samples including a third question sample, N text resources in the resource library matching the third question sample, and an answer sample corresponding to the third question sample; using the third training data to train the answer generation model, wherein the third question sample and the N text resources matching the third question sample are input into the answer generation model, and the answer generation model generates an answer text for the third question sample, and the goal of the training is to minimize the difference between the answer text generated by the answer generation model for the third question sample and the answer sample corresponding to the third question sample.

10. A question-answering processing method, applied to an intelligent question-answering system, the method comprising: Obtaining a question text corresponding to a question input by a user into the intelligent question-answering system; Matching the question text in a resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resource library includes text resources and text resources converted from other modal resources; Inputting the question text and the N text resources into an answer generation model to obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources; An answer is returned to the user using the answer text.

11. A question-answer processing method, executed by a cloud server, comprising: Obtaining a question text from a user device, or obtaining a question text corresponding to a question voice from a user device; Matching the acquired question text in a resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resource library includes text resources and text resources converted from other modal resources; Inputting the question text and the N text resources into an answer generation model to obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources; The answer text is returned to the user device, or an answer voice generated using the answer text is returned to the user device.

12. A question-answer processing device, the device comprising: A question acquisition unit, configured to acquire a question text; A resource matching unit is configured to match the question text in a resource library to obtain N text resources matching the question text, where N is a preset positive integer, and the resource library includes text resources and text resources converted from other modal resources; The answer generation unit is configured to input the question text and the N text resources into an answer generation model, and obtain an answer text corresponding to the question text generated by the answer generation model using the N text resources.

13. A computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.

14. An electronic device, comprising: one or more processors; And a memory associated with the one or more processors, the memory being configured to store program instructions, which, when read and executed by the one or more processors, execute the steps of the method according to any one of claims 1 to 11. 16

Citation Information

Patent Citations

  • Target answer acquisition method and related device, electronic equipment and storage medium

    CN115794995A

  • Artificial intelligence system for supporting communication

    US20190122093A1

  • AU2022204188A1

Cited By

  • Staggered image-text generation method and device, electronic equipment and storage medium

    CN119625139A

  • Training method of recommendation question generation model and recommendation question generation method and device

    CN119719284A

  • Extraction type retrieval question and answer method and device, equipment and medium

    CN120030128A

  • An extractive search question and answer method, device, equipment and medium

    CN120030128B

  • Large model-based scene retrieval method and terminal

    CN120508614A