Intelligent question and answer method and system based on large language model and electronic device
By using an intelligent question-answering method based on a large language model, and leveraging semantic fine-tuning models and multi-turn interaction strategies, the problem of low efficiency and resource waste caused by manual answers in on-site services at vehicle management offices has been solved. This enables real-time and personalized user consultation and process guidance, thereby improving efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DUOLUN TECH CO LTD
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-05
Smart Images

Figure CN122152986A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large language model application technology, specifically to an intelligent question-answering method, system, and electronic device based on a large language model. Background Technology
[0002] Currently, a large number of users visit vehicle management offices to handle vehicle registration, driver's license renewal, and traffic violation processing. These services are complex and require strict procedures. Users commonly need to consult about procedures, required documents, window locations, and policy regulations. The traditional service model of vehicle management offices relies primarily on staff at the information desk to provide on-site answers and guidance. However, this model has significant shortcomings: firstly, the daily volume of customers at vehicle management offices is high, but the number of dedicated staff is limited, making it difficult to meet the immediate consultation needs of a large number of users during peak hours, resulting in long waiting times and poor efficiency and experience; secondly, user inquiries are highly repetitive and predictable, such as basic questions about required document lists and form completion guidelines. Staff must provide numerous repetitive answers daily, leading to heavy workloads, fatigue, and inefficient use of human resources.
[0003] Although some vehicle management offices have introduced electronic displays, static signs, or simple self-service inquiry terminals in recent years, these devices all have drawbacks such as untimely information updates, inflexible interaction, and inability to provide precise guidance based on users' individual circumstances. In addition, while some online government service platforms or mobile applications can provide information inquiries, they are not convenient and practical enough for groups unfamiliar with the operation of smart devices, such as the elderly, or users who need to make inquiries based on real-time on-site conditions. Furthermore, some online information cannot be confirmed and applied in a timely and contextualized manner on-site, resulting in a break in the service chain.
[0004] Therefore, there is an urgent need to develop an automated solution that can perform professional natural language interaction at the service site, understand user intent, answer vehicle management business questions in real time and accurately, and provide process guidance services. This solution can not only alleviate the continuous shortage of manpower in service agencies, but also effectively shorten the time for users to handle affairs and improve the efficiency and intelligence level of public services. Summary of the Invention
[0005] 1. The technical problem that the invention aims to solve
[0006] In existing vehicle management office on-site service scenarios, the main reliance is on staff to answer questions and process transactions. With the increasing volume of customers, this reliance on manual service leads to long waiting times, low service efficiency, high labor costs, and poor customer satisfaction. Therefore, this invention aims to utilize a large language model to accurately understand user intent, prioritizing the resolution of issues that can be handled directly by intelligent devices. This not only reduces user waiting times and improves transaction efficiency but also allows staff to focus on transactions requiring manual processing, thus improving the efficiency of human resource utilization.
[0007] 2. Technical Solution To achieve the above objectives, the present invention proposes the following technical solution: In a first aspect, the present invention provides an intelligent question-answering method based on a large language model, comprising: Collect a number of user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein, the user questions are conversational questions; For any user question in the user question set under each business type, determine the corresponding written question, and establish a set of positive and negative sample pairs based on the written question; Based on the set of positive and negative sample pairs, a semantic vector model is trained using a contrastive learning method to obtain a semantic fine-tuning model; Real-time user questions are obtained, semantic features are extracted using a semantic fine-tuning model, and the semantic features are matched with a preset question feature set; wherein, the preset question feature set is constructed by extracting semantic features from several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on each written question; The system selects and displays written questions corresponding to the TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding answer content; where N1 is an integer greater than 2. That is, the preset question matching is prioritized for real-time user questions, and the preset questions are usually questions that users ask or consult frequently in the application scenario of the method; in addition, the preset question feature set includes extracted features of user questions generated according to a preset knowledge base and extracted features of user questions collected before model training.
[0008] Furthermore, it also includes: When the matching degree between the semantic feature and each feature of the preset question feature set is less than the first threshold, then the document content related to the real-time user question is searched in the general knowledge document based on the real-time user question. Calculate the relevance of each document content searched to the real-time user question, and output the TOPN2 segments of document content with a relevance of not less than the second threshold; where N2 is an integer and not less than 1; Based on a large language model, the content of the TOPN2 document segments is understood to generate answers to the real-time user questions corresponding to the semantic features. Specifically, when a real-time user question exceeds a preset question range, the large language model is used to match relevant content from general knowledge documents to summarize the answer.
[0009] Furthermore, it also includes: When the relevance of the document content searched in the general knowledge document to the real-time user question is lower than the second threshold, the real-time user question is analyzed and judged to be complete. When the real-time user question is incomplete, the big language model generates and returns a rhetorical question to clarify the user's intent based on preset prompt words, so that after obtaining complete consultation information, semantic features can be extracted to match the preset question feature set, search in the general knowledge document, or generate answer content on its own. When the real-time user question is complete, the large language model automatically generates and returns the answer to the real-time user question. That is, when neither the preset question feature set nor the general knowledge document can answer the user question, two solutions are proposed: one is to use the large language model to intelligently ask a follow-up question to complete the question before answering it; the other is to directly answer the question based on the large model's own knowledge reserves.
[0010] Furthermore, the process of searching for document content related to the real-time user question in a general knowledge document includes: After converting the general knowledge document into the target format, it is segmented into paragraphs to form independent segmented documents; For any segment of the segmented document, convert it into vectorized data and store it in a vector database; After converting the real-time user question into a semantic vector, similarity calculation is performed in the vector database to obtain TOPN2 paragraph documents with a relevance of not less than the second threshold.
[0011] Furthermore, the process of training a semantic vector model using contrastive learning to obtain a semantically fine-tuned model also includes: The semantic vector model is fine-tuned using the cross-entropy loss function, which is: , in, S i,j It is the first i The question and the first j The similarity score of the first colloquial question; N represents the similarity score of the first...i The total number of conversational questions constructed from each question; It is a temperature coefficient, with a value ranging from 0 to 1. That is, the semantic vector model uses the cross-entropy loss function to increase the similarity of positive sample pairs and decrease the similarity of negative sample pairs.
[0012] Furthermore, the large language model generates and returns rhetorical questions to clarify the user's intent based on preset prompts, so that the number of question-and-answer rounds to obtain complete consultation information does not exceed 10 rounds.
[0013] In a second aspect, the present invention proposes an intelligent question-answering system based on a large language model, comprising: A collection module is used to collect several user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein, the user questions are conversational questions; The module is defined to determine the written question corresponding to any user question in the user question set under each business type, and to establish a set of positive and negative sample pairs based on the written question. The model training module is used to train the semantic vector model using a contrastive learning method based on the set of positive and negative sample pairs, and obtain a semantic fine-tuning model. The extraction and matching module is used to obtain real-time user questions, extract semantic features using a semantic fine-tuning model, and match the semantic features with a preset question feature set; wherein, the preset question feature set is constructed by extracting semantic features from several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on the written questions; The feedback and response module is used to select and display written questions corresponding to the TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding response content; where N1 is an integer and greater than 2.
[0014] Optionally, the preset problem feature set is updated in real time based on real-time user problems.
[0015] Furthermore, it also includes: The judgment search module is used to search for document content related to the real-time user question in the general knowledge document based on the real-time user question when the matching degree between the semantic feature and each feature of the preset question feature set is less than the first threshold. The calculation output module is used to calculate the relevance of each document content searched to the real-time user question, and output the TOPN2 segments of document content with a relevance of not less than the second threshold; where N2 is an integer and not less than 1; The understanding and generation module is used to understand the content of the TOPN2 document segments based on the large language model and generate the answer content of the real-time user question corresponding to the semantic features.
[0016] Optionally, the general knowledge document is updated in real time after any policy release or process modification.
[0017] Furthermore, it also includes: The question-and-answer module is used to analyze and determine whether the real-time user question is complete when the relevance of the document content searched in the general knowledge document to the real-time user question is lower than a second threshold. When the real-time user question is incomplete, the large language model generates and returns a question-and-answer statement to clarify the user's intent based on preset prompt words, so that after obtaining complete consultation information, semantic features can be extracted to match the preset question feature set, and the answer content can be searched in the general knowledge document or generated automatically. The answer generation module is used to automatically generate and return the answer content for the real-time user question when the real-time user question is complete.
[0018] Furthermore, the process by which the search module searches for document content related to the real-time user question in general knowledge documents includes: After converting the general knowledge document into the target format, it is segmented into paragraphs to form independent segmented documents; For any segment of the segmented document, convert it into vectorized data and store it in a vector database; After converting the real-time user question into a semantic vector, similarity calculation is performed in the vector database to obtain TOPN2 paragraph documents with a relevance of not less than the second threshold.
[0019] Furthermore, the model training module also includes: The semantic vector model is fine-tuned using the cross-entropy loss function, which is: , in, S i,j It is the first i The question and the first j The similarity score of the first colloquial question; N represents the similarity score of the first... i The total number of conversational questions constructed from each question; It is the temperature coefficient, with a value ranging from 0 to 1.
[0020] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the intelligent question-answering method based on a large language model proposed in the first aspect of the present invention.
[0021] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a computer program that, when run on a computer, causes the computer to execute the intelligent question-answering method based on a large language model proposed in the first aspect of the present invention.
[0022] 3. Beneficial effects The intelligent question-answering method, system, and electronic device based on a large language model disclosed in this invention have achieved the following beneficial effects: (1) The intelligent question-answering method proposed in this invention greatly improves the efficiency of on-site services through real-time and accurate business flow guidance. When this method is deployed in the intelligent equipment of the service hall, it realizes the instant and structured access to vehicle management business knowledge. First, the solution trains the semantic fine-tuning model by pre-surveying user concerns to determine positive and negative sample pairs. Then, after obtaining real-time user questions, it can quickly and accurately understand the user's intent and provide the corresponding answer content to the user. Second, the solution integrates the business rules, material list and process logic of the vehicle management office by pre-setting the question feature set. The large language model generates questions that the user may ask. Based on the questions, it provides a complete and step-by-step processing process and an accurate and up-to-date material list. When the understood user intent matches the semantic features in the pre-set question feature set, it directly outputs the consultation answer, operation steps, the latest material list and other content, directly avoiding the phenomenon of low efficiency caused by users having to go back and forth multiple times or being blocked in line at the window due to unclear information. Third, this invention provides a general knowledge document. When the user's question cannot find a corresponding question in the pre-set question feature set, the question is directly matched through the general knowledge document and the answer content is generated by the large language model, which can also ensure that the user is provided with real-time and reliable answer information.
[0023] (2) The intelligent question-answering method proposed in this invention can guide users to explore their true intentions through intelligent counter-questioning when some users fail to ask complete questions, and then conduct a response process of question matching or general knowledge document search, or directly reply by the large language model based on its knowledge reserves. The method of this invention aims to quickly answer simple immediate consultation questions and regular questions in government or business office scenarios with increasing reception volume, such as vehicle management office scenarios, systematically save users' time, reduce queuing time, and significantly alleviate congestion in the hall.
[0024] (3) In its specific implementation, the intelligent question-answering method proposed in this invention does not only rely on a large language model to answer user questions, but also first identifies the true intent corresponding to the user's question through the model, and simultaneously combines the pre-established structured knowledge base and the large language model to work together to directly retrieve or understand and generate answers. That is, the large language model in the core of the solution is only used to optimize the naturalness of semantic understanding and interaction, rather than directly generating core business content; this mechanism fundamentally eliminates information distortion, and at the same time eliminates the need for expensive domain fine-tuning and high-frequency updates to the large language model, greatly saving computing resources, data annotation costs and long-term maintenance expenses, and achieving both economy and feasibility while ensuring the highest accuracy.
[0025] (4) When a user's question is incomplete, the intelligent question-answering method proposed in this invention adopts a multi-round guided interaction strategy to intelligently deconstruct ambiguous needs, achieving barrier-free and accessible consultation. For users who are unfamiliar with the business and cannot clearly express their needs, this solution proposes an intelligent multi-round questioning and guidance mechanism. Through preset prompts, such as business type, vehicle / personnel certificate status, and purpose of handling, it proactively initiates structured and selective questions, gradually guiding users to complete their questions and gradually transforming open-ended questions into closed-ended choices. Through progressive interaction, it not only greatly reduces the user's expression burden and cognitive threshold, ensuring rapid identification of real needs, but also effectively avoids misjudgments and invalid answers caused by ambiguous questions, enabling any user to easily and efficiently obtain personalized guidance services, greatly improving practicality and convenience.
[0026] (5) The intelligent question-answering method proposed in this invention combines a large language model for intelligent interaction. When deployed on intelligent devices, it can not only alleviate the shortage of manpower in government agencies and shorten the time for users to handle affairs, but also effectively improve the efficiency and intelligence level of public services in the business handling process.
[0027] It should be understood that all combinations of the foregoing concepts and the additional concepts described in more detail below can be considered part of the inventive subject matter of this disclosure, provided that such concepts do not contradict each other.
[0028] The foregoing and other aspects, embodiments, and features of the teachings of the present invention will be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the invention, such as features and / or beneficial effects of exemplary embodiments, will become apparent from the following description or may be learned through practice of specific embodiments according to the teachings of the present invention. Attached Figure Description
[0029] The accompanying drawings are not drawn to scale. In the drawings, each identical or nearly identical component shown in the various figures may be denoted by the same reference numeral. For clarity, not every component is labeled in each figure. Embodiments of various aspects of the invention will now be described by way of example and with reference to the accompanying drawings, wherein: Figure 1 The flowchart of the intelligent question answering method disclosed in this invention for matching a preset question feature set is shown below; Figure 2 A flowchart for matching general knowledge documents to the intelligent question-answering method disclosed in this invention; Figure 3 This is a flowchart illustrating the intelligent question-and-answer method disclosed in this invention, which allows for intelligent questioning or automatic answer generation. Figure 4 This is a flowchart illustrating the specific application of the intelligent question-answering method disclosed in this invention. Figure 5 This is a structural block diagram of the intelligent question-answering system based on a large language model disclosed in this invention; Figure 6 This is an example diagram of an electronic device proposed in an embodiment of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art to which this invention pertains.
[0031] The terms "first," "second," and similar words used in the specification and claims of this patent application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, unless the context clearly indicates otherwise, the singular forms of "an," "a," or "the," etc., do not indicate a quantity limitation, but rather indicate the presence of at least one. Terms such as "comprising" or "including" mean that the element or object preceding "comprising" encompasses the features, integrals, steps, operations, elements, and / or components listed following "comprising" or "including," and do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.
[0032] This invention aims to address the problems of long waiting times, low efficiency, and poor user experience in current service scenarios such as vehicle management offices, where manual processing is the primary method. These problems arise during peak hours, and the highly repetitive and predictable nature of user questions leads to inefficient use of staff resources. The invention proposes an intelligent question-answering method based on a large language model. When configured on intelligent devices in the venue, this method combines a pre-set set of question features and general knowledge documents with the large language model to provide the most accurate and reliable responses to real-time user questions. This not only effectively reduces queuing rates, improves efficiency and staff utilization, but also enhances the intelligence, convenience, and practicality of the service process.
[0033] The intelligent question-answering method, system, and electronic device based on a large language model disclosed in this invention will be further described in detail below with reference to the specific embodiments shown in the accompanying drawings.
[0034] Combination Figure 1 As shown in the embodiments of the present invention, the intelligent question-answering method based on a large language model includes the following steps: Step S102: Collect a number of user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein, the user questions are colloquial questions; User questions are collected in advance at the service site. For example, users are asked to ask questions based on different business transactions. The actual questions and methods of users are recorded, especially the different ways different users ask the same thing, that is, to obtain different colloquial questions about the same issue.
[0035] Step S104: For any user question in the user question set under each business type, determine the written question corresponding to the user question, and establish a positive and negative sample pair set based on the written question; wherein, the positive sample pair is the written question and the colloquial question that is consistent with the actual needs of the written question, and the negative sample pair is the written question and the colloquial question that is inconsistent with the actual needs of the written question. Typically, user questions categorized by business type are mapped one-to-one between colloquial and written questions and then compiled into an Excel spreadsheet. Subsequently, a data format conversion program transforms the colloquial and written questions into a data format suitable for model training, usually JSONL. Categorizing by business type helps quickly identify relevant content within a pre-defined question feature set and general knowledge documents, pinpointing the user's true intent.
[0036] Step S106: Based on the set of positive and negative sample pairs, a semantic vector model is trained using a contrastive learning method to obtain a semantic fine-tuning model; in this scheme, the semantic vector model is selected as the Bge-M3 model. In specific implementation, it also includes: fine-tuning the semantic vector model using the cross-entropy loss function, wherein the cross-entropy loss function is: , in, S i,j It is the first i The question and the first j The similarity score of the first colloquial question; N represents the similarity score of the first... i The total number of conversational questions constructed from each question; It is a temperature coefficient, with a value ranging from 0 to 1. That is, the semantic vector model uses the cross-entropy loss function to increase the similarity of positive sample pairs and decrease the similarity of negative sample pairs.
[0037] Step S108: Obtain real-time user questions, extract semantic features using a semantic fine-tuning model, and match the semantic features with a preset question feature set; wherein, the preset question feature set is constructed by extracting semantic features from several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on the written questions, using the semantic fine-tuning model. In this embodiment, semantic features are a digital representation of user needs represented by a vector.
[0038] The pre-defined knowledge base is a professional knowledge base specific to the application scenario of the method. For example, when the solution of this invention is applied to a vehicle management office, the pre-defined knowledge base mainly consists of various documents related to the business of the vehicle management office, such as vehicle knowledge, vehicle safety knowledge, vehicle document knowledge, vehicle driving knowledge, and vehicle accident handling knowledge. Optionally, in addition to user questions generated by the large language model, the pre-defined question feature set also includes user questions and written question pairs collected in advance for model training.
[0039] Step S110: Select and display the written questions corresponding to the TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding answer content; where N1 is an integer greater than 2, and TOPN1 represents the top N1 features after sorting all features with a matching degree of not less than the first threshold from high to low matching degree; optionally, the first threshold is not less than 60%. That is, preset question matching is prioritized for real-time user questions, which are usually questions frequently asked or consulted by users in the application scenario of the method; in addition, the preset question feature set includes extracted features of user questions generated according to a preset knowledge base and extracted features of user questions collected before model training. Of course, when only one written question corresponding to the TOPN1 features with a matching degree of not less than the first threshold is matched in the preset question feature set, a confirmation box for the written question will pop up directly on the display interface so that the user can directly display the answer content or enter the search of general knowledge documents after confirming or denying.
[0040] Optionally, if a real-time user question does not match a corresponding content in the preset question feature set, the semantic features extracted from the positive sample pair consisting of the real-time user question and the corresponding written question will be added to the preset question feature set to enrich the question database so that the corresponding answer can be directly retrieved and fed back when the user asks the same question again.
[0041] When a real-time user question does not match the target in the question database corresponding to the preset question feature set, a structured knowledge base is further utilized to retrieve and respond to the user question; specifically, as follows... Figure 2 As shown, the process includes: Step S202, when the matching degree between the semantic features and each feature of the preset question feature set is less than a first threshold, then searching for document content related to the real-time user question in general knowledge documents based on the real-time user question; wherein the general knowledge documents include, but are not limited to, documents related to various vehicle management office businesses such as vehicle knowledge, vehicle safety knowledge, vehicle document knowledge, vehicle driving knowledge, and vehicle accident handling knowledge, and also include publicly available laws and regulations related to vehicles online. Step S204, calculating the relevance of each searched document content to the real-time user question, and outputting the TOPN2 segments of document content with a relevance not lower than a second threshold; wherein N2 is an integer and not less than 1, TOPN2 represents the top N2 segments of document content after sorting all document content with a relevance not lower than the second threshold from high to low; optionally, the relevance of document content to the real-time user question can be determined by calculating similarity, and the second threshold is not less than 60%. Step S208, understanding the TOPN2 segments of document content based on a large language model, and generating the answer content of the real-time user question corresponding to the semantic features. That is, when real-time user questions exceed the preset question range, a large language model is used to match relevant content in general knowledge documents, thereby summarizing the answers to the real-time user questions after understanding them. Optionally, to ensure the accuracy of relevant documents, the value of N² should preferably be no less than 2.
[0042] Optionally, the process of searching for document content related to the real-time user question in a general knowledge document includes: converting the general knowledge document into a target format and then segmenting it into independent segmented documents; for example, converting any document in the general knowledge document into a Word document or PDF format, and then segmenting it into paragraphs using symbols or pagination to form segments of document. For any segment of the segmented document, converting it into vectorized data and storing it in a vector database; the vector database is pre-built and updated synchronously according to updates to the general knowledge document. After converting the real-time user question into a semantic vector, performing similarity calculation in the vector database to obtain TOPN2 segments of document with a relevance not lower than a second threshold.
[0043] In most cases, matching preset question feature sets with general knowledge documents can solve most user problems. During peak hours, it can quickly and accurately answer user questions, guide users to complete business transactions quickly without queuing or prepare business materials in advance, reduce manual business processing time, and improve business processing efficiency and staff utilization efficiency.
[0044] When a real-time user question cannot be answered because no relevant content is found in the pre-defined structured knowledge base, the method further determines whether the real-time user question is complete and then uses a large language model to intelligently ask a follow-up question or directly understand and respond; specifically, as follows... Figure 3 As shown, the process includes: Step S302, when the relevance of the document content searched in the general knowledge document to the real-time user question is lower than a second threshold, the system analyzes and determines whether the real-time user question is complete. If the real-time user question is incomplete, the large language model generates and returns a rhetorical question to clarify the user's intent based on preset prompts, so that semantic features can be extracted to match a preset question feature set after obtaining complete consultation information, or the system can search in the general knowledge document or generate its own answer content. Optionally, multiple rhetorical questions are displayed and selected by the user to gradually determine the user's true intent. Step S304, when the real-time user question is complete, the large language model automatically generates and returns an answer to the real-time user question. That is, when neither the preset question feature set nor the general knowledge document can answer the user question, two solutions are proposed: one is to use the large language model to intelligently ask rhetorical questions to complete the question before answering it; the other is to directly answer the question based on the large model's own knowledge reserves.
[0045] Optionally, the large language model generates and returns rhetorical questions to clarify the user's intent based on preset prompts, ensuring that the number of question-and-answer rounds to obtain complete consultation information does not exceed 10 rounds. If a complete user question is not obtained after 10 rounds, the large language model directly understands the question and generates an answer based on its own knowledge reserves. Optionally, the process of analyzing and judging whether the real-time user question is complete can also be accomplished by controlling the large language model through prompts.
[0046] Combination Figure 4 As shown, for real-time user questions that do not appear in the preset knowledge base corresponding to the preset question feature set, nor in the general knowledge base composed of general knowledge documents, the large language model analyzes and understands the user questions under the guidance of prompt words. For example, if the real-time user question only contains "driver's license" and no other information, the large language model should ask the user what specific aspect of the driver's license they want to inquire about, in order to ensure the completeness and coherence of the communication information.
[0047] Optionally, the preset knowledge base and the general knowledge base are kept updated in real time to ensure that users are provided with real-time and reliable answers, avoiding the problem of missing information requiring multiple trips during manual business processing.
[0048] Based on the same inventive concept as the above-described method embodiments, embodiments of this application also provide an intelligent question-answering system based on a large language model, such as... Figure 5 The diagram shows a framework of an intelligent question-answering system based on a large language model. Figure 5 The intelligent question-answering system includes: a collection and construction module, used to collect several user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein the user questions are colloquial questions; a determination and establishment module, used to determine the corresponding written question for any user question in the user question set for each business type, and establish a positive and negative sample pair set based on the written question; a model training module, used to train a semantic vector model using a contrastive learning method based on the positive and negative sample pair set, and obtain a semantic fine-tuning model; and an extraction and matching module, used to obtain real-time user questions. A semantic fine-tuning model is used to extract semantic features, and the semantic features are matched with a preset question feature set. The preset question feature set consists of several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on the written questions, after the semantic fine-tuning model extracts semantic features. A feedback and answer module is used to select and display the written questions corresponding to the TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding answer content. Here, N1 is an integer greater than 2.
[0049] The steps of the system for implementing the intelligent question-answering method based on a large language model disclosed in the above embodiments have already been described and will not be repeated here.
[0050] For example, the intelligent question-answering system based on a large language model further includes, when a corresponding question cannot be matched in a preset question feature set, searching for content related to the real-time user question in a general knowledge document to generate answer content; specifically, it includes the following working modules: a judgment search module, used to search for document content related to the real-time user question in a general knowledge document based on the real-time user question when the matching degree between the semantic features and each feature of the preset question feature set is less than a first threshold; a calculation output module, used to calculate the relevance of each searched document content to the real-time user question, and output TOPN2 segments of document content with a relevance not lower than a second threshold; where N2 is an integer and not less than 1; and an understanding generation module, used to understand the TOPN2 segments of document content based on the large language model and generate answer content for the real-time user question corresponding to the semantic features.
[0051] For example, the intelligent question-answering system based on a large language model further includes a module that, when searching general knowledge documents and finding document content tagged with relevance to the real-time user question, performs intelligent counter-questioning to determine the user's intent by judging the completeness of the question, or allows the large language model to answer the user question automatically based on its knowledge reserves. Specifically, it includes: a counter-questioning judgment module, used to analyze and judge whether the real-time user question is complete when the relevance of the document content searched in the general knowledge documents to the real-time user question is all below a second threshold; and when the real-time user question is incomplete, the large language model generates and returns a counter-question statement to clarify the user's intent based on preset prompt words, so that after obtaining complete consultation information, semantic features can be extracted to match a preset question feature set, and the answer content can be searched in the general knowledge documents or generated automatically; and an answer generation module, used to generate and return an answer content for the real-time user question automatically when the real-time user question is complete.
[0052] For example, the process by which the aforementioned judgment and search module searches for document content related to the real-time user question in a general knowledge document includes: converting the general knowledge document into a target format and then segmenting it into independent segmented documents; converting any segment of the segmented document into vectorized data and storing it in a vector database; converting the real-time user question into a semantic vector and then performing similarity calculation in the vector database to obtain TOPN2 segmented documents with a relevance of not less than a second threshold.
[0053] For example, the model training module mentioned above also includes: fine-tuning the semantic vector model using a cross-entropy loss function, wherein the cross-entropy loss function is: , in, S i,jIt is the first i The question and the first j The similarity score of the first colloquial question; N represents the similarity score of the first... i The total number of conversational questions constructed from each question; It is the temperature coefficient, with a value ranging from 0 to 1.
[0054] In summary, this invention, through the collaborative working model of semantic fine-tuning model, structured knowledge base, and large language model, accurately identifies the real needs expressed by users in real-time questions. Then, through a process of matching preset question feature sets, searching general knowledge documents, and intelligent questioning or self-answering by the large language model, it provides targeted services to different users. This not only intelligently provides users with real-time and reliable information, but also greatly facilitates user consultation and significantly improves business processing efficiency and human resource utilization.
[0055] Based on the same inventive concept as the above-described method embodiments, another embodiment of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the intelligent question-answering method based on a large language model disclosed in the above embodiments.
[0056] In one embodiment, the electronic device may be a server; in this embodiment, the structure of the electronic device may be as follows: Figure 6 As shown, it includes a memory 201, a communication module 203, and one or more processors 202.
[0057] The memory 201 is used to store computer programs executed by the processor 202. The memory 201 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0058] Memory 201 may be volatile memory, such as random-access memory (RAM); memory 201 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 201 may be any other medium capable of carrying or storing a desired computer program having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 201 may be a combination of the above-described memories.
[0059] The processor 202 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 202 is used to implement the aforementioned audio data processing method when calling a computer program stored in the memory 201.
[0060] The communication module 203 is used to communicate with terminal devices and other servers.
[0061] This application embodiment does not limit the specific connection medium between the memory 201, communication module 203, and processor 202 described above. This application embodiment... Figure 6 The memory 201 and the processor 202 are connected via a bus 204, and the bus 204 is in Figure 6 The connections between other components are illustrated with arrows and are for illustrative purposes only, not as limiting information. Bus 204 can be divided into address bus, data bus, control bus, etc. For ease of description, Figure 6 The text uses only one arrow to describe it, but does not indicate that there is only one bus or one type of bus.
[0062] Based on the same inventive concept as the above-described method embodiments, embodiments of the present invention also provide a computer-readable storage medium for storing a computer program. When the computer program is run on a computer, it enables the electronic device to implement the intelligent question-answering method based on a large language model as described in the above embodiments. The computer-readable storage medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a magnetic disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0063] Based on the same inventive concept as the above-described method embodiments, embodiments of the present invention also provide a computer program product, which includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of the intelligent question-answering method based on a large language model according to various exemplary embodiments of this application described above. The program product may take the form of any combination of one or more readable media. These computer program commands can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the commands executed by the processor of the computer or other programmable data processing device generate a process for implementing... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0064] While the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the claims.
Claims
1. An intelligent question-answering method based on a large language model, characterized in that, include: Collect a number of user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein, the user questions are conversational questions; For any user question in the user question set under each business type, determine the corresponding written question, and establish a set of positive and negative sample pairs based on the written question; Based on the set of positive and negative sample pairs, a semantic vector model is trained using a contrastive learning method to obtain a semantic fine-tuning model; Real-time user questions are obtained, semantic features are extracted using a semantic fine-tuning model, and the semantic features are matched with a preset question feature set; wherein, the preset question feature set is constructed by extracting semantic features from several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on each written question; The system selects and displays written questions corresponding to TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding answer content; where N1 is an integer and greater than 2.
2. The intelligent question-answering method based on a large language model according to claim 1, characterized in that, Also includes: When the matching degree between the semantic feature and each feature of the preset question feature set is less than the first threshold, then the document content related to the real-time user question is searched in the general knowledge document based on the real-time user question. Calculate the relevance of each document content searched to the real-time user question, and output the TOPN2 segments of document content with a relevance of not less than the second threshold; where N2 is an integer and not less than 1; Based on the large language model, the content of the TOPN2 document segments is understood to generate the answer content of the real-time user question corresponding to the semantic features.
3. The intelligent question-answering method based on a large language model according to claim 2, characterized in that, Also includes: When the relevance of the document content searched in the general knowledge document to the real-time user question is lower than the second threshold, the real-time user question is analyzed and judged to be complete. When the real-time user question is incomplete, the big language model generates and returns a rhetorical question to clarify the user's intent based on preset prompt words, so that after obtaining complete consultation information, semantic features can be extracted to match the preset question feature set, search in the general knowledge document, or generate answer content on its own. When the real-time user question is complete, the large language model automatically generates and returns the answer to the real-time user question.
4. The intelligent question-answering method based on a large language model according to claim 2, characterized in that, The process of searching for document content related to the real-time user question in a general knowledge document based on the real-time user question includes: After converting the general knowledge document into the target format, it is segmented into paragraphs to form independent segmented documents; For any segment of the segmented document, convert it into vectorized data and store it in a vector database; After converting the real-time user question into a semantic vector, similarity calculation is performed in the vector database to obtain TOPN2 paragraph documents with a relevance of not less than the second threshold.
5. The intelligent question-answering method based on a large language model according to claim 1, characterized in that, The process of training a semantic vector model using contrastive learning to obtain a semantically fine-tuned model also includes: The semantic vector model is fine-tuned using the cross-entropy loss function, which is: , in, S i,j It is the first i The question and the first j The similarity score of the first colloquial question; N represents the similarity score of the first... i The total number of conversational questions constructed from each question; It is the temperature coefficient, with a value ranging from 0 to 1.
6. An intelligent question-answering system based on a large language model, characterized in that, include: A collection module is used to collect several user questions, classify the user questions according to business type, and construct a user question set for each business type; wherein, the user questions are conversational questions; The module is defined to determine the written question corresponding to any user question in the user question set under each business type, and to establish a set of positive and negative sample pairs based on the written question. The model training module is used to train the semantic vector model using a contrastive learning method based on the set of positive and negative sample pairs, and obtain a semantic fine-tuning model. The extraction and matching module is used to obtain real-time user questions, extract semantic features using a semantic fine-tuning model, and match the semantic features with a preset question feature set; wherein, the preset question feature set is constructed by extracting semantic features from several written questions generated by a large language model based on a preset knowledge base, and several spoken questions constructed based on the written questions; The feedback and response module is used to select and display written questions corresponding to the TOPN1 features with a matching degree of not less than a first threshold from the preset question feature set, so that the user can select the written question corresponding to the real-time user question and output the corresponding response content; where N1 is an integer and greater than 2.
7. The intelligent question-answering system based on a large language model according to claim 6, characterized in that, Also includes: The judgment search module is used to search for document content related to the real-time user question in the general knowledge document based on the real-time user question when the matching degree between the semantic feature and each feature of the preset question feature set is less than the first threshold. The calculation output module is used to calculate the relevance of each document content searched to the real-time user question, and output the TOPN2 segments of document content with a relevance of not less than the second threshold; where N2 is an integer and not less than 1; The understanding and generation module is used to understand the content of the TOPN2 document segments based on the large language model and generate the answer content of the real-time user question corresponding to the semantic features.
8. The intelligent question-answering system based on a large language model according to claim 6, characterized in that, Also includes: The question-and-answer module is used to analyze and determine whether the real-time user question is complete when the relevance of the document content searched in the general knowledge document to the real-time user question is lower than a second threshold. When the real-time user question is incomplete, the large language model generates and returns a question-and-answer statement to clarify the user's intent based on preset prompt words, so that after obtaining complete consultation information, semantic features can be extracted to match the preset question feature set, and the answer content can be searched in the general knowledge document or generated automatically. The answer generation module is used to automatically generate and return the answer content for the real-time user question when the real-time user question is complete.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it enables the electronic device to implement the intelligent question-answering method based on a large language model as described in any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when run on a computer, causes the computer to perform the intelligent question-answering method based on a large language model as described in any one of claims 1 to 5.