Live broadcast question and answer method and device, electronic equipment and storage medium
By vectorizing user question information and matching it in multiple historical question-and-answer vector groups, and combining language models to generate answers, the challenge of efficiently answering user questions in live broadcasts is solved, and the accuracy and diversity of answers are improved.
Patent Information
- Application Number
- CN202411661196.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-11
AI Technical Summary
In live broadcasts online, as the number of users increases, how to answer questions raised by users efficiently and accurately becomes a major challenge.
By obtaining the question information input by the user, vectorization is performed to obtain the question vector, and the target history question and answer vector group is determined in multiple historical question and answer vector groups based on the vector, and the language model is used to process the question information and the target history question and answer information to generate answer information.
It improves the accuracy and diversity of answers during the live broadcast, ensuring novelty and user satisfaction of the answers.
Smart Images

Figure CN119815126A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a live question-and-answer method, device, electronic device, and storage medium. Background Art
[0002] In online live broadcasts, the intelligent question-and-answer system based on artificial intelligence can replace the anchor to intelligently answer the user's questions. During the live broadcast, the intelligent question-and-answer system can answer the user's questions, and combined with the anchor's digital human, a true live broadcast without real people can be achieved, thus avoiding the negative problems such as fatigue and stress caused by long-term live broadcasts. However, with the increase in the number of users in the live broadcast room, how to efficiently and accurately answer the questions raised by users has become a major challenge. Summary of the invention
[0003] In order to solve the above problems, the embodiment of the present application provides a live Q&A method, which can improve the accuracy and diversity of the answers output in response to the user's questions during the live broadcast. Specifically, the embodiment of the present application discloses the following technical solutions: A first aspect of an embodiment of the present application provides a live question-and-answer method, the method comprising: obtaining question information input by a user, and vectorizing the question information to obtain a question vector corresponding to the question information; based on the question vector, determining a target historical question-and-answer vector group corresponding to the question vector from multiple historical question-and-answer vector groups, and determining a target historical question-and-answer information group corresponding to the target historical question-and-answer vector group; processing the question information and the target historical question-and-answer information group based on a language model, and generating and outputting answer information corresponding to the question information.
[0004] In some embodiments, the method further includes: obtaining the above-mentioned multiple historical question and answer information groups; performing vectorization processing on the above-mentioned multiple historical question and answer information groups to obtain the above-mentioned multiple historical question and answer vector groups corresponding to the above-mentioned multiple historical question and answer information groups.
[0005] In some embodiments, based on the question vector, determining a target historical question and answer vector group corresponding to the question vector in multiple historical question and answer vector groups includes: semantically matching the question vector with each historical question vector, and determining a first degree of match between each historical question vector and the question vector; wherein each historical question and answer vector group in the multiple historical question and answer vector groups includes a historical question vector and a historical answer vector; determining a historical question vector with the highest first degree of match between the multiple historical question vectors and the question vector as a target historical question vector; and determining the target historical question and answer vector group in the multiple historical question and answer vector groups according to the target historical question vector; wherein the target historical question and answer vector group includes a target historical question vector and a target historical answer vector.
[0006] In some embodiments, the above-mentioned vectorization processing of the above-mentioned question information to obtain the question vector corresponding to the above-mentioned question information includes: processing the above-mentioned question information based on a question model to obtain the above-mentioned question vector and at least one keyword vector corresponding to the above-mentioned question information; the above-mentioned determining the target historical question and answer vector group corresponding to the above-mentioned question vector from multiple historical question and answer vector groups based on the above-mentioned question vector includes: determining the above-mentioned target historical question and answer vector group from the above-mentioned multiple historical question and answer vector groups based on the above-mentioned question vector and the above-mentioned at least one keyword vector.
[0007] In some embodiments, the question information is processed based on the question model to obtain the question vector and at least one keyword vector corresponding to the question information, including: encoding the question information based on the encoding module in the question model to obtain the encoding vector corresponding to the question information; decoding the encoding vector based on the decoding module in the question model to obtain the question vector corresponding to the question information; decoding the question vector based on the decoding module to obtain the at least one keyword vector.
[0008] In some embodiments, the above-mentioned determination of the above-mentioned target historical question and answer vector group in the above-mentioned multiple historical question and answer vector groups based on the above-mentioned question vector and the above-mentioned at least one keyword vector includes: semantically matching the above-mentioned question vector with each historical question vector, and determining a first matching degree between each historical question vector and the above-mentioned question vector; wherein each historical question and answer vector group in the above-mentioned multiple historical question and answer vector groups includes a historical question vector and a historical answer vector; semantically matching the above-mentioned at least one keyword vector with the above-mentioned each historical question vector, and determining a second matching degree between each historical question vector and the above-mentioned at least one keyword vector; determining a target matching degree corresponding to each historical question vector according to the above-mentioned first matching degree and the above-mentioned second matching degree; determining the historical question vector with the highest corresponding target matching degree among the multiple historical question vectors as the target historical question vector; and determining the above-mentioned target historical question and answer vector group according to the above-mentioned target historical question vector in the above-mentioned multiple historical question and answer vector groups.
[0009] In some embodiments, the target matching degree corresponding to each of the historical question vectors is determined based on the first matching degree and the second matching degree, including: determining the third matching degree between each of the historical question vectors and the question vector based on the first matching degree and the first weight; determining the fourth matching degree between each of the historical question vectors and the at least one keyword vector based on the second matching degree and the second weight; and determining the target matching degree corresponding to each of the historical question vectors based on the third matching degree and the fourth matching degree.
[0010] In some embodiments, the method further includes: processing the sample text based on the encoding module in the question model to be trained to obtain the encoding vector corresponding to the sample text; processing the encoding vector based on the decoding module in the question model to be trained to obtain the word meaning information and word position information corresponding to the sample text; processing the word meaning information and the word position information based on the decoding module to obtain the weights corresponding to each word in the sample text, and obtaining the sample sentence vector based on the weights corresponding to each word; decoding the sample sentence vector based on the decoding module to obtain the at least one sample keyword vector; optimizing the question model to be trained based on the sample sentence vector, the at least one sample keyword vector and the optimization parameters to obtain the question model.
[0011] In some embodiments, the encoding module based on the question model to be trained processes the sample text to obtain the encoding vector corresponding to the sample text, including: masking the sample text based on the encoding module to obtain the first masked text corresponding to the sample text; encoding the first masked text based on the encoding module to obtain the encoding vector.
[0012] In some embodiments, the decoding module based on the question model to be trained processes the encoding vector to obtain word meaning information and word position information corresponding to the sample text, including: decoding the encoding vector based on the decoding module to obtain the word meaning information; masking the sample text based on the decoding module to obtain a second masked text corresponding to the sample text; decoding the second masked text based on the decoding module to obtain a text vector, and processing the encoding vector, the word position vector corresponding to the sample text and the text vector to obtain the word position information.
[0013] In some embodiments, the above-mentioned question information and the above-mentioned target historical question and answer information group are processed based on the language model to generate and output answer information for the above-mentioned question information, including: inputting the above-mentioned question information and the above-mentioned target historical question and answer information group into a prompt template to obtain prompt information; wherein the above-mentioned target historical question and answer information group includes target historical question information and target historical answer information; processing the above-mentioned prompt information based on the above-mentioned language model to generate and output answer information for the above-mentioned question information.
[0014] According to a second aspect of an embodiment of the present application, there is provided a live question-and-answer device, comprising: a processing module, configured to obtain question information input by a user, and to perform vectorization processing on the question information to obtain a question vector corresponding to the question information; a determination module, configured to determine, based on the question vector, a target historical question-and-answer vector group corresponding to the question vector in multiple historical question-and-answer vector groups, and to determine a target historical question-and-answer information group corresponding to the target historical question-and-answer vector group; and a generation module, configured to process the question information and the target historical question-and-answer information group based on a language model, and to generate and output answer information corresponding to the question information.
[0015] A third aspect of an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the memory being used to store computer executable instructions; the processor being used to read the instructions from the memory and execute the instructions to implement the live question-and-answer method described in the first aspect above.
[0016] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer program instructions. When a computer reads the instructions, the live question-and-answer method described in the first aspect is executed.
[0017] A fifth aspect of an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the live question-and-answer method described in the first aspect above.
[0018] It should be noted that the above computer instructions may be stored in whole or in part on a first computer-readable storage medium, wherein the first computer-readable storage medium may be packaged together with the processor of the data processing device, or may be packaged separately from the processor of the data processing device, which is not limited in the present disclosure.
[0019] The live question-and-answer method provided in the embodiment of the present application can obtain the question information input by the user, and vectorize the question information to obtain the question vector corresponding to the question information. Then, based on the question vector, the target historical question-and-answer vector group corresponding to the question vector is determined in multiple historical question-and-answer vector groups, and the target historical question-and-answer information group corresponding to the target historical question-and-answer vector group is determined. Finally, the question information and the target historical question-and-answer information group are processed based on the language model, and the answer information to the question information is generated and output. Applying the technical solution provided in the embodiment of the present application can improve the diversity, accuracy and novelty of the generated answer information. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A schematic diagram of an implementation environment provided for some embodiments of the present application; Figure 2 A flowchart of a live question-and-answer method provided in some embodiments of the present application; Figure 3 A flowchart of another live question-and-answer method provided for some embodiments of the present application; Figure 4 A schematic diagram of training a question model provided in some embodiments of the present application; Figure 5 A flowchart for training a question model provided in some embodiments of the present application; Figure 6 A flowchart of another live question-and-answer method provided for some embodiments of the present application; Figure 7 A schematic diagram of a live question-and-answer device provided in some embodiments of the present application; Figure 8 A schematic diagram of an electronic device according to some embodiments of the present application. DETAILED DESCRIPTION
[0022] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0023] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0024] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0025] In the related art, most intelligent question-and-answer systems rely on pre-acquired question-and-answer samples between anchors and users to form a question-and-answer library. When a user asks a question, the intelligent question-and-answer system will match the user's question in the question-and-answer library. If a similar question is matched, the corresponding answer will be obtained and output in the question-and-answer library. Otherwise, the user's question will not be answered. Therefore, the intelligent question-and-answer system in the related art relies on the content in the question-and-answer library, which makes it impossible to ensure that the corresponding answer can be output to the user's question, and the content of the answer is single, lacking diversity and novelty.
[0026] Based on the above-mentioned problems existing in the related technology, the present application provides a live question-and-answer method, device, electronic device and storage medium, which can improve the accuracy, diversity and novelty of answer information generated for user question information.
[0027] A live Q&A method provided in an embodiment of the present application is described below. A person skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0028] Figure 1 An implementation environment is provided for some embodiments of the present application. Figure 1 As shown, the implementation environment may include a live broadcast system 01, a live broadcast platform 02 and a user terminal 03. The live broadcast system 01 and the live broadcast platform 02 may communicate with each other via a wired or wireless communication method, and the live broadcast platform 02 and the user terminal 03 may also communicate with each other via a wired or wireless communication method.
[0029] In some embodiments, the live broadcast system 01 is mainly used to generate a live video stream and push the live video stream to the live broadcast platform 02 for live broadcast. Among them, the live broadcast platform 02 can be one or more, and the embodiment of the present application does not limit this.
[0030] After receiving the live video stream from the live broadcast system 01, the live broadcast platform 02 pushes the live data stream to the user terminal 03 according to specific rules, so that the user terminal 03 plays the live data corresponding to the live video stream for the user to watch. There may be one or more user terminals 03, and the user terminal 03 may be an electronic device installed with the live broadcast application corresponding to the live broadcast platform 02.
[0031] In some embodiments, when a user watches a live video through the live broadcast platform 02 in the user terminal 03, he can send question information according to the live broadcast content. The live broadcast system 01 can obtain the question information input by the user through the live broadcast platform 02, and after obtaining the question information, the question information can be vectorized to obtain the question vector corresponding to the question information. And, based on the question vector, the target historical question and answer vector group corresponding to the question vector is determined in multiple historical question and answer vector groups, and the target historical question and answer information group corresponding to the target historical question and answer vector group is determined. Afterwards, the question information and the target historical question and answer information group are processed based on the language model to generate answer information for the question information. Then, the live broadcast system 01 can send the generated answer information to the user terminal 03 through the live broadcast platform 02, thereby realizing the question and answer interaction with the user during the live broadcast process.
[0032] Figure 2 A flowchart of a live question-and-answer method provided in some embodiments of the present application, which can be applied to Figure 1 The live broadcast system 01 shown. Figure 2 As shown, the method may include steps 210 to 240.
[0033] Step 210: obtain the question information input by the user, and perform vectorization processing on the question information to obtain a question vector corresponding to the question information.
[0034] In some embodiments, during the live broadcast of the anchor in the live broadcast room, the user can input question information to ask questions to the anchor, and the live broadcast system 01 can generate answer information for the question information input by the user. The live broadcast system 01 can pre-acquire multiple historical question and answer data groups between the user and the anchor, wherein each group of historical question and answer data includes historical question data and corresponding historical answer data; and perform data processing on each historical question and answer data group to obtain a corresponding historical question and answer information group in text form, wherein each group of historical question and answer information includes historical question information and corresponding historical answer information.
[0035] Exemplarily, the multiple historical question and answer information groups obtained may refer to those shown in Table 1.
[0036] Table 1
[0037] Next, the above-mentioned multiple historical question and answer information groups can be vectorized to obtain multiple historical question and answer vector groups corresponding to the multiple historical question and answer information groups. Among them, each historical question and answer vector group includes a historical question vector and a historical answer vector. When vectorizing each historical question and answer information group, it can be implemented based on vectorization methods such as text vector representation tools (Text2Vec), word embeddings, and sentence embeddings.
[0038] Exemplarily, refer to the multiple historical question information shown in Table 2 and the historical question vectors corresponding to each historical question information. For example, the historical question information is "How to apply a facial mask for better moisturizing effect?", then the historical question information can be vectorized based on Text2Vec, and the sentence vector (i.e., historical question vector) corresponding to the historical question information can be obtained. It should be noted that the principle of vectorizing the historical answer information to obtain the historical answer vector is the same, and will not be repeated here. Based on multiple historical question vectors and historical answer vectors, multiple historical question and answer vector groups can be obtained. It should be noted that the numerical values corresponding to the historical question vectors shown in Table 2 are only examples.
[0039] Table 2
[0040] In some embodiments, after obtaining the above-mentioned multiple historical question and answer vector groups, the multiple historical question and answer vector groups can be added to the historical question and answer vector library. Among them, the historical question and answer vector library supports dynamic addition, deletion and query of historical question and answer vectors. For example, vector retrieval tools such as Faiss can be used to add indexes to multiple historical question and answer vector groups, and store them in the historical question and answer vector library for subsequent semantic matching. Among them, Faiss can achieve data compression through methods such as principal component analysis (PCA) and product quantization, thereby reducing space occupancy and speeding up retrieval.
[0041] In some embodiments, the live broadcast system 01 can obtain the question information currently input by the user in the live broadcast room, wherein the question information input by the user can be text information or voice information. The form of the question information is not limited in the embodiments of the present application.
[0042] In some embodiments, after obtaining the question information, the live broadcast system 01 can vectorize the question information to convert it into a dense vector (i.e., a question vector). The vectorization of the question information can also be implemented based on a question model (such as Text2Vec), sentence embedding, and other vectorization methods. It should be noted that when the question information input by the user is voice information, the voice information can be firstly processed by voice recognition to obtain the text information corresponding to the voice information, and the text information can be vectorized to obtain the question vector.
[0043] Exemplarily, refer to the multiple question information and the question vectors corresponding to each question information shown in Table 3. For example, if the question information input by the user is "How does the mask improve the moisturizing effect?", then after vectorizing the question information based on the question model, the sentence vector (i.e., question vector) corresponding to the question information can be obtained. It should be noted that the values corresponding to the question vectors shown in Table 3 are only examples.
[0044] Table 3
[0045] Step 220, based on the question vector, determine a target historical question and answer vector group corresponding to the question vector from multiple historical question and answer vector groups, and determine a target historical question and answer information group corresponding to the target historical question and answer vector group.
[0046] In some embodiments, after determining the question vector, the live broadcast system 01 can perform semantic matching on the question vector with historical question vectors in multiple historical question and answer vector groups in the above-mentioned historical question and answer vector library, thereby determining a target historical question vector that matches the question vector among multiple historical question vectors, and determining the corresponding target historical question and answer vector group and the target historical question and answer information group corresponding to the target historical question and answer vector group based on the target historical question vector.
[0047] Among them, each historical question and answer vector group in the multiple historical question and answer vector groups includes a historical question vector and a historical answer vector; the target historical question and answer vector group includes a target historical question vector and a target historical answer vector; the target historical question and answer information group includes target historical question information and target historical answer information.
[0048] Figure 3 A flowchart of another live question-and-answer method provided in some embodiments of the present application, such as Figure 3 As shown, the above step 220 may include steps 310 to 330.
[0049] Step 310: semantically match the question vector with each historical question vector to determine a first matching degree between each historical question vector and the question vector.
[0050] In some embodiments, the live broadcast system 01 may semantically match the question vector with each historical question vector in the historical question and answer vector library, and determine the similarity between each historical question vector and the question vector (i.e., the first matching degree). Exemplarily, Faiss may be used to semantically match the question vector with each historical question vector in the historical question and answer vector library, and determine the first matching degree; alternatively, a bag of words model (BoW), term frequency and inverse document frequency (TF-IDF), dot product, cosine similarity, etc. may be used to perform semantic matching and determine the first matching degree. The specific method for semantic matching and determining the first matching degree is not limited in the embodiments of the present application.
[0051] For example, taking the question vector corresponding to the question information "How does a facial mask improve moisturizing effect?" in Table 3 as an example, the first matching degree between the question vector and each historical question vector corresponding to each historical question information in Table 2 can be shown in Table 4. It should be noted that the values of the first matching degrees shown in Table 4 are only examples.
[0052] Table 4
[0053] Step 320: Determine the historical question vector with the highest first matching degree with the question vector among the multiple historical question vectors as the target historical question vector.
[0054] As shown in Table 4, it can be seen that the historical question vector with the highest first match with the question vector among the historical question vectors is the historical question vector corresponding to the historical question information "How to apply a facial mask for better moisturizing effect?" Therefore, this historical question vector can be determined as the target historical question vector.
[0055] Step 330 , determining a target historical question and answer vector group among multiple historical question and answer vector groups according to the target historical question vector.
[0056] In some embodiments, after determining the target historical question vector, the target historical answer vector corresponding to the target historical question vector can be determined in the historical question and answer vector library; and based on the target historical question vector and the target historical answer vector (i.e., the target historical question and answer vector group), the target historical question information and the target historical answer information (i.e., the target historical question and answer information group) can be determined.
[0057] For example, taking the historical question vector corresponding to the historical question information "How to apply a facial mask for better moisturizing effect?" as an example, the live broadcast system 01 can determine the target historical answer vector corresponding to the target historical question vector in the historical question and answer vector library; and based on the target historical question vector and the target historical answer vector, determine that the target historical question information is "How to apply a facial mask for better moisturizing effect?", and determine that the target historical answer information is "Before applying a facial mask, you can first apply a thick layer of oil-containing moisturizing essence, so that the nutrients can be pressed into the skin with the help of the mask's closed nature."
[0058] In some embodiments, since the keywords in the question information will also affect the accuracy of semantic matching, after determining the question vector, the keyword vector can be extracted from the question vector based on the question model to obtain at least one keyword vector corresponding to the question information; and based on the question vector and at least one keyword vector, the target historical question and answer vector group is determined from multiple historical question and answer vector groups.
[0059] In some embodiments, the above-mentioned vectorization processing of the question information to obtain the question vector corresponding to the question information includes: processing the question information based on the question model to obtain the question vector corresponding to the question information and at least one keyword vector.
[0060] Exemplarily, the question model includes an encoding module and a decoding module. The live broadcast system 01 encodes and decodes the question information based on the encoding module and the decoding module in the question model, and can obtain a question vector and at least one keyword vector corresponding to the question information.
[0061] In some examples, the above-mentioned processing of question information based on the question model to obtain a question vector and at least one keyword vector corresponding to the question information includes: encoding the question information based on the encoding module in the question model to obtain the encoding vector corresponding to the question information; decoding the encoding vector based on the decoding module in the question model to obtain the question vector corresponding to the question information; decoding the question vector based on the decoding module to obtain at least one keyword vector.
[0062] In some embodiments, the encoding module can be implemented based on the BERT structure, and the decoding module can be implemented based on the Transformer structure. The encoding module can encode the question information input by the user to obtain a coding vector; the decoding module can decode the coding vector to obtain coding information, and vectorize the coding information obtained after decoding through the embedding layer to obtain a question vector corresponding to the question information. Among them, the question vector can represent the generalized key information corresponding to the question information.
[0063] In addition, a keyword information decoding unit may be provided in the decoding module. The decoding unit may include a fully connected layer, a rectified linear unit (ReLu) activation function layer and a pooling layer. The keyword information decoding unit may directly obtain the keyword vector corresponding to the question information based on the above question vector.
[0064] It is understandable that when traditional text vectorization methods are used to vectorize text information, the text information can usually be vectorized through sentence vector extraction models such as Text2Vec to obtain the sentence vector corresponding to the text information, but the sentence vector can only represent the original meaning of the text information; in addition, keyword extraction models such as Word2Vec and BERT can be used to extract keywords from text information, and then the keywords are vectorized to obtain keyword vectors.
[0065] In other words, the traditional text vectorization method can only obtain sentence vectors and keyword vectors through different models (i.e., sentence vector extraction model and keyword extraction model), and the sentence vector cannot represent the general key information corresponding to the text information. Moreover, when determining the keyword vector, it is necessary to divide it into two steps: keyword extraction and keyword vectorization. This method will not only make the live broadcast system more complicated, but also reduce the response efficiency of the live broadcast system. In addition, the keyword vector extracted by the keyword extraction model may not be consistent with the meaning represented by the question vector generated by the question model. This phenomenon increases the uncertainty of subsequent retrieval in the vector library.
[0066] In some examples, for the application scenario of live broadcast, the content of user questions is sometimes cumbersome and contains a large number of colloquial expressions. For example, the question information input by the user is: "I bought your facial mask before and my face turned red after using it. I don't know if my skin is too sensitive or if it is a problem with your product. Do you have any other recommendations? Cream is also OK, the effect is milder, and it is better to be cheaper." In the above question information, the user put forward multiple requirements, but because some subjects and objects are omitted in the sentence, the question vector obtained by the traditional text vectorization method based on the question information still represents the original question information, rather than the key information after refinement and integration, which leads to great difficulty in the subsequent semantic retrieval based on the question vector in the vector library. Based on the question model in the embodiment of the present application, the question information is processed, and the obtained question vector can represent the generalized key information corresponding to the question information (such as "recommended mask or cream, requiring gentle effect on sensitive skin, and cheap price", etc.), so that the subsequent retrieval and matching based on the question vector with generalized key information in the historical question and answer vector library can significantly reduce the retrieval difficulty and improve the accuracy of the retrieval. Furthermore, obtaining the corresponding keyword vector based on the question vector can ensure the consistency of the representation meaning between the keyword vector and the question vector, thus avoiding the problem of differences between different models during the adaptation process.
[0067] Through the above scheme, the question model can process the question information based on the encoding module and the decoding module, and can not only output the question vector with general key information, but also synchronously output the keyword vector, so as to perform subsequent retrieval matching in the historical question and answer vector library based on the question vector, which can significantly reduce the retrieval difficulty and improve the retrieval accuracy; and, based on the above question vector, the corresponding keyword vector is obtained, which can ensure the consistency of the representation meaning between the keyword vector and the question vector, and avoid the problem of differences in the adaptation process of different models; in addition, by synchronously outputting the question vector and the keyword vector through one model, the complexity of the overall live broadcast system can be reduced and the response efficiency of the live broadcast system can be improved.
[0068] In some embodiments, the question model summarizes the key information of the question information mainly through the attention mechanism in the Transformer structure of the decoding module. Figure 4 The diagram of training a question model is shown to exemplarily illustrate the training process of the question model. The question model to be trained includes an encoding module 10 and a decoding module 20.
[0069] Figure 5 A flowchart for training a question model is provided for some embodiments of the present application, such as Figure 5As shown, the above step 220 may include steps 510 to 540.
[0070] Step 510: Process the sample text based on the encoding module in the question model to be trained to obtain an encoding vector corresponding to the sample text.
[0071] In some embodiments, Figure 4 As shown, the sample text can be obtained from the training sample database, wherein the sample text can be a question text related to the live broadcast scene. After the sample text is input into the question model to be trained, the encoding module 10 in the question model to be trained can process the sample text to obtain the encoding vector corresponding to the sample text. The encoding vector is used to represent the content of the sample text.
[0072] Exemplarily, the above-mentioned encoding module based on the question model to be trained processes the sample text to obtain the encoding vector corresponding to the sample text, including: masking the sample text based on the encoding module to obtain the first masked text corresponding to the sample text; encoding the first masked text based on the encoding module to obtain the encoding vector.
[0073] In some examples, such as Figure 4 As shown, the encoding module 10 can perform mask processing on the sample text to obtain a first mask text corresponding to the sample text. Masking the sample text means masking some words in the sample text, such as masking 15% to 30% of the words in the sample text. After obtaining the first mask text, the encoding module 10 can perform encoding processing on the first mask text to obtain an encoding vector.
[0074] Step 520, processing the encoding vector based on the decoding module in the question model to be trained to obtain word meaning information and word position information corresponding to the sample text.
[0075] In some embodiments, Figure 4 As shown, after the encoding module 10 obtains the encoding vector, the decoding module 20 can determine the word meaning information and word position information corresponding to the sample text based on the encoding vector. The word meaning information includes the meaning information corresponding to each word in the sample text, and the word position information includes the position information corresponding to each word in the sample text.
[0076] Exemplarily, the above-mentioned decoding module based on the question model to be trained processes the encoding vector to obtain word meaning information and word position information corresponding to the sample text, including: decoding the encoding vector based on the decoding module to obtain word meaning information; masking the sample text based on the decoding module to obtain a second masked text corresponding to the sample text; decoding the second masked text based on the decoding module to obtain a text vector, and processing the encoding vector, the word position vector corresponding to the sample text and the text vector to obtain word position information.
[0077] In some examples, such as Figure 4 As shown, on the one hand, the decoding module 20 can determine the above-mentioned word meaning information based on the above-mentioned encoding vector. On the other hand, the decoding module 20 can first perform mask processing on the sample text to obtain a second mask text corresponding to the sample text. Among them, the masking rate of the second mask text can be greater than the masking rate of the above-mentioned first mask text, such as the masking rate of the first mask text is 15% to 30%, and the masking rate of the second mask text is 50% to 70%. Then, the decoding module 20 can decode the second mask text to obtain the corresponding text vector; then, the decoding module 20 can decode the encoding vector, the word position vector corresponding to the sample text, and the text vector to obtain the word position information. Among them, the word position vector is used to characterize the position of each word in the sample text.
[0078] It should be noted that the above-mentioned method of using the masked sample text for model training enables the question model to focus on the overall content of the sample text during the training process, rather than the prefix or suffix of a specific word / word; and enables the question model to learn the context of the masked sample text during the training process and supplement the masked words therein, thereby improving the training effect of the model.
[0079] In addition, the method of inputting the original text vector into the decoding module as a "reference" for decoding module training can avoid the sample sentence vector and sample keyword vector output by the question model from deviating too much from the content of the original sample text, and significantly improve the efficiency of the gradient descent of the loss function in model training. In the case where the text masking rate of the second mask text is significantly different from that of the first mask text, the overfitting phenomenon of the output result of the question model can also be avoided.
[0080] Step 530, based on the decoding module, the word meaning information and the word position information are processed to obtain the weight corresponding to each word in the sample text, and the sample sentence vector is obtained according to the weight corresponding to each word.
[0081] In some embodiments, Figure 4As shown, after obtaining the above-mentioned word meaning information and word position information, the decoding module 20 can determine the weight corresponding to each word based on the attention mechanism formula according to the word meaning information and word position information. Among them, the weight is used to represent the importance or criticality of the word in the sample text. The greater the weight, the higher the criticality of the word, and the smaller the weight, the lower the criticality of the word.
[0082] Next, the decoding module 20 can determine the target word in the sample text whose weight is higher than the preset weight threshold based on the weight corresponding to each word, and determine the sample sentence vector according to the target word. That is, the sample sentence vector contains the key information with summary corresponding to the sample text.
[0083] In the above-mentioned process of using the attention mechanism, the word meaning information does not include the word position. Instead, the word position information corresponding to another input stream is used as a reference for the word position. This method enables the question model to consider the meaning of the word itself and the contextual information of the word at the same time when calculating weights and generating keyword vectors, thereby improving the question model's understanding and prediction capabilities of the context.
[0084] Step 540: Decode the sample sentence vector based on the decoding module to obtain at least one sample keyword vector.
[0085] In some embodiments, since the weight calculation of each word in the sample text has been completed in the decoding stage, that is, the recognition of the keywords in the sample text has been completed, on this basis, the keyword information decoding unit can output the sample keyword vector according to the sample sentence vector without setting up a separate keyword extraction model. Figure 4 As shown, after the decoding module 20 determines the sample sentence vector, it can decode the sample sentence vector based on the keyword information decoding unit therein, so as to obtain at least one sample keyword vector.
[0086] Step 550: Optimize the question model to be trained based on the sample sentence vector, at least one sample keyword vector and the optimization parameters to obtain a question model.
[0087] In some embodiments, the loss function corresponding to the question model to be trained can be determined based on the above sample sentence vector and at least one sample keyword vector, and the question model to be trained is optimized based on the optimization parameters in the loss function, and finally the trained question model is obtained. Among them, the optimization parameters may include optimization parameters related to models such as BERT and Transformer, which are not limited in the embodiments of the present application.
[0088] In some embodiments, the above-mentioned determining a target historical question and answer vector group corresponding to the question vector from multiple historical question and answer vector groups based on the question vector includes: determining the target historical question and answer vector group from multiple historical question and answer vector groups based on the question vector and at least one keyword vector.
[0089] In some embodiments, after determining the question vector and at least one keyword vector corresponding to the question information based on the trained question model, semantic matching can be performed between the question vector and each historical question vector to determine a first matching degree between each historical question vector and the question vector, and semantic matching can be performed between at least one keyword vector and each historical question vector to determine a second matching degree between each historical question vector and at least one keyword vector; then, based on the first matching degree and the second matching degree, a target matching degree corresponding to each historical question vector is determined; and, the historical question vector with the highest corresponding target matching degree among multiple historical question vectors is determined as a target historical question vector; finally, among multiple historical question and answer vector groups, a target historical question and answer vector group is determined based on the target historical question vector.
[0090] In some examples, the method for determining the first degree of match between each historical question vector and the question vector can refer to the embodiment of step 310, which will not be repeated here. When performing semantic matching on at least one keyword vector and each historical question vector, Faiss can be used to perform semantic matching and determine the second degree of match; or, cosine similarity, dot product, Euclidean distance, etc. can be used to perform semantic matching and determine the second degree of match. The specific method for semantic matching and determining the second degree of match is not limited in the embodiments of the present application.
[0091] Among them, when the number of keyword vectors is one, the matching degree between the keyword vector and each historical question vector is determined as the second matching degree; when the number of keyword vectors is multiple, the corresponding matching degrees between each keyword vector and each historical question vector can be determined, and the average value corresponding to these matching degrees is determined as the second matching degree.
[0092] For example, taking the question information "How does a facial mask improve the moisturizing effect?" as an example, the keywords corresponding to the question information "mask", "moisturizing effect" and "enhancement" are "mask", "moisturizing effect" and "enhancement", and the second matching degree between the keyword vectors corresponding to these keywords and the historical question vectors corresponding to the historical question information in Table 2 can be shown in Table 5. It should be noted that the corresponding values of the keyword vectors and the values of the second matching degree shown in Table 5 are only examples.
[0093] Table 5
[0094] In some embodiments, the above-mentioned determining the target matching degree corresponding to each historical question vector based on the first matching degree and the second matching degree includes: determining the third matching degree between each historical question vector and the question vector based on the first matching degree and the first weight; determining the fourth matching degree between each historical question vector and at least one keyword vector based on the second matching degree and the second weight; and determining the target matching degree corresponding to each historical question vector based on the third matching degree and the fourth matching degree.
[0095] In some examples, the above embodiment is used. For example, the first matching degree between the historical question vector corresponding to the historical question information "How to apply a facial mask for better moisturizing effect?" and the question vector corresponding to the question information "How can a facial mask improve moisturizing effect?" is 0.98; and the second matching degree between the historical question vector corresponding to the historical question information and the keyword vectors corresponding to the keywords "mask", "moisturizing effect" and "improvement" is 0.95. If the first weight is 0.4, the third matching degree between the above historical question vector and the above question vector can be determined according to the product of the first matching degree and the first weight, that is, the third matching degree is ; If the second weight is 0.6, the fourth matching degree between the above historical question vector and the above keyword vector can be determined according to the product of the second matching degree and the second weight, that is, the fourth matching degree is After determining the third matching degree and the fourth matching degree, the target matching degree corresponding to the historical question vector can be determined according to the sum of the third matching degree and the fourth matching degree, that is, the target matching degree is .
[0096] In some embodiments, after determining the target matching degree corresponding to each historical question vector, the live broadcast system 01 may determine the historical question vector with the highest target matching degree as the target historical question vector; and determine the target historical question and answer vector group according to the target historical question vector among multiple historical question and answer vector groups.
[0097] For example, if the historical question vectors corresponding to the historical question information "How to apply a facial mask for better moisturizing effect?" have the highest target matching degree, the live broadcast system 01 can determine the historical question vector as the target historical question vector, and determine the target historical question vector group and the target historical question information group according to the target historical question vector in multiple historical question vector groups. The method of determining the target historical question vector group and the target historical question information group according to the target historical question vector can refer to the embodiment of step 330, which will not be repeated here.
[0098] Step 230: Process the question information and the target historical question and answer information group based on the language model, generate and output answer information corresponding to the question information.
[0099] Figure 6A flowchart of another live question-and-answer method provided in some embodiments of the present application, such as Figure 6 As shown, the above step 230 may include steps 610 to 620.
[0100] Step 610: input the question information and the target historical question and answer information group into the prompt template to obtain prompt information.
[0101] In some examples, after determining the target historical question and answer information group, the live broadcast system 01 can input the target historical question and answer information group into a prompt template to generate prompt information. After the prompt information is input into the language model, the language model can process the prompt information, generate and output answer information to the question information. Among them, the language model can be a large language model (LLM), such as a generative pre-trained transformer (GPT) based on a converter, a BERT model, etc.
[0102] Exemplarily, the content of the prompt template may be: "Please play the role of a host introducing (the subject of the live broadcast, such as facial mask products, can be entered here). If the questions asked by the user are highly repetitive with the content of the conversation, directly rewrite them in combination with the content of the conversation, keeping the meaning of the sentence the same. If the questions asked by the user are unrelated to the content of the conversation, please reply in a consistent tone. Remember to maintain a mild temper and speak softly. The following is the content of the question and answer: (enter the target historical question and answer information group here)".
[0103] Step 620: Process the prompt information based on the language model to generate and output answer information to the question information.
[0104] In some examples, following the above embodiment, the live broadcast system 01 may input prompt information including the target historical question and answer information group "How to apply a facial mask for better moisturizing effect?" and "Before applying a facial mask, you can first apply a thick layer of oil-containing moisturizing essence, so that the nutrients can be pressed into the skin with the help of the sealing property of the mask" into the language model. After the language model processes the prompt information, the answer information generated may be: "In order to achieve better moisturizing effect, it is recommended to cleanse the face first, then apply a mild facial mask, and finally apply moisturizing cream."
[0105] Exemplarily, after the above steps 210 to 230 are performed on each question information in Table 3, the answer information obtained can be shown in Table 6.
[0106] Table 6
[0107] In some embodiments, the live broadcast system 01 may send the answer information in text form to the user terminal 03 through the live broadcast platform 02, or the live broadcast system 01 may convert the answer information in text form into corresponding voice information, and send the voice information to the user terminal 03 through the live broadcast platform 02. In other words, the answer information finally sent to the user terminal 03 may be in text form or in voice form, which is not limited in the embodiments of the present application.
[0108] By applying the technical solution provided in the embodiment of the present application, the question information is processed based on the question model, and a question vector and a keyword vector with general key information can be obtained at the same time. In addition, the question vector can be matched with the historical question and answer vector library based on semantic similarity matching, thereby improving the accuracy of the matching. In addition, the matching result (i.e., the target historical question and answer information group) can be input into the language model and the answer information can be output, thereby improving the diversity, accuracy and novelty of the generated answer information.
[0109] Figure 7 This is a schematic diagram of a live question-and-answer device provided in some embodiments of the present application. Figure 7 As shown, the live question-and-answer device 700 includes a processing module 701 , a determination module 702 , and a generation module 703 .
[0110] The processing module 701 is configured to obtain question information input by the user, and perform vectorization processing on the question information to obtain a question vector corresponding to the question information.
[0111] The determination module 702 is configured to determine, based on the question vector, a target historical question and answer vector group corresponding to the question vector from among multiple historical question and answer vector groups, and determine a target historical question and answer information group corresponding to the target historical question and answer vector group.
[0112] The generation module 703 is configured to process the question information and the target historical question and answer information group based on the language model, and generate and output answer information corresponding to the question information.
[0113] like Figure 7 As shown, the live question-and-answer device 700 also includes an acquisition module 704 .
[0114] In some embodiments, the acquisition module 704 is configured to: acquire multiple historical question and answer information groups; the processing module 701 is specifically configured to perform vectorization processing on the multiple historical question and answer information groups to obtain multiple historical question and answer vector groups corresponding to the multiple historical question and answer information groups.
[0115] In some embodiments, the determination module 702 is specifically configured to: perform semantic matching on the question vector and each historical question vector, and determine the first matching degree between each historical question vector and the question vector; wherein each historical question and answer vector group in the multiple historical question and answer vector groups includes a historical question vector and a historical answer vector; determine the historical question vector with the highest first matching degree between the multiple historical question vectors and the question vector as the target historical question vector; among the multiple historical question and answer vector groups, determine the target historical question and answer vector group according to the target historical question vector; wherein the target historical question and answer vector group includes the target historical question vector and the target historical answer vector.
[0116] In some embodiments, the processing module 701 is specifically configured to: process the question information based on the question model to obtain a question vector and at least one keyword vector corresponding to the question information; the determination module 702 is specifically configured to: determine the target historical question and answer vector group from multiple historical question and answer vector groups based on the question vector and at least one keyword vector.
[0117] In some embodiments, the processing module 701 is specifically configured to: encode the question information based on the encoding module in the question model to obtain the encoding vector corresponding to the question information; decode the encoding vector based on the decoding module in the question model to obtain the question vector corresponding to the question information; decode the question vector based on the decoding module to obtain at least one keyword vector.
[0118] In some embodiments, the determination module 702 is specifically configured to: perform semantic matching on the question vector and each historical question vector to determine a first matching degree between each historical question vector and the question vector; wherein each historical question and answer vector group in the multiple historical question and answer vector groups includes a historical question vector and a historical answer vector; perform semantic matching on at least one keyword vector and each historical question vector to determine a second matching degree between each historical question vector and at least one keyword vector; determine a target matching degree corresponding to each historical question vector based on the first matching degree and the second matching degree; determine the historical question vector with the highest corresponding target matching degree among the multiple historical question vectors as the target historical question vector; and determine a target historical question and answer vector group based on the target historical question vector among the multiple historical question vector groups.
[0119] In some embodiments, the determination module 702 is specifically configured to: determine the third matching degree between each historical question vector and the question vector based on the first matching degree and the first weight; determine the fourth matching degree between each historical question vector and at least one keyword vector based on the second matching degree and the second weight; determine the target matching degree corresponding to each historical question vector based on the third matching degree and the fourth matching degree.
[0120] like Figure 7As shown, the live question-and-answer device 700 also includes a training module 705 .
[0121] In some embodiments, the training module 705 is configured to: process the sample text based on the encoding module in the question model to be trained to obtain the encoding vector corresponding to the sample text; process the encoding vector based on the decoding module in the question model to be trained to obtain the word meaning information and word position information corresponding to the sample text; process the word meaning information and word position information based on the decoding module to obtain the weight corresponding to each word in the sample text, and obtain a sample sentence vector based on the weight corresponding to each word; decode the sample sentence vector based on the decoding module to obtain at least one sample keyword vector; optimize the question model to be trained based on the sample sentence vector, at least one sample keyword vector and the optimization parameters to obtain a question model.
[0122] In some embodiments, the training module 705 is specifically configured to: perform mask processing on the sample text based on the encoding module to obtain a first mask text corresponding to the sample text; perform encoding processing on the first mask text based on the encoding module to obtain an encoding vector.
[0123] In some embodiments, the training module 705 is specifically configured as follows: based on the decoding module, the encoding vector is decoded to obtain word meaning information; based on the decoding module, the sample text is masked to obtain a second masked text corresponding to the sample text; based on the decoding module, the second masked text is decoded to obtain a text vector, and the encoding vector, the word position vector corresponding to the sample text, and the text vector are processed to obtain word position information.
[0124] In some embodiments, the generation module 703 is specifically configured to: input the question information and the target historical question and answer information group into the prompt template to obtain prompt information; wherein the target historical question and answer information group includes target historical question information and target historical answer information; process the prompt information based on the language model, and generate and output answer information to the question information.
[0125] Figure 8 A schematic diagram of an electronic device provided for some embodiments of the present application. In some embodiments, the electronic device includes one or more processors and a memory. The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the live question-and-answer method in the above-mentioned embodiment.
[0126] like Figure 8As shown, the electronic device 800 includes: a processor (processor) 801 and a memory 802. Exemplarily, the electronic device 800 may also include: a communication interface (Communications Interface) 803 and a communication bus 804.
[0127] The processor 801, the memory 802 and the communication interface 803 communicate with each other via a communication bus 804. The communication interface 803 is used to communicate with other devices such as a client or a network element of another server.
[0128] In some embodiments, the processor 801 is used to execute the program 805, and specifically can execute the relevant steps in the above-mentioned live question-and-answer method embodiment. Specifically, the program 805 may include a program code, and the program code includes computer executable instructions.
[0129] Exemplarily, the processor 801 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement some embodiments of the present application. The electronic device 800 may include one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0130] In some embodiments, the memory 802 is used to store the program 805. The memory 802 may include a high-speed RAM memory, and may also include a non-volatile memory (NVM), such as at least one disk memory.
[0131] Program 805 can be specifically called by processor 801 to enable electronic device 800 to perform live question-and-answer method operations.
[0132] Some embodiments of the present application provide a computer-readable storage medium, which stores at least one executable instruction. When the executable instruction is executed on the electronic device 800, the electronic device 800 executes the live question-and-answer method in the above embodiment.
[0133] The executable instructions can be specifically used to enable the electronic device 800 to perform live question-and-answer method operations.
[0134] For example, the computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0135] The beneficial effects that can be achieved by the computer-readable storage medium provided in some embodiments of the present application can be referred to the beneficial effects in the corresponding live question-and-answer method provided above, and will not be repeated here.
[0136] It should be noted that, in the application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0137] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0138] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0139] For the purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by an instruction execution system, apparatus, or device or in conjunction with such instruction execution system, apparatus, or device.
[0140] More specific examples (a non-exhaustive list) of computer readable media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM).
[0141] In addition, the computer readable medium can even be a paper or other suitable medium on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, and then editing, interpreting or processing in other suitable ways as necessary, and then storing it in the computer memory. It should be understood that various parts of the present application can be implemented in hardware, software, firmware or a combination thereof.
[0142] In the above embodiments, multiple steps or methods may be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it may be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0143] The above-described embodiments of the present application do not constitute a limitation on the protection scope of the present application.
Claims
1. A live question-answering method, characterized in that: The method comprises: Obtaining question information input by a user, and performing vectorization processing on the question information to obtain a question vector corresponding to the question information; Based on the question vector, determining a target historical question and answer vector group corresponding to the question vector from a plurality of historical question and answer vector groups, and determining a target historical question and answer information group corresponding to the target historical question and answer vector group; The question information and the target historical question and answer information group are processed based on a language model to generate and output answer information corresponding to the question information.
2. The method according to claim 1, characterized in that The method further comprises: Acquire the plurality of historical question and answer information groups; Vectorization processing is performed on the multiple historical question and answer information groups to obtain the multiple historical question and answer vector groups corresponding to the multiple historical question and answer information groups.
3. The method according to claim 1, characterized in that The step of determining, based on the question vector, a target historical question and answer vector group corresponding to the question vector from a plurality of historical question and answer vector groups includes: Performing semantic matching on the question vector and each historical question vector to determine a first matching degree between each historical question vector and the question vector; wherein each historical question and answer vector group in the plurality of historical question and answer vector groups includes a historical question vector and a historical answer vector; Determine the historical question vector with the highest first matching degree with the question vector among the multiple historical question vectors as the target historical question vector; Among the multiple historical question and answer vector groups, the target historical question and answer vector group is determined according to the target historical question vector; wherein the target historical question and answer vector group includes a target historical question vector and a target historical answer vector.
4. The method according to claim 1, characterized in that: The vectorizing the question information to obtain a question vector corresponding to the question information includes: Processing the question information based on the question model to obtain the question vector and at least one keyword vector corresponding to the question information; The step of determining, based on the question vector, a target historical question and answer vector group corresponding to the question vector from a plurality of historical question and answer vector groups includes: Based on the question vector and the at least one keyword vector, the target historical question and answer vector group is determined from among the plurality of historical question and answer vector groups.
5. The method according to claim 4, characterized in that The step of processing the question information based on the question model to obtain the question vector and at least one keyword vector corresponding to the question information includes: Encoding the question information based on the encoding module in the question model to obtain an encoding vector corresponding to the question information; Decoding the encoding vector based on the decoding module in the question model to obtain the question vector corresponding to the question information; The question vector is decoded based on the decoding module to obtain the at least one keyword vector.
6. The method according to claim 4, characterized in that The step of determining the target historical question and answer vector group from the plurality of historical question and answer vector groups based on the question vector and the at least one keyword vector includes: Performing semantic matching on the question vector and each historical question vector to determine a first matching degree between each historical question vector and the question vector; wherein each historical question and answer vector group in the plurality of historical question and answer vector groups includes a historical question vector and a historical answer vector; Performing semantic matching on the at least one keyword vector and the historical question vectors to determine a second matching degree between the historical question vectors and the at least one keyword vector; Determining a target matching degree corresponding to each of the historical question vectors according to the first matching degree and the second matching degree; Determine the historical question vector with the highest target matching degree among the multiple historical question vectors as the target historical question vector; Among the multiple historical question and answer vector groups, the target historical question and answer vector group is determined according to the target historical question vector.
7. The method according to claim 6, characterized in that Determining the target matching degree corresponding to each historical question vector according to the first matching degree and the second matching degree includes: determining a third matching degree between each of the historical question vectors and the question vector according to the first matching degree and the first weight; Determining a fourth matching degree between each of the historical question vectors and the at least one keyword vector according to the second matching degree and the second weight; The target matching degree corresponding to each of the historical question vectors is determined according to the third matching degree and the fourth matching degree.
8. The method according to any one of claims 4 to 7, characterized in that: The method further comprises: Processing the sample text based on the encoding module in the question model to be trained to obtain an encoding vector corresponding to the sample text; Processing the encoding vector based on the decoding module in the question model to be trained to obtain word meaning information and word position information corresponding to the sample text; Processing the word meaning information and the word position information based on the decoding module to obtain the weight corresponding to each word in the sample text, and obtaining the sample sentence vector according to the weight corresponding to each word; Decoding the sample sentence vector based on the decoding module to obtain the at least one sample keyword vector; Based on the sample sentence vector, the at least one sample keyword vector and the optimization parameters, the question model to be trained is optimized to obtain the question model.
9. The method according to claim 8, characterized in that The encoding module in the question model to be trained processes the sample text to obtain the encoding vector corresponding to the sample text, including: Performing mask processing on the sample text based on the encoding module to obtain a first mask text corresponding to the sample text; The first mask text is encoded based on the encoding module to obtain the encoding vector.
10. The method according to claim 8, characterized in that The decoding module based on the question model to be trained processes the encoding vector to obtain word meaning information and word position information corresponding to the sample text, including: Decoding the encoding vector based on the decoding module to obtain the word meaning information; Performing mask processing on the sample text based on the decoding module to obtain a second mask text corresponding to the sample text; Based on the decoding module, the second mask text is decoded to obtain a text vector, and the encoding vector, the word position vector corresponding to the sample text and the text vector are processed to obtain the word position information.
11. The method according to any one of claims 1 to 7, characterized in that: The processing of the question information and the target historical question and answer information group based on the language model to generate and output answer information for the question information includes: Input the question information and the target history question and answer information group into a prompt template to obtain prompt information; wherein the target history question and answer information group includes target history question information and target history answer information; The prompt information is processed based on the language model to generate and output answer information to the question information.
12. A live question-and-answer device, characterized in that: The device comprises: A processing module is configured to obtain question information input by a user, and perform vectorization processing on the question information to obtain a question vector corresponding to the question information; A determination module is configured to determine, based on the question vector, a target historical question and answer vector group corresponding to the question vector from among a plurality of historical question and answer vector groups, and determine a target historical question and answer information group corresponding to the target historical question and answer vector group; The generation module is configured to process the question information and the target historical question and answer information group based on the language model, and generate and output answer information corresponding to the question information.
13. An electronic device, characterized in that: include: one or more processors; and A memory configured to: store one or more programs; Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the live question-and-answer method according to any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the live question-and-answer method according to any one of claims 1-11 is implemented.
15. A computer program product, characterized in that The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the live question-and-answer method described in any one of claims 1-11.
Citation Information
Cited By
Voice interaction method and apparatus, and XR device
CN120544579A