Question answering method and device and electronic equipment

Through semantic matching of question vectors and document vectors and user personalized information filtering, targeted prompt text is generated, which solves the problem of low personalization in question answers in large language models, and improves the personalization and user satisfaction of the answers.

CN119166796APending Publication Date: 2024-12-20北京天数智芯半导体科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410974144.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Large language models have difficulty providing personalized answers in question answers, resulting in less personalized answers in question answers.

Method used

By obtaining the question request and converting it into a question vector, combining the document vector for semantic matching, obtaining user personalized information for filtering, and generating targeted prompt text to improve the degree of personalization of answers.

Benefits of technology

It achieves a more accurate understanding of user questions and needs, improves the personalization of answers, and enhances user satisfaction and content matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166796A_ABST
    Figure CN119166796A_ABST
Patent Text Reader

Abstract

The invention provides a question answering method, a question answering device and electronic equipment, which are used for solving the problem that the personalized degree of question answering is relatively low. The method comprises the following steps: acquiring a question request, and converting the question request into a question vector; querying a candidate document list from a vector document library according to the similarity value between the document vector and the question vector, wherein the vector document library comprises documents and document vectors corresponding to the documents; obtaining personalized information of a current user corresponding to the question request, and filtering the candidate document list according to the personalized information of the current user to obtain a filtered document list; generating a prompt text according to the filtered document list, the question request and the subject term; and processing the prompt text through the large language model to obtain an answer result corresponding to the question request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical fields of artificial intelligence, large language models and prompt engineering, and more specifically, to a question-answering method, device and electronic device. Background Art

[0002] At present, large language models have become the mainstream method for handling natural language understanding and generation tasks, especially in question-answering systems. However, the quality of answering questions using large language models is mostly based on the pre-training and fine-tuning process of the large language model. The pre-training process allows the large language model to learn the complex structure and context dependency of the language, and the fine-tuning process is used to adapt to the task requirements of specific fields. In practice, it is found that the quality of the answers of large language models is difficult to provide to users in a personalized way, resulting in a low degree of personalization of question answers. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a question-and-answer method, device, and electronic device, which are used to improve the problem of low personalization of question-and-answer.

[0004] The embodiment of the present application provides a question answering method, including: obtaining a question request and converting the question request into a question vector; querying a candidate document list from a vector document library according to a similarity value between a document vector and a question vector, wherein the vector document library includes: a document and its corresponding document vector; obtaining personalized information of a current user corresponding to the question request, and filtering the candidate document list according to the personalized information of the current user to obtain a filtered document list; generating a prompt text according to the filtered document list, the question request, and a keyword; and processing the prompt text through a large language model to obtain an answer result corresponding to the question request. In the implementation process of the above scheme, the candidate document list most relevant to the question can be efficiently queried through the similarity value between the question vector converted from the question request and the document vector. This semantic vector-based matching goes beyond the limitations of keyword matching and can better understand the essence of user questions, thereby finding information that better fits the user's question needs. Furthermore, the candidate document list most relevant to the question is filtered according to the user's personalized information, and the filtered document list is used to generate prompt text, thereby ensuring that the generated prompt text is not only the most relevant to the question, but also customized for a specific user, so that the large language model can obtain personalized answer results based on the prompt text generated by personalized information, effectively improving the personalization of the answer results.

[0005] Optionally, in an embodiment of the present application, converting a question request into a question vector includes: extracting keywords from the question request using a large language model; vectorizing the keywords to obtain a question vector. In the implementation of the above scheme, by extracting keywords through a large language model, the core intention of the user's question can be more accurately grasped, and the real needs behind it can be effectively identified, thereby improving the system's understanding and interpretation capabilities, allowing the machine to be closer to the way humans understand. Furthermore, after the keywords are vectorized, efficient similarity searches or nearest neighbor searches can be performed directly in the vector space, greatly speeding up information retrieval.

[0006] Optionally, in an embodiment of the present application, before querying a list of candidate documents from a vector document library based on the similarity value between a document vector and a question vector, it also includes: obtaining multiple original documents; for each of the multiple original documents, vectorizing the original document to obtain a document vector for the original document; for each of the multiple original documents, associating the document vector of the original document with the original document and storing it in the vector document library. In the implementation process of the above scheme, by pre-calculating and storing the vector representation of each document, efficient searches can be performed directly in the vector space during queries, avoiding scanning the full text one by one, greatly improving the retrieval speed, and document vectorization can capture the semantic features of documents. Compared with keyword-based searches, it can better understand the actual content and context of documents, thereby improving the relevance and accuracy of search results.

[0007] Optionally, in an embodiment of the present application, obtaining personalized information of the current user corresponding to the question request includes: parsing the personalized information of the current user from the question request; or parsing the user ID of the current user from the question request, and querying the personalized information corresponding to the user ID. In the implementation process of the above scheme, by identifying the personalized information of the user (such as interest preferences, historical behavior, geographic location, etc.), more customized search results or answers can be provided, making the content closer to the actual needs and expectations of the user, significantly improving user satisfaction and participation, and combining the personalized background of the user, it can filter out information that is irrelevant to the user or known to the user, and give priority to displaying high-value content that the user is unknown but may be interested in, thereby improving the efficiency and quality of information transmission.

[0008] Optionally, in an embodiment of the present application, the candidate document list is filtered according to the personalized information of the current user, including: for each candidate document in the candidate document list, using a personalized scoring model to score the candidate document according to the personalized information of the current user, and obtaining the personalized score of the current user, the personalized score represents the probability value of the user clicking on the candidate document; filtering multiple candidate documents in the candidate document list according to the personalized score. In the implementation process of the above scheme, by predicting the user's click probability for each document and sorting it accordingly, the system can give priority to displaying the content that the user is most likely to be interested in. The introduction of personalized scores enables the recommendation system to go beyond simple keyword matching, deeply understand the user's potential needs to achieve more accurate personalized recommendations, greatly improve the matching degree between content and user needs, thereby improving user satisfaction and retention rate.

[0009] Optionally, in an embodiment of the present application, before using a personalized scoring model to score the candidate document according to the personalized information of the current user, it also includes: obtaining personalized information of multiple users; for each of the multiple users, extracting the personalized features of the user from the personalized information of the user to obtain personalized features of the multiple users; using the document vectors in the vector document library and the personalized features of multiple users as training data, the candidate documents that have been clicked in the vector document library as positive sample labels, and the candidate documents that have not been clicked in the vector document library as negative sample labels, to train the personalized scoring model. In the implementation process of the above scheme, through a large-scale multi-user training data set, the model can learn the commonalities and differences between different user groups, so as to show good generalization ability when facing new users or marginal users, and quickly provide personalized services; further, by combining user personalized features and document content features, the model can learn the complex relationship between user interests and document content, achieve high-precision prediction of user click behavior, and improve the accuracy of personalized recommendation prediction.

[0010] Optionally, in an embodiment of the present application, a personalized scoring model is used to score the candidate document according to the personalized information of the current user, including: obtaining the document vector corresponding to the candidate document, and extracting the personalized features of the current user from the personalized information of the current user; inputting the document vector corresponding to the candidate document and the personalized features of the current user into the personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user. In the implementation process of the above scheme, the personalized scoring model not only considers the user's personal preferences, but also finds a balance between the user's known interests and the exploration of new content through the optimization algorithm, which not only meets the user's demand for familiar content, but also guides the user to discover novel information and enhances the diversity of the content ecology. Therefore, the personalized scoring model can adjust the scoring criteria in real time according to the user's latest behavior and preferences. Even if the user's interests change, it can respond quickly and provide the latest and most relevant recommended content, enhancing the real-time and adaptability of the system.

[0011] Optionally, in an embodiment of the present application, personalized information includes: historical behavior logs and social engineering information; extracting personalized features of the current user from the personalized information of the current user includes: extracting historical behavior features of the current user from the historical behavior log of the current user; extracting social engineering features of the current user from the social engineering information of the current user. In the implementation of the above scheme, combining historical behavior features and social engineering features, the model can have a deeper understanding of the user's behavioral motivations and decision-making process, not only based on past preferences, but also taking into account factors such as the user's social role and psychological state, making the recommendation more delicate and closer to the user's real needs. Furthermore, by analyzing social engineering features, the system can better identify the user's psychological state or social preference in a specific situation, thereby providing more intimate and humane services, and enhancing the user's trust and acceptance of the recommendation system.

[0012] The embodiment of the present application also provides a question-answering device, including: a question request conversion module, used to obtain a question request and convert the question request into a question vector; a document list query module, used to query a candidate document list from a vector document library according to a similarity value between a document vector and a question vector, wherein the vector document library includes: documents and their corresponding document vectors; a document list filtering module, used to obtain personalized information of a current user corresponding to the question request, and filter the candidate document list according to the personalized information of the current user to obtain a filtered document list; a prompt text generation module, used to generate a prompt text according to the filtered document list, the question request, and a keyword; and an answer result acquisition module, used to process the prompt text through a large language model to obtain an answer result corresponding to the question request.

[0013] Optionally, in an embodiment of the present application, the question request conversion module includes: a subject word extraction submodule, which is used to extract subject words from question requests using a large language model; and a question vector acquisition module, which is used to vectorize subject words to obtain question vectors.

[0014] Optionally, in an embodiment of the present application, the question and answering device also includes: an original document acquisition module, used to acquire multiple original documents; a document vector acquisition module, used to vectorize each original document in the multiple original documents to obtain a document vector of the original document; and a document association storage module, used to associate the document vector of the original document with the original document and store it in a vector document library for each original document in the multiple original documents.

[0015] Optionally, in an embodiment of the present application, the question answering device further includes: a question request parsing module, used to parse out the personalized information of the current user from the question request; or, a user information query module, used to parse out the user identifier of the current user from the question request, and query out the personalized information corresponding to the user identifier.

[0016] Optionally, in an embodiment of the present application, the document list filtering module includes: a candidate document scoring submodule, which is used to score each candidate document in the candidate document list using a personalized scoring model according to the personalized information of the current user, and obtain a personalized score of the current user, where the personalized score represents the probability value of the user clicking on the candidate document; and a candidate document filtering submodule, which is used to filter multiple candidate documents in the candidate document list according to the personalized scores.

[0017] Optionally, in an embodiment of the present application, the document list filtering module includes: a user information acquisition submodule, used to obtain personalized information of multiple users; a personalized feature extraction submodule, used to extract the personalized features of each user among the multiple users from the personalized information of the user, and obtain personalized features of the multiple users; a scoring model training submodule, used to train the personalized scoring model using the document vectors in the vector document library and the personalized features of multiple users as training data, the candidate documents that have been clicked in the vector document library as positive sample labels, and the candidate documents that have not been clicked in the vector document library as negative sample labels.

[0018] Optionally, in an embodiment of the present application, the candidate document scoring submodule includes: a personalized feature extraction unit, used to obtain the document vector corresponding to the candidate document, and extract the personalized features of the current user from the personalized information of the current user; a personalized score acquisition unit, used to input the document vector corresponding to the candidate document and the personalized features of the current user into a personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user.

[0019] Optionally, in an embodiment of the present application, personalized information includes: historical behavior logs and social engineering information; the personalized feature extraction unit includes: a first feature extraction subunit, used to extract historical behavior features of the current user from the historical behavior logs of the current user; a second feature extraction subunit, used to extract social engineering features of the current user from the social engineering information of the current user.

[0020] An embodiment of the present application further provides an electronic device, including: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions execute the method described above when executed by the processor.

[0021] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described above is executed.

[0022] The embodiment of the present application also provides a computer program product, including: a computer program or a computer instruction, and the computer program or the computer instruction executes the method described above when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 A flowchart of a question-answering method provided in an embodiment of the present application is shown; Figure 2 A schematic diagram of a filtering process of a candidate document list provided in an embodiment of the present application is shown; Figure 3 A schematic diagram of the process flow of the question-answering device provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0025] To make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. It should be understood that the drawings in the embodiment of the present application only serve the purpose of explanation and description, and are not used to limit the protection scope of the embodiment of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in the embodiment of the present application shows the operation implemented according to some embodiments of the embodiment of the present application. It should be understood that the operation of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the embodiment of the present application, or remove one or more operations from the flowchart.

[0026] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all embodiments. The components of the embodiments of the present application described and shown in the drawings generally here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the embodiments of the present application claimed, but merely represents the selected embodiments of the embodiments of the present application.

[0027] It is understandable that the "first" and "second" in the embodiments of the present application are used to distinguish similar objects. Those skilled in the art will understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit the difference. In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of the associated objects, indicating that there may be three relationships, such as A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship. The term "multiple" refers to more than two (including two), and similarly, "multiple groups" refers to more than two groups (including two groups).

[0028] Before introducing the question-answering method provided in the embodiment of the present application, some concepts involved in the embodiment of the present application are first introduced: Large Language Models (LLMs) are artificial intelligence (AI) models trained based on massive amounts of data. They use architectures such as Transformer to process language tasks. They can complete a variety of tasks such as text generation and question answering without training for specific tasks, demonstrating a high degree of flexibility and language comprehension capabilities.

[0029] It should be noted that the question-answering method provided in the embodiment of the present application can be executed by an electronic device, where the electronic device refers to a device terminal or server with the function of executing a computer program, such as a smart phone, a personal computer, a tablet computer, a personal digital assistant, or a mobile Internet device. A server refers to a device that provides computing services through a network, such as an x86 server and a non-x86 server, and a non-x86 server includes a mainframe, a minicomputer, and a UNIX server.

[0030] The following are examples of application scenarios to which the question-answering method is applicable: scenarios such as intelligent customer service, news recommendation, or product recommendation. Specifically, in the question-answering scenario of intelligent customer service, the question-answering method can be used to conduct multiple rounds of dialogue with the user, and gradually delve into the core of the problem based on the user's continuous questions, so that the intelligent customer service's answer content is more in line with the information required by the user's question. In addition, in application scenarios such as news recommendation or product recommendation, the user can express his interest in a specific news topic or event through a question request. The electronic device can use the question-answering method to quickly retrieve the most relevant and latest news content candidate documents from the vector document library, and then answer the user's question request based on the most relevant and latest news content, thereby finding news content candidate documents that are more in line with the user's question needs and improving the personalization of the answer results.

[0031] See also Figure 1 The flowchart of the question answering method provided by the embodiment of the present application is shown; the main idea of ​​the question answering method provided by the embodiment of the present application is to filter the candidate document list most relevant to the question according to the user's personalized information, and use the filtered document list to generate prompt text, so that the large language model can obtain personalized answer results based on the prompt text generated by the personalized information, effectively improving the personalization of the answer result. The implementation method of the above question answering method may include: Step S110: Obtain a question request, and convert the question request into a question vector.

[0032] The above-mentioned question request is a question that the user wants to ask the large language model. The question request here can be a text content. For example, the user terminal device can send a message to the electronic device saying "I am going to participate in a debate. Please help me find books or literature to improve my debate skills", so that the electronic device can receive the question request sent by the terminal device.

[0033] Step S120: querying a candidate document list from a vector document library according to the similarity value between the document vector and the question vector, wherein the vector document library includes: documents and their corresponding document vectors.

[0034] It can be understood that the above-mentioned querying of candidate document lists from the vector document library based on the similarity value between the document vector and the question vector, the technology mainly focuses on enhancing the generation ability of the language model by retrieving external information (such as the vector document library). One of the capabilities is to retrieve the most relevant information to the user query from a large number of documents or information libraries. For example, the above querying of candidate document lists from the vector document library based on the similarity value, usually the question request and the document are converted into vector form. This vectorized representation enables the system to evaluate the relevance of the document to the query question request by calculating the similarity value between the vectors.

[0035] Step S130: Obtain personalized information of the current user corresponding to the question request, and filter the candidate document list according to the personalized information of the current user to obtain a filtered document list.

[0036] It is understandable that the above-mentioned personalized information of the user may include historical behavior logs (such as historical interaction behavior information) and social engineering information, etc. Social engineering information includes age, gender, education, education level, professional field, etc. Therefore, the document list filtered according to the personalized information can enable the large language model to more accurately understand the user's question request intention, thereby querying and filtering out a document list that is more relevant to the question request, thereby improving the quality of the prompt text generated according to the filtered document list, question request, and keyword, and the personalization of the answer result of the large language model according to the prompt text.

[0037] Step S140: Generate prompt text according to the filtered document list, question request, and keyword.

[0038] It is understandable that the above prompt text can be directly composed of the filtered document list, question request, and keyword, or the filtered document list, question request, and keyword are filled into the prompt word template to obtain the generated prompt text. The specific prompt word template can be set according to the specific business scenario. Therefore, the specific generation process of the prompt text should not be understood as a limitation of the embodiments of the present application.

[0039] Step S150: Process the prompt text through a large language model to obtain an answer result corresponding to the question request.

[0040] In the implementation process of the above scheme, the candidate document list most relevant to the question can be efficiently queried through the similarity value between the question vector converted from the question request and the document vector. This semantic vector-based matching goes beyond the limitations of keyword matching and can better understand the essence of user questions, thereby finding information that better fits the user's question needs. Furthermore, the candidate document list most relevant to the question is filtered according to the user's personalized information, and the filtered document list is used to generate prompt text, thereby ensuring that the generated prompt text is not only the most relevant to the question, but also customized for a specific user, so that the large language model can obtain personalized answer results based on the prompt text generated by personalized information, effectively improving the personalization of the answer results.

[0041] As an optional implementation of the above step S110, the above implementation of converting the question request into the question vector may include: Step S111: Obtain a question request and extract a keyword from the question request.

[0042] An implementation example of the above step S111 is as follows: the electronic device receives a question request sent by the user terminal device, where the question request may be a text content, for example: "I am going to participate in a debate, please help me find books or literature to improve my debate skills". Then, the electronic device may use a large language model such as a GPT series model (such as chatGPT), an LLaMA series model (such as LlaMA2-7b or LlaMA3-7b), etc. to extract keywords from the question request. These keywords can reflect the main intention of the large language model to understand the question request sent by the user, such as: "improve debate skills", "books", and "literature".

[0043] It is understandable that the above-mentioned large language model can be used to extract keywords, generate answers based on prompt text, etc., because the large language model will output different results according to different prompt sentences. For example: the question request is "I am going to participate in a debate. Please help me find books or literature to improve my debate skills", and the prompt template for extracting keywords is "Please extract the most important words". Then the prompt template for extracting keywords can be spliced ​​with the question request, and the resulting prompt text is "I am going to participate in a debate. Please help me find books or literature to improve my debate skills. From the above content, please extract the most important words."

[0044] Another implementation of the above-mentioned step S111 is, for example: using a word segmentation tool to segment the text content of the question request to obtain multiple words (tokens), then calculating the importance of each of the multiple words (such as a weight value or a confidence value, etc.), and finally, screening out words whose importance is greater than a preset degree (for example, a weight value or a confidence value greater than a preset threshold) from the multiple words, and determining the words whose importance is greater than the preset degree as the above-mentioned subject words.

[0045] Step S112: vectorize the subject words to obtain question vectors.

[0046] The implementation method of the above step S112 is, for example: Since the above-mentioned subject words can reflect the main intention of the large language model to understand the question request sent by the user, a vectorization model (such as a BERT model, an mBERT model, or a BiBERT model) can be used to vectorize the subject words to obtain a question vector, which can also reflect the main intention vector of the large language model to understand the question request sent by the user. In the implementation process of the above scheme, by extracting subject words through a large language model, the core intention of the user's question can be grasped more accurately, and the real needs behind it can be effectively identified, which improves the system's understanding and interpretation capabilities, allowing the machine to be closer to the human way of understanding. Furthermore, after the subject words are vectorized, efficient similarity search or nearest neighbor search can be directly performed in the vector space, which greatly speeds up the information retrieval speed.

[0047] As another optional implementation of the above step S110, after obtaining the question request, the question request may be directly converted into a question vector, for example, using a BERT (Bidirectional Encoder Representations from Transformers) model or a BART (Bidirectional and Auto-Regressive Transformers) model to convert the question request into a question vector.

[0048] As an optional implementation of the above method, before querying the candidate document list from the vector document library according to the similarity value between the document vector and the question vector, the original document and its document vector may be associated and stored in the vector document library. This implementation may include: Step S121: Acquire multiple original documents.

[0049] The implementation method of the above step S121 is, for example: reading multiple original documents from MySQL, Oracle or a non-relational database, or obtaining multiple original documents from a local file system or a distributed file system.

[0050] Step S122: for each original document among the multiple original documents, vectorization processing is performed on the original document to obtain a document vector of the original document.

[0051] An implementation example of the above step S122 is as follows: for each original document among the multiple original documents, a vectorization model such as a BERT model, an mBERT model or a BiBERT model is used to vectorize the original document to obtain a document vector of the original document.

[0052] Step S123: for each original document among the multiple original documents, the document vector of the original document is associated with the original document and stored in a vector document library.

[0053] An implementation example of the above step S123 is as follows: for each original document among the multiple original documents, the document vector of the original document is used as the primary key (Key), and the original document is used as the key value (Value), so that the document vector of the original document and the original document are associated and stored in a vector document library such as a PostgreSQL database, a FAISS database, an Annoy database or a Milvus database.

[0054] As an optional implementation of the above step S130, the above personalized information may be directly parsed from the question request, and the implementation may include: Step S131: parse the personalized information of the current user from the question request.

[0055] The implementation method of the above step S131 is, for example: parsing the personalized information such as the social engineering information of the current user from the question request is not limited to the specific contents such as the user identification, click records, non-click records, question request records, and keyword records, but can also be the language style, answer depth, and content breadth, etc. In addition, the historical behavior log (such as historical interaction behavior information) of the current user can also be found in the log database according to the user identification. It can be understood that the historical behavior log of the current user is stored in the log database here. The historical behavior log here can be the historical interaction behavior information with the user on the command line, or the historical interaction behavior information with the user on the graphical user interface (GUI).

[0056] Alternatively, as another optional implementation of the above step S130, the above personalized information may be queried according to the user identifier parsed in the question request, and the implementation includes: Step S132: parse the user ID of the current user from the question request, and query the personalized information corresponding to the user ID.

[0057] The implementation method of the above step S132 is, for example: parsing the user ID of the current user from the question request, and querying the personalized information corresponding to the user ID from the user information table of the database, and the user information table stores the corresponding relationship between the user ID and the user personalized information. It can be understood that the above-mentioned personalized information of the user can include historical behavior logs (such as historical interactive behavior information), social engineering information, etc.; wherein the historical interactive behavior information is not limited to specific contents such as click records, non-click records, question request records, and keyword records, but can also include: language style, answer depth, content breadth, and other forms of content.

[0058] See also Figure 2 The schematic diagram of the filtering process of the candidate document list provided by the embodiment of the present application is shown; as an optional implementation of the above step S130, the above implementation of filtering the candidate document list according to the personalized information of the current user may include: Step S133: For each candidate document in the candidate document list, a personalized scoring model is used to score the candidate document according to the personalized information of the current user to obtain a personalized score of the current user, where the personalized score represents the probability value of the user clicking on the candidate document.

[0059] The Personalized Scoring Model (PSM) is a neural network model that scores documents based on the user's personalized information. Different models can be selected according to different business scenarios, such as the DeepFM model, Wide&Deep model, deep neural network DNN model, etc.

[0060] Step S134: filtering multiple candidate documents in the candidate document list according to the personalized scores.

[0061] It is understandable that if all the candidate documents in the candidate document list are input into the large language model, in this case, it is difficult for the large language model to make personalized recommendations for each user, resulting in a decrease in the quality of the output answer results of the large language model. Therefore, the multiple candidate documents in the candidate document list are first filtered according to the personalized scores, and the large language model is allowed to answer the prompt text generated by the document list after the personalized score is filtered. This can effectively filter and answer for each user, thereby improving the personalization of the answer results of the large model.

[0062] One implementation method of the above-mentioned step S134 is, for example: the above-mentioned personalized score represents the probability value of the importance of the user clicking on the candidate document, and the personalized score can be used to sort the multiple candidate documents in the candidate document list from high to low to obtain the sorted multiple candidate documents, and then a preset number of documents with high rankings are taken out from the sorted multiple candidate documents. The preset number here can be set according to the specific situation, for example, the preset number can be set to 5 or 10, etc.

[0063] Another implementation of the above-mentioned step S134 is, for example: deleting documents whose personalized scores are less than a preset threshold from multiple candidate documents in the candidate document list to obtain the above-mentioned filtered candidate document list; wherein the above-mentioned personalized score is a probability value, and the preset threshold here can be set according to the specific situation and application scenario, for example, the preset threshold can be set to 80%, or the preset threshold can be set to 90%.

[0064] As an optional implementation of the above step S133, before using the personalized scoring model to score the candidate document according to the personalized information of the current user, the above personalized scoring model may also be trained. This implementation may include: Step S133a: Obtain personalized information of multiple users.

[0065] The implementation method of the above step S133a is, for example: reading the personalized information of multiple users from MySQL, Oracle or a non-relational database, or reading the personalized information of multiple users from a local file system or a distributed file system.

[0066] Step S133b: For each user among the multiple users, extract the personalized feature of the user from the personalized information of the user to obtain the personalized features of the multiple users.

[0067] An implementation example of the above step S133b is as follows: the above personalized information may include: historical behavior logs and social engineering information; therefore, the historical behavior characteristics of the current user may be extracted from the historical behavior logs of the current user, and the social engineering characteristics of the current user may be extracted from the social engineering information of the current user. For each of the multiple users, the historical behavior characteristics and social engineering characteristics of the user are extracted from the personalized information of the user, thereby finally obtaining the historical behavior characteristics and social engineering characteristics of the multiple users.

[0068] Step S133c: Use the document vectors in the vector document library and the personalized features of multiple users as training data, the candidate documents that have been clicked in the vector document library as positive sample labels, and the candidate documents that have not been clicked in the vector document library as negative sample labels to train the personalized scoring model.

[0069] It is understandable that after the user terminal issues an article recommendation request (which can be understood as a Query), the electronic device can send multiple recommended articles to the user terminal. Here, the multiple recommended articles can include candidate documents that have been clicked by the user and candidate documents that have not been clicked. Then, the candidate documents that have been clicked by the user can be stored in the click record of the historical behavior log library, and the candidate documents that have not been clicked can be stored in the unclick record of the historical behavior log library. In addition, the question request, subject words, etc. of this article recommendation request can also be stored in the historical behavior log library, so that in the offline training process of the personalized scoring model, the user's historical behavior features used to train the large language model can be extracted from the historical behavior log library. Therefore, when it is necessary to train the personalized scoring model, the candidate documents clicked by the user can be taken out of the click record of the historical behavior log as positive sample labels, and the candidate documents that have not been clicked can be taken out of the unclick record of the historical behavior log as negative sample labels, and the personalized scoring model is trained to finally obtain the trained personalized scoring model.

[0070] An implementation example of the above step S133c is: using the document vectors in the vector document library and the personalized features of multiple users as training data, using the candidate documents that have been clicked in the vector document library as positive sample labels, and using the candidate documents that have not been clicked in the vector document library as negative sample labels, the personalized scoring model is trained until the loss function of the personalized scoring model converges or the number of epochs reaches a preset value, thereby obtaining a trained personalized scoring model.

[0071] As another optional implementation of the above step S133, the implementation of using the personalized scoring model for reasoning may include: Step S133d: Obtain the document vector corresponding to the candidate document, and extract the personalized features of the current user from the personalized information of the current user.

[0072] As an optional implementation of the above-mentioned step S133d, the above-mentioned personalized information may include: historical behavior logs and / or social engineering information; the above implementation method of extracting the personalized characteristics of the current user from the personalized information of the current user may include: using an executable program to extract the historical behavior characteristics of the current user from the historical behavior log of the current user, and / or, using an executable program to extract the social engineering characteristics of the current user from the social engineering information of the current user.

[0073] Step S133e: input the document vector corresponding to the candidate document and the personalized features of the current user into the personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user.

[0074] As another optional implementation of the above step S133, the implementation of using the personalized scoring model for reasoning may include: Step S133f: Obtain the document vector corresponding to the candidate document, and extract the document vector feature from the document vector corresponding to the candidate document.

[0075] An implementation method of the above step S133f is, for example: using an executable program to obtain the document vector corresponding to the candidate document, and extracting document vector features from the document vector corresponding to the candidate document through a feature extraction model (such as a CNN model or an RNN model).

[0076] Step S133g: extracting keywords from the question request, and extracting keyword vector features from the keywords.

[0077] An implementation method of the above step S133g, for example: using a large language model such as a GPT series model (such as chatGPT), an LLaMA series model (such as LlaMA2-7b or LlaMA3-7b), etc. to extract keywords from the question request, and extract keyword vector features from the keywords through a feature extraction model (such as a CNN model or an RNN model).

[0078] Step S133h: extracting personalized features of the current user from the personalized information of the current user.

[0079] It can be understood that the implementation of step S133h is similar to the implementation of step S133b above, so it will not be repeated here. If there are any unclear points, please refer to the implementation of step S133b above.

[0080] Step S133i: input the subject word vector features, document vector features and the personalized features of the current user into the personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user.

[0081] An implementation example of the above step S133i is: using the subject word vector features, document vector features and the personalized features of the current user as inputs to a personalized scoring model (e.g., a DeepFM model), and inputting these subject word vector features, document vector features and the personalized features of the current user into the personalized scoring model (e.g., a DeepFM model), so that the personalized scoring model outputs a personalized score for the current user.

[0082] As another optional implementation of the above step S130, the candidate document list can also be filtered according to the similarity between the vector of the current user's personalized information and the candidate document vector. For example, if the similarity between the vector of the personalized information and the candidate document vector is less than a preset threshold (for example, 60%), the candidate document is deleted from the candidate document list until a preset number (for example, 3 or 5) of candidate documents remain, thereby completing the function of filtering the candidate document list.

[0083] See also Figure 3 The flowchart of the question answering device provided in the embodiment of the present application is shown; the embodiment of the present application provides a question answering device 200, including: The question request conversion module 210 is used to obtain a question request and convert the question request into a question vector.

[0084] The document list query module 220 is used to query a candidate document list from a vector document library according to the similarity value between the document vector and the question vector. The vector document library includes: documents and their corresponding document vectors.

[0085] The document list filtering module 230 is used to obtain the personalized information of the current user corresponding to the question request, and filter the candidate document list according to the personalized information of the current user to obtain a filtered document list.

[0086] The prompt text generation module 240 is used to generate prompt text according to the filtered document list, question request, and keyword.

[0087] The answer result obtaining module 250 is used to process the prompt text through a large language model to obtain the answer result corresponding to the question request.

[0088] As an optional implementation of the above device, the question request conversion module includes: The topic word extraction submodule is used to extract topic words from question requests using a large language model.

[0089] The question vector acquisition module is used to vectorize the subject words and obtain the question vector.

[0090] As an optional implementation of the above device, the question-answering device further includes: The original document acquisition module is used to acquire multiple original documents.

[0091] The document vector obtaining module is used to perform vectorization processing on each original document among the multiple original documents to obtain the document vector of the original document.

[0092] The document association storage module is used to associate the document vector of each original document among the multiple original documents with the original document and store it in a vector document library.

[0093] As an optional implementation of the above device, the question-answering device further includes: The question request parsing module is used to parse the personalized information of the current user from the question request.

[0094] Alternatively, the user information query module is used to parse the user ID of the current user from the question request and query the personalized information corresponding to the user ID.

[0095] As an optional implementation of the above device, the document list filtering module includes: The candidate document scoring submodule is used to score each candidate document in the candidate document list according to the personalized information of the current user using a personalized scoring model to obtain the personalized score of the current user, where the personalized score represents the probability value of the user clicking on the candidate document.

[0096] The candidate document filtering submodule is used to filter multiple candidate documents in the candidate document list according to the personalized scores.

[0097] As an optional implementation of the above device, the document list filtering module includes: The user information acquisition submodule is used to obtain personalized information of multiple users.

[0098] The personalized feature extraction submodule is used to extract the personalized feature of each user from the personalized information of the user, so as to obtain the personalized features of the multiple users.

[0099] The scoring model training submodule is used to train the personalized scoring model using the document vectors in the vector document library and the personalized features of multiple users as training data, the candidate documents that have been clicked in the vector document library as positive sample labels, and the candidate documents that have not been clicked in the vector document library as negative sample labels.

[0100] As an optional implementation of the above device, the candidate document scoring submodule includes: The personalized feature extraction unit is used to obtain the document vector corresponding to the candidate document and extract the personalized features of the current user from the personalized information of the current user.

[0101] The personalized score obtaining unit is used to input the document vector corresponding to the candidate document and the personalized features of the current user into the personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user.

[0102] As an optional implementation of the above device, the personalized information includes: historical behavior logs and social engineering information; the personalized feature extraction unit includes: The first feature extraction subunit is used to extract the historical behavior features of the current user from the historical behavior log of the current user.

[0103] The second feature extraction subunit is used to extract the social engineering features of the current user from the social engineering information of the current user.

[0104] It should be understood that the device corresponds to the above-mentioned question-answering method embodiment and can execute each step involved in the above-mentioned method embodiment. The specific functions of the device can be found in the above description, and the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or fixed in the operating system (OS) of the device.

[0105] See also Figure 4 The electronic device 300 provided in the embodiment of the present application includes: a processor 310 and a memory 320, wherein the memory 320 stores machine-readable instructions executable by the processor 310, and when the machine-readable instructions are executed by the processor 310, the above method is executed.

[0106] The embodiment of the present application also provides a computer-readable storage medium 330, on which a computer program is stored, and the computer program is executed by the processor 310 to execute the above method. The computer-readable storage medium 330 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, disk or optical disk.

[0107] The embodiment of the present application also provides a computer program product, including: a computer program or a computer instruction, and the computer program or the computer instruction executes the method described above when executed by a processor.

[0108] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. 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.

[0109] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are only schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, a program segment or a code, and a part of a module, a program segment or a code includes one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also be different from the order of occurrence marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which is mainly determined by the functions involved.

[0110] In addition, each functional module of each embodiment in the embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the description of reference terms "one embodiment", "some embodiments", "example", "specific example", "some examples", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present application. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples without contradiction.

[0111] The above description is only an optional implementation manner of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiments of the present application, which should be covered within the protection scope of the embodiments of the present application.

Claims

1. A question-answering method, characterized in that: include: Obtaining a question request, and converting the question request into a question vector; Querying a candidate document list from a vector document library according to a similarity value between a document vector and the question vector, wherein the vector document library includes: documents and their corresponding document vectors; Obtaining personalized information of a current user corresponding to the question request, and filtering the candidate document list according to the personalized information of the current user to obtain a filtered document list; Generate prompt text according to the filtered document list, the question request, and the keyword; The prompt text is processed by a large language model to obtain an answer result corresponding to the question request.

2. The method according to claim 1, characterized in that The step of converting the question request into a question vector includes: Extracting a keyword from the question request using the large language model; The subject word is vectorized to obtain the question vector.

3. The method according to claim 2, characterized in that Before querying the candidate document list from the vector document library according to the similarity value between the document vector and the question vector, the method further includes: Obtain multiple original documents; For each original document among the multiple original documents, perform vectorization processing on the original document to obtain a document vector of the original document; For each original document among the plurality of original documents, the document vector of the original document is associated with the original document and stored in the vector document library.

4. The method according to claim 1, characterized in that The obtaining of personalized information of the current user corresponding to the question request includes: Parsing the personalized information of the current user from the question request; Alternatively, the user ID of the current user is parsed from the question request, and personalized information corresponding to the user ID is queried.

5. The method according to claim 1, characterized in that The filtering the candidate document list according to the personalized information of the current user includes: For each candidate document in the candidate document list, score the candidate document using a personalized scoring model according to the personalized information of the current user to obtain a personalized score of the current user, wherein the personalized score represents a probability value of the user clicking on the candidate document; The multiple candidate documents in the candidate document list are filtered according to the personalized scores.

6. The method according to claim 5, characterized in that Before using the personalized scoring model to score the candidate document according to the personalized information of the current user, the method further includes: Get personalized information for multiple users; For each user among the multiple users, extract the personalized features of the user from the personalized information of the user to obtain the personalized features of the multiple users; The personalized scoring model is trained using the document vectors in the vector document library and the personalized features of the multiple users as training data, the candidate documents that have been clicked in the vector document library as positive sample labels, and the candidate documents that have not been clicked in the vector document library as negative sample labels.

7. The method according to claim 5, characterized in that The using a personalized scoring model to score the candidate document according to the personalized information of the current user includes: Obtaining a document vector corresponding to the candidate document, and extracting personalized features of the current user from the personalized information of the current user; The document vector corresponding to the candidate document and the personalized feature of the current user are input into the personalized scoring model, so that the personalized scoring model outputs the personalized score of the current user.

8. The method according to claim 7, characterized in that The personalized information includes: historical behavior logs and social engineering information; the extraction of personalized features of the current user from the personalized information of the current user includes: Extracting historical behavior features of the current user from the historical behavior log of the current user; The social engineering features of the current user are extracted from the social engineering information of the current user.

9. A question-answering device, characterized in that: include: A question request conversion module, used to obtain a question request and convert the question request into a question vector; A document list query module, used to query a candidate document list from a vector document library according to a similarity value between a document vector and the question vector, wherein the vector document library includes: documents and their corresponding document vectors; A document list filtering module, used to obtain personalized information of the current user corresponding to the question request, and filter the candidate document list according to the personalized information of the current user to obtain a filtered document list; A prompt text generation module, used to generate a prompt text according to the filtered document list, the question request, and the keyword; The answer result obtaining module is used to process the prompt text through a large language model to obtain the answer result corresponding to the question request.

10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions are executed by the processor to perform any method according to claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.

12. A computer program product, characterized in that include: A computer program or a computer instruction, wherein when the computer program or the computer instruction is executed by a processor, the method according to any one of claims 1 to 8 is executed.