Question and answer method and device, computer equipment and readable storage medium
By compressing parameters and extracting word slot parameters on the large language model, standardized question text is generated, and the problem of slow inference speed of traditional question-and-answer systems is solved, and an efficient and accurate question-and-answer system is realized.
Patent Information
- Application Number
- CN202411721146.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-14
AI Technical Summary
Traditional question and answer systems use large language models to require a large amount of computing resources and storage space, resulting in slow inference speed.
By compressing the model parameters of the large language model, a quantized language model is obtained, and combined with word slot parameter extraction and standardized question text generation, the inference speed of the question-and-answer system is improved.
It significantly reduces the requirements of computing resources and storage space, improves the inference speed of the Q&A system, and maintains the accuracy of the answers.
Smart Images

Figure CN119621904A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a question-answering method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] A knowledge-based question-answering system is a system that directly generates accurate answers by mapping user questions into a structured knowledge base. Natural language processing is a technology that studies how computers understand, generate, and process human language. It is the core technology of knowledge-based question-answering systems, providing the system with capabilities such as semantic parsing, intent recognition, and text generation. However, traditional question-answering systems usually use large language models (LLMs) to reason and answer user questions. Then, directly deploying these large language models requires a lot of computing resources and storage space, resulting in slow reasoning. Summary of the invention
[0003] Based on this, it is necessary to provide a question-answering method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the reasoning speed of the question-answering system in response to the above technical problems.
[0004] In a first aspect, the present application provides a question-answering method, comprising:
[0005] Inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include description information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model;
[0006] Inputting the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention;
[0007] Inputting the standardized question text into a vector model to obtain a number of documents with the highest degree of relevance to the standardized question text;
[0008] The standardized question text and the plurality of documents are input into the quantized language model to obtain an answer text generated by answering the initial question text.
[0009] In one embodiment, the step of inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text includes:
[0010] Inputting the user's initial question text into the quantized language model, identifying the scene word slot parameters corresponding to the initial question text through the quantized language model, and determining the current target question-answering scene corresponding to the initial question text according to the scene word slot parameters;
[0011] Identify, by the quantized language model, business type word slot parameters and data variable word slot parameters corresponding to the initial question text based on the context information of the current target question-answering scenario and the initial question text;
[0012] The word slot parameters corresponding to the initial question text are determined according to the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters.
[0013] In one embodiment, determining the word slot parameters corresponding to the initial question text according to the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters includes:
[0014] When it is detected that at least one of the scenario word slot parameter, the business type word slot parameter and the data variable word slot parameter is incomplete, outputting guidance information through the quantized language model; the guidance information is used to guide the user to supplement the missing word slot parameter;
[0015] When the missing word slot parameters are obtained, the word slot parameters corresponding to the initial question text are determined by the quantized language model according to the missing word slot parameters, the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters.
[0016] In one embodiment, determining the current target question-answering scenario corresponding to the initial question text according to the scenario word slot parameter includes:
[0017] The actual target question and answer scenario corresponding to the initial question text is determined by the quantized language model according to the scenario word slot parameters, and if the actual target question and answer scenario does not match the current target question and answer scenario of the user, the actual target question and answer scenario is updated to the current target question and answer scenario.
[0018] In one embodiment, the standardized question text is input into a vector model to obtain a plurality of documents with the highest degree of relevance to the standardized question text, including:
[0019] Inputting the standardized question text into the vector model, and vectorizing the standardized question text through the vector model to obtain a vectorized text;
[0020] A number of local documents with the highest degree of relevance to the vectorized text are retrieved from a local knowledge base through the vector model, and a number of network documents with the highest degree of relevance to the vectorized text are retrieved from a website platform.
[0021] In one embodiment, before inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text, the method further includes:
[0022] Obtain an input data matrix; the input data matrix includes feature vectors corresponding to training problem samples;
[0023] Determine the target coordinates and the quantized values corresponding to the target coordinates from the original weight matrix of the language model to be quantized; the original weight values corresponding to the target coordinates can maximize the reduction value of the loss function when updated to the quantized values; the loss function is determined based on the difference between the original weight matrix and the quantized weight matrix of the language model to be quantized and the input data matrix;
[0024] Determining a quantized weight matrix according to the target coordinates and the quantized value;
[0025] The quantized language model is determined according to the quantized weight matrix.
[0026] In a second aspect, the present application also provides a question-answering device, comprising:
[0027] A parameter acquisition module is used to input the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include description information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model;
[0028] A standardization module, used for inputting the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention;
[0029] A document acquisition module, used for inputting the standardized question text into a vector model to obtain a number of documents with the highest degree of relevance to the standardized question text;
[0030] The answer module is used to input the standardized question text and the plurality of documents into the quantized language model to obtain an answer text generated by answering the initial question text.
[0031] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0032] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0033] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0034] The above-mentioned question-answering method, apparatus, computer device, computer-readable storage medium and computer program product input the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include descriptive information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model; the word slot parameters and the initial question text are input into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to the preset text structure and clearly reflects the user's intention; the standardized question text is input into the vector model to obtain several documents with the highest degree of relevance to the standardized question text; the standardized question text and several documents are input into the quantized language model to obtain the answer text generated to answer the initial question text. By compressing the model parameters of the large language model to obtain a quantized language model, the model parameters can be compressed into a representation with fewer bits, significantly reducing the requirements for computing resources and storage space, so that the question-answering system can maintain the accuracy of the answer while greatly improving the reasoning speed; and, by extracting the word slot parameters, the user question is associated with the target question-answering scenario, which can efficiently and accurately identify the user's intention. At the same time, the generation of standardized question text enables the user question to be efficiently matched with the semantic retrieval logic in the vector model, so as to find the document with the highest semantic relevance to the user's question, and further analyze the relevant documents and generate answers in combination with the quantized language model. The entire process improves the efficiency, accuracy and reasoning speed of the question-answering system through modular design and model parameter compression technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 An application environment diagram of a question-answering method in an embodiment;
[0037] Figure 2 A schematic diagram of a flow chart of a question-answering method in an embodiment;
[0038] Figure 3 is a logic diagram of an intent recognition mechanism in one embodiment;
[0039] Figure 4 A logic diagram of text retrieval in another embodiment;
[0040] Figure 5 is a flow chart of a question-answering method in another embodiment;
[0041] Figure 6 is a structural block diagram of a question-answering device in one embodiment;
[0042] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The question-answering method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 inputs the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include descriptive information related to the target question and answer scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model; the terminal 102 inputs the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to the preset text structure and clearly reflects the user's intention; the terminal 102 inputs the standardized question text into the vector model to obtain several documents with the highest degree of relevance to the standardized question text; the terminal 102 inputs the standardized question text and several documents into the quantized language model to obtain the answer text generated for answering the initial question text. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0045] In an exemplary embodiment, Figure 2 As shown, a question-answering method is provided, which is applied to Figure 1 The terminal 102 in FIG. 1 is used as an example for explanation, including:
[0046] Step S202: input the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text.
[0047] Among them, the target question and answer scenario can refer to a specific question and answer scenario, such as a government question and answer scenario, a hospital question and answer scenario, a police question and answer scenario, etc.
[0048] The word slot parameters include description information related to the target question-and-answer scenario. For example, taking the target question-and-answer scenario as a government question-and-answer scenario, according to the question-and-answer characteristics of the government scenario, the word slot parameters may include scenario word slot parameters, business type word slot parameters, and data variable word slot parameters, respectively, to achieve accurate parsing and classification of user queries based on the scenario, business type, and data variable.
[0049] Among them, the scenario word slot parameters may include a preliminary macro-classification of user questions, such as dividing the user's consulting needs into different government service areas such as social security cards, pension insurance, provident funds or marriage registration.
[0050] Among them, the business type word slot parameter may include further refined specific consulting content. For example, in the provident fund scenario, it can be distinguished whether the user is consulting about specific businesses such as provident fund withdrawal, provident fund payment or provident fund loan.
[0051] Among them, the data variable slot parameters may include specific information points consulted by the user, which may include details such as the business processing procedures, required time, required materials, processing location, and relevant consultation telephone numbers.
[0052] Among them, the user's initial question text can be a question raised for the target question and answer scenario. For example, taking the target question and answer scenario as a government affairs scenario, the user's initial question text can include "I would like to consult how to withdraw provident fund."
[0053] Specifically, the large language model is a language model based on deep learning technology that is trained with large-scale data. Through unsupervised or semi-supervised training of large-scale corpora, it can capture the semantics, grammar and contextual relationships of the language. The large language model can achieve a wide range of natural language tasks (NLP) through pretraining-fine-tuning, such as question-answer generation, text summarization, translation, code generation, etc. Further, taking the question-answer generation task as an example, the large language model can perform different subtasks contained in the question-answer generation task according to different prompts. For example, the subtasks may include generating word slot parameters corresponding to the initial question text, converting the initial question text into a standardized question text, generating answer text for the initial question text, etc. Prompts can be used to guide the large language model to perform specific tasks or guide the model to output specific content. Prompts can be a simple question, a description of a task, a piece of context, or any information that can help the model understand the required task. Optionally, prompts can be designed by developers and pre-defined specific prompt content according to the task objectives; they can also be based on fixed templates, and user input or context data is filled into the template to dynamically generate prompts; prompts can also be dynamically generated according to specific tasks through language models, etc.
[0054] The quantized language model is a language model obtained by compressing the model parameters of the Large Language Model (LLM). Optionally, the model parameters of the large language model can be compressed into a representation with fewer bits based on the Greedy Coordinate Descent (GCD) quantization technology to significantly improve the inference speed of the model.
[0055] The terminal can parse the user's question text through a quantized language model. The quantized language model can combine predefined scenarios and semantic analysis technology to extract word slot parameters related to the target question-and-answer scenario. These word slot parameters can reflect the user's core intention more concisely and efficiently.
[0056] Step S204: input the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text.
[0057] Among them, the standardized question text is a text that conforms to the preset text structure and clearly reflects the user's intention.
[0058] The terminal uses a quantitative language model, combined with the extracted word slot parameters and the initial question text, to perform intelligent rewriting to generate a structured and clearly intended user question statement, eliminating ambiguity in user input, ensuring the accuracy and completeness of the question statement, while maintaining consistency with the user's original intent. The standardized question text that is finally output is a standardized question statement that clearly expresses the user's query intent and is suitable for subsequent document retrieval and information provision. For example, the initial question text "I want to withdraw provident fund" can be rewritten into a standardized question text "The user applies for provident fund withdrawal, the specific time is November 2024".
[0059] Step S206: input the standardized question text into the vector model to obtain a number of documents that are most relevant to the standardized question text.
[0060] Among them, the vector model can be used to convert text (such as user questions and document content) into semantic vectors, and use the semantic similarity of these vectors (such as cosine similarity) to retrieve documents related to user questions.
[0061] Optionally, the vector model can be a lightweight embedding model that can quickly retrieve the documents most relevant to the user's question from the local knowledge base or networked data. Exemplarily, the vector model vectorizes the standardized question text to obtain a semantic vector, and calculates the similarity between the semantic vector and the document vector in the local or networked knowledge base, thereby retrieving several documents in the knowledge base that are most relevant to the standardized question text.
[0062] Step S208, inputting the standardized question text and a plurality of documents into the quantized language model to obtain an answer text generated by answering the initial question text.
[0063] In the specific implementation, the terminal constructs appropriate prompt words based on the standardized question text and several documents, and instructs the quantized language model based on the constructed prompt words to answer in combination with the standardized question text and several documents to generate the answer text. For example, the standardized question text is "What materials are needed to reissue the ID card?", and the several documents are 5 local knowledge base documents and 5 online documents. The constructed prompt words can be "Answer the user's question 'What materials are needed to reissue the ID card?' based on the content of the following documents, and ensure that the answer is accurate and complete." The prompt words can be used to clarify the answer task that the quantized language model needs to complete, and limit the context scope of the generated answer content.
[0064] The quantized language model can be a large language model after the model parameters are compressed by quantization techniques such as greedy coordinate descent (GCD). The model parameter scale is reduced while retaining a high level of semantic understanding and answering capabilities. It can efficiently process prompt words and comprehensively analyze the content of standardized question texts and related documents. For example, the answer text can be "To reissue an ID card, you need a photo of your ID card, a household registration booklet, and an application form. You can bring these materials to the local public security bureau for processing."
[0065] In the above question-answering method, the user's initial question text is input into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include descriptive information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model; the word slot parameters and the initial question text are input into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention; the standardized question text is input into the vector model to obtain several documents with the highest degree of relevance to the standardized question text; the standardized question text and several documents are input into the quantized language model to obtain an answer text generated to answer the initial question text. By compressing the model parameters of the large language model to obtain a quantized language model, the model parameters can be compressed into a representation with fewer bits, significantly reducing the requirements for computing resources and storage space, so that the question-answering system can maintain the accuracy of the answer while greatly improving the reasoning speed; and, by extracting the word slot parameters, the user question is associated with the target question-answering scenario, which can efficiently and accurately identify the user's intention. At the same time, the generation of standardized question text enables the user question to be efficiently matched with the semantic retrieval logic in the vector model, so as to find the document with the highest semantic relevance to the user's question, and further analyze the relevant documents and generate answers in combination with the quantized language model. The entire process improves the efficiency, accuracy and reasoning speed of the question-answering system through modular design and model parameter compression technology.
[0066] In another embodiment, the user's initial question text is input into a quantized language model to obtain word slot parameters corresponding to the initial question text, including: inputting the user's initial question text into the quantized language model, identifying the scene word slot parameters corresponding to the initial question text through the quantized language model, and determining the current target question and answer scene corresponding to the initial question text according to the scene word slot parameters; identifying the business type word slot parameters and data variable word slot parameters corresponding to the initial question text based on the context information of the current target question and answer scene and the initial question text through the quantized language model; and determining the word slot parameters corresponding to the initial question text according to the scene word slot parameters, the business type word slot parameters and the data variable word slot parameters.
[0067] Taking the target question-and-answer scenario as the government question-and-answer scenario as an example, the scenario word slot parameter includes a preliminary macro-classification of user questions, such as dividing the user's consulting needs into different government service areas such as social security cards, pension insurance, provident funds or marriage registration. Therefore, each target question-and-answer scenario can include subdivided government question-and-answer scenarios such as social security cards, pension insurance, provident funds, and marriage registration.
[0068] The context information may be the relevant background information and environmental factors that affect the understanding of an object or event in a specific scenario. The context information of the current target question-answering scenario is used to help the quantized language model understand the current target question-answering scenario.
[0069] For example, the user's initial question text is "How do I withdraw my provident fund?". The quantized language model identifies that the scene word slot parameter corresponding to the initial question text is "provident fund", and the current target question and answer scene is determined to be the provident fund scene. The context information of the provident fund scene is used to indicate that the current target application scene is the provident fund scene, and background knowledge and information related to the provident fund scene is provided.
[0070] Exemplarily, the quantized language model can combine the context information of the current target question-and-answer scenario and the initial question text to identify the business type slot parameters and data variable slot parameters corresponding to the initial question text. For example, the user's initial question text is "I want to withdraw my provident fund tomorrow", the scenario slot parameter is "provident fund", the business type slot parameter is "withdrawal", and the data variable slot parameters are "provident fund processing time", "provident fund withdrawal process", "materials required to withdraw provident fund", etc.
[0071] As an example, determining the word slot parameters corresponding to the initial question text based on the scene word slot parameters, business type word slot parameters and data variable word slot parameters may include: when it is detected that each of the word slot parameters among the scene word slot parameters, business type word slot parameters and data variable word slot parameters are complete, using the scene word slot parameters, business type word slot parameters and data variable word slot parameters together as the word slot parameters corresponding to the initial question text.
[0072] The technical solution of this embodiment uses a quantized language model to analyze user questions step by step, extract word slot parameters such as scenarios, business types, and data variables, and the generated word slot parameters ensure the accurate capture and description of user intentions, thereby improving the efficiency and accuracy of the subsequent question-and-answer system.
[0073] In another embodiment, word slot parameters corresponding to the initial question text are determined based on scenario word slot parameters, business type word slot parameters and data variable word slot parameters, including: when it is detected that at least one of the scenario word slot parameters, business type word slot parameters and data variable word slot parameters is incomplete, guidance information is output through the quantized language model; the guidance information is used to guide the user to supplement the missing word slot parameters; when the missing word slot parameters are obtained, the word slot parameters corresponding to the initial question text are determined through the quantized language model according to the missing word slot parameters, scenario word slot parameters, business type word slot parameters and data variable word slot parameters.
[0074] Exemplarily, incomplete word slot parameters may refer to the complete lack of at least one of the scene word slot parameters, business type word slot parameters and data variable word slot parameters, or may refer to the lack of detailed content of at least one of the scene word slot parameters, business type word slot parameters and data variable word slot parameters. For example, the initial question text is "I want to consult about provident fund matters", and the terminal may consider that the initial question text lacks the business type word slot parameter. Therefore, the guidance information output by the quantized language model may be "Please provide which provident fund business needs to be handled", and the user can supplement the missing business type word slot parameters, such as "I want to withdraw provident fund", and the terminal can generate complete business type word slot parameters according to the missing word slot parameters supplemented by the user through the quantized language model, and generate the word slot parameters corresponding to the initial question text based on the complete data variable word slot parameters, scene word slot parameters and business type word slot parameters.
[0075] The technical solution of this embodiment uses a quantized language model to parse user questions step by step, extract word slot parameters such as scenarios, business types, and data variables, thereby ensuring accurate capture and description of user intentions. At the same time, an intelligent guidance mechanism is used to improve incomplete parameters, thereby improving the intelligence and efficiency of the question-answering system.
[0076] In traditional technology, in a question-and-answer system for a wide range of user groups, non-professional users may not be able to provide accurate and clear descriptions when asking questions, which makes it difficult for the system based on the vectorized model to accurately parse the user's query intent, thereby affecting the accuracy and relevance of the retrieved documents. In order to solve this problem, the technical solution of this embodiment introduces an interactive intent recognition mechanism, which adopts an iterative guidance strategy to assist users to gradually clarify and refine their query intent through a series of carefully designed interactive steps, thereby achieving more accurate document retrieval and high-quality question-and-answer services, which can improve the intelligence of the question-and-answer system and the user interaction experience.
[0077] In another embodiment, the current target question and answer scenario corresponding to the initial question text is determined according to the scenario word slot parameters, including: determining the actual target question and answer scenario corresponding to the initial question text according to the scenario word slot parameters through a quantized language model, and updating the actual target question and answer scenario to the current target question and answer scenario if the actual target question and answer scenario does not match the current target question and answer scenario in which the user is located.
[0078] In the specific implementation, the terminal uses the quantized language model to determine the actual target question and answer scenario corresponding to the initial question text based on the scenario word slot parameters extracted from the initial question text. For example, the initial question text is "I want to check the provident fund balance", the extracted scenario word slot parameter is "provident fund", and the actual target question and answer scenario determined is the provident fund scenario; the terminal compares the determined actual target question and answer scenario with the target question and answer scenario the user is currently in. If the two match, the user's question will continue to be processed in the current scenario; if the two do not match, it means that the user's question involves a new scenario and needs to be updated. When the terminal detects a mismatch, the system updates the actual target question and answer scenario to the current target question and answer scenario, which can adapt to the user's new question scenario in a timely manner. For example, the user previously asked a question in the "social security query" scenario, and now asks a "provident fund query" question. The system updates the current scenario from "social security query" to "provident fund query".
[0079] The technical solution of this embodiment can dynamically adjust the question-answering scenario, ensure accurate understanding and response to user questions, and improve the flexibility and intelligence of the question-answering system.
[0080] To facilitate the understanding of those skilled in the art, Figure 3 A logic diagram of an intent recognition mechanism is provided exemplarily. In a specific implementation, the user's initial question text is input into the quantized language model to obtain the word slot parameters corresponding to the initial question text, which may include the following steps: (1) Scenario analysis: The user's initial question text is analyzed by the quantized language model to obtain the actual target question and answer scenario, and to determine whether the actual target question and answer scenario matches the current target question and answer scenario in which the user is located; (2) Scenario identification and update: If the actual target question and answer scenario does not match the current target question and answer scenario, the quantized language model updates the actual target question and answer scenario to the current target question and answer scenario, and obtains the updated scenario word slot parameters based on the updated current target question and answer scenario; (3) Business type and data variable extraction: If the actual target question and answer scenario matches the current target question and answer scenario, the quantized language model will combine the current target question and answer scenario to identify and update the actual target question and answer scenario. The context information and initial question text are used to extract the business type slot parameters and data variable slot parameters to further refine the slot parameters; (4) Slot integrity check: Evaluate the integrity of the three slot parameters: scenario slot parameters, business type slot parameters, and data variable slot parameters; (5) Intent output: If all slot parameters are complete, all slot parameters can be output, and these slot parameters can accurately reflect the user's intention for subsequent processing; (6) Slot parameter supplement guidance: If the slot parameters are incomplete, the quantized language model will guide the user to supplement the missing business type and data variable information until all slot parameters are accurately filled in; (7) Final intent confirmation: After the user has completed all necessary slot parameters, confirm and output the slot parameters used to reflect the user's complete intention.
[0081] In another embodiment, the standardized question text is input into a vector model to obtain several documents with the highest degree of relevance to the standardized question text, including: inputting the standardized question text into the vector model, vectorizing the standardized question text through the vector model to obtain vectorized text; retrieving several local documents with the highest degree of relevance to the vectorized text from a local knowledge base through the vector model, and retrieving several network documents with the highest degree of relevance to the vectorized text from a website platform.
[0082] In the specific implementation, the terminal can input the standardized question text into the vector model, convert it into a high-dimensional vector representation, and use text embedding technology to encode the semantic information of the text into a numerical vector to facilitate subsequent similarity calculations. Using the vector model, the vector representation of the standardized question is used to calculate the similarity with the vectors of the documents stored in the local knowledge base, and according to the similarity score, several local documents with the highest degree of relevance to the standardized question text are retrieved; similarly, the vector representation of the standardized question is used to retrieve documents on the network platform, and by calculating the similarity with the vector representation of the network document, several network documents with the highest degree of relevance to the standardized question text are obtained.
[0083] To facilitate the understanding of those skilled in the art, Figure 4 A logic diagram of text retrieval is provided as an example. Specifically, the terminal can search the local knowledge base, use the trained vector model to vectorize the standardized questions, and then use the vector retrieval to obtain the 5 documents in the local knowledge base that are most relevant to the user's questions; at the same time, the terminal can search online, first preset several commonly used government websites as the data source for the query, and then combine the search engine and crawler technology to extract the most relevant documents from each website, and finally use the re-ranking model to sort the real-time online documents to obtain the 5 most relevant documents.
[0084] In traditional technology, the construction process of the vector database is usually based on a predefined document set, resulting in the database content and timestamp being fixed once the construction is completed. This static nature limits the database's ability to respond to real-time data, so that when users ask questions related to immediate events, the database cannot provide the latest information, thereby affecting the accuracy of the query results. The technical solution of this embodiment addresses this problem and proposes an online search assistance mechanism that ensures that the question-and-answer system obtains the most relevant input corpus by retrieving and evaluating relevant documents online, thereby ensuring that the question-and-answer system can provide timely and accurate information feedback. The instant reflection of real-time data by the vector database ensures that user queries can obtain accurate and timely information feedback.
[0085] In another embodiment, before the user's initial question text is input into the quantized language model to obtain the word slot parameters corresponding to the initial question text, the method also includes: obtaining an input data matrix; the input data matrix contains feature vectors corresponding to the training question samples; determining the target coordinates and the quantized values corresponding to the target coordinates from the original weight matrix of the language model to be quantized; the original weight values corresponding to the target coordinates can maximize the reduction value of the loss function when updated to the quantized values; the loss function is determined based on the difference between the original weight matrix and the quantized weight matrix of the language model to be quantized and the input data matrix; determining the quantized weight matrix based on the target coordinates and the quantized values; and determining the quantized language model based on the quantized weight matrix.
[0086] The input data matrix includes the feature vectors corresponding to the training question samples. Optionally, the training question sample texts may be vectorized to obtain the feature vectors corresponding to the training question samples. The input data matrix is composed of the feature vectors corresponding to the training question samples, each row represents a feature vector of a training question sample, and each column corresponds to a feature dimension. Optionally, the training question samples may include various questions that users may enter in actual question-answering scenarios in the question-answering system.
[0087] Among them, the target coordinate is a coordinate in the original weight matrix. The original weight value at this coordinate has the greatest impact on the model weight matrix. When it is quantized, the value of the loss function can be significantly reduced.
[0088] The quantized value is the quantized value that replaces the original weight value corresponding to the target coordinate, and optionally, can be a value in a discrete value set (such as a low-precision integer or a fixed-point number).
[0089] The terminal can continuously select a target coordinate and a corresponding quantized value from all coordinates, and the original weight value corresponding to the target coordinate has the largest reduction value of the loss function after being updated to the corresponding quantized value.
[0090] The loss function is used to measure the difference between the original weight matrix and the quantized weight matrix, and at the same time, combined with the input data matrix, reflects the performance of the model on the training problem sample. This loss function is used to guide the optimization process so that the quantized weight matrix can be compressed while retaining the model performance.
[0091] In the specific implementation, new target coordinates and quantization values are selected in each round, and the corresponding original weight values in the weight matrix are updated. The quantized weight matrix is finally generated through gradual optimization. The weight matrix is optimized coordinate by coordinate to ensure that the model compression is completed while minimizing the loss.
[0092] In traditional technology, question-answering systems usually use large language models to reason about customer questions. However, directly deploying these large language models requires a lot of computing resources and storage space, resulting in slow reasoning and complex deployment. To solve this problem, a large model quantization technology, such as greedy coordinate descent quantization technology, can be introduced to compress model parameters into a representation with fewer bits, significantly reducing computing requirements and storage overhead, improving the reasoning speed of the model, and making the model easier to deploy and operate on various devices and platforms, improving the availability of the question-answering system.
[0093] In one embodiment, quantizing the large model may be to compress the weight matrix parameters of the large model into a representation with fewer bits. and They represent the input and output dimensions of any computational layer of the language model to be quantized. is the original weight matrix of the computational layer, is the input data matrix containing n data points.
[0094] During quantization, the goal is to represent the original weight matrix W as of the form, in which denote the scaling parameter and the bias parameter respectively, is the diagonal matrix of a, is the transposed matrix of b, is the quantized weight matrix, and c represents the bit precision used in the quantization process. The post-training quantization (PTQ) technology can solve the following problems of layer-by-layer optimization of the quantized language model: Optionally, the problem can be decomposed in the output dimension into independent problems, so we can focus on quantifying any of the following dimensional vector problem: Among them, w can be a column in the original weight matrix W, that is, a dimensional vector; q can be the vector after quantizing w, or a dimensional vector, that is, a column in the quantized weight matrix. Assuming a and b are fixed, this problem is an integer linear regression problem. Assuming that the appropriate a and b have been determined, we can focus on optimizing q. In the quantization process, each round can find the coordinate that leads to the maximum reduction in the loss function, that is, the target coordinate, and descend along this coordinate.
[0095] Let the loss function , we can try to find a coordinate i and a quantized value r so that the i-th coordinate can be updated to r to obtain the maximum reduction in the loss function:
[0096] ;
[0097] in, is a standard basis vector with 1 at the ith position and 0 elsewhere.
[0098] make , then:
[0099] ;
[0100] where H and g are evaluated at q, respectively. The Hessian matrix and gradient of .
[0101] In another embodiment, Figure 5 As shown, a question-answering method is provided, which is applied to Figure 1 The terminal 102 in the example is used as an example to illustrate, and the following steps are included:
[0102] S502: Input the user's initial question text into the quantized language model, and identify the scene word slot parameters corresponding to the initial question text through the quantized language model.
[0103] In one embodiment, before the user's initial question text is input into the quantized language model and the scene word slot parameters corresponding to the initial question text are identified by the quantized language model, the method also includes: obtaining an input data matrix; the input data matrix contains feature vectors corresponding to the training question samples; determining the target coordinates and the quantized values corresponding to the target coordinates from the original weight matrix of the language model to be quantized; the original weight values corresponding to the target coordinates can maximize the reduction value of the loss function when updated to the quantized values; the loss function is determined based on the difference between the original weight matrix and the quantized weight matrix of the language model to be quantized and the input data matrix; determining the quantized weight matrix based on the target coordinates and the quantized values; and determining the quantized language model based on the quantized weight matrix.
[0104] S504, determine the actual target question and answer scenario corresponding to the initial question text according to the scenario word slot parameters through the quantized language model, and judge whether the actual target question and answer scenario matches the current target question and answer scenario of the user. If they match, execute step S508; if not, execute step S506.
[0105] S506, update the actual target question-answering scenario to the current target question-answering scenario, and execute step S508.
[0106] S508, identifying the business type word slot parameters and data variable word slot parameters corresponding to the initial question text through the quantized language model based on the context information of the current target question and answer scenario and the initial question text.
[0107] S510, determine whether the scene word slot parameters, business type word slot parameters and data variable word slot parameters are all complete, if so, execute step S512; if not, execute step S514.
[0108] S512, taking the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters as the word slot parameters corresponding to the initial question text, and executing step S516.
[0109] S514, output guidance information through the quantized language model, and when the missing word slot parameters are obtained, determine the word slot parameters corresponding to the initial question text according to the missing word slot parameters, scene word slot parameters, business type word slot parameters and data variable word slot parameters through the quantized language model, and execute step S516.
[0110] S516, inputting the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text.
[0111] S518, inputting the standardized question text into the vector model, and vectorizing the standardized question text through the vector model to obtain vectorized text.
[0112] S520, retrieving a number of local documents with the highest degree of relevance to the vectorized text from the local knowledge base through the vector model, and retrieving a number of network documents with the highest degree of relevance to the vectorized text from the website platform.
[0113] The technical solution of this embodiment innovatively integrates the interactive intent recognition mechanism and large model quantization technology into the construction process of the question-answering system, and adopts a network search auxiliary mechanism to ensure that the question-answering system obtains the most relevant input corpus through online retrieval and evaluation of relevant documents to provide timely and accurate information feedback, thereby deeply integrating and optimizing the traditional document retrieval and question-answering system. It can not only access Internet resources in real time to dynamically update and expand the knowledge base and solve the limitation of static data; secondly, it innovatively proposes an advanced interactive intent recognition mechanism, adopts an iterative guidance strategy to help users clarify and refine query intentions, and can The highly intelligent interactive intent recognition algorithm can accurately capture and parse the user's query intention and eliminate the ambiguity of the user's intention, thereby improving the intelligence of the system and the user interaction experience. It has introduced quantization technologies such as greedy coordinate descent (GCD). By compressing the model parameters into a representation with fewer bits, the quantized large model is easy to deploy and the inference speed is significantly increased, which significantly improves the inference speed and the deployment convenience of the system, further improves the availability and efficiency of the question-answering system, and at the same time enhances the question-answering system's ability to handle complex queries, improves the accuracy and timeliness of information retrieval and question-answering, and greatly improves the availability and user satisfaction of the question-answering system.
[0114] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a question-and-answer method above.
[0115] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0116] Based on the same inventive concept, the embodiment of the present application also provides a question-answering device for implementing the question-answering method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the question-answering device provided below can refer to the limitations on the question-answering method above, and will not be repeated here.
[0117] In an exemplary embodiment, Figure 6 As shown, a question-answering device is provided, comprising:
[0118] The parameter acquisition module 610 is used to input the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include descriptive information related to the target question and answer scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model.
[0119] The standardization module 620 is used to input the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention.
[0120] The document acquisition module 630 is used to input the standardized question text into the vector model to obtain a number of documents that are most relevant to the standardized question text.
[0121] The answer module 640 is used to input the standardized question text and the plurality of documents into the quantized language model to obtain an answer text generated by answering the initial question text.
[0122] In one embodiment, the parameter acquisition module 610 is specifically used to input the user's initial question text into the quantized language model, identify the scene word slot parameters corresponding to the initial question text through the quantized language model, and determine the current target question and answer scene corresponding to the initial question text according to the scene word slot parameters; identify the business type word slot parameters and data variable word slot parameters corresponding to the initial question text based on the context information of the current target question and answer scene and the initial question text through the quantized language model; and determine the word slot parameters corresponding to the initial question text according to the scene word slot parameters, the business type word slot parameters and the data variable word slot parameters.
[0123] In one of the embodiments, the parameter acquisition module 610 is specifically used to output guidance information through the quantized language model when it is detected that at least one of the scene word slot parameters, the business type word slot parameters and the data variable word slot parameters is incomplete; the guidance information is used to guide the user to supplement the missing word slot parameters; when the missing word slot parameters are obtained, the word slot parameters corresponding to the initial question text are determined through the quantized language model according to the missing word slot parameters, the scene word slot parameters, the business type word slot parameters and the data variable word slot parameters.
[0124] In one of the embodiments, the parameter acquisition module 610 is specifically used to determine the actual target question and answer scenario corresponding to the initial question text according to the scenario word slot parameters through the quantized language model, and when the actual target question and answer scenario does not match the current target question and answer scenario in which the user is located, update the actual target question and answer scenario to the current target question and answer scenario.
[0125] In one embodiment, the document acquisition module 630 is specifically used to input the standardized question text into the vector model, vectorize the standardized question text through the vector model, and obtain the vectorized text; retrieve several local documents with the highest degree of relevance to the vectorized text from the local knowledge base through the vector model, and retrieve several network documents with the highest degree of relevance to the vectorized text from the website platform.
[0126] In one embodiment, the question-answering device also includes a model building module; the model building module is specifically used to obtain an input data matrix; the input data matrix contains feature vectors corresponding to training question samples; the target coordinates and the quantization values corresponding to the target coordinates are determined from the original weight matrix of the language model to be quantized; the original weight values corresponding to the target coordinates can maximize the reduction value of the loss function when updated to the quantization values; the loss function is determined based on the difference between the original weight matrix and the quantized weight matrix of the language model to be quantized and the input data matrix; the quantized weight matrix is determined based on the target coordinates and the quantization values; the quantized language model is determined based on the quantized weight matrix.
[0127] Each module in the above question-answering device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0128] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a question-and-answer method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0129] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0130] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0131] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0132] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0134] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0135] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0136] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A question-answering method, characterized in that: The method comprises: Inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include description information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model; Inputting the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention; Inputting the standardized question text into a vector model to obtain a number of documents with the highest degree of relevance to the standardized question text; The standardized question text and the plurality of documents are input into the quantized language model to obtain an answer text generated by answering the initial question text.
2. The method according to claim 1, characterized in that The step of inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text includes: Inputting the user's initial question text into the quantized language model, identifying the scene word slot parameters corresponding to the initial question text through the quantized language model, and determining the current target question-answering scene corresponding to the initial question text according to the scene word slot parameters; Identify, by the quantized language model, business type word slot parameters and data variable word slot parameters corresponding to the initial question text based on the context information of the current target question-answering scenario and the initial question text; The word slot parameters corresponding to the initial question text are determined according to the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters.
3. The method according to claim 2, characterized in that The determining, according to the scenario word slot parameter, the business type word slot parameter and the data variable word slot parameter, the word slot parameter corresponding to the initial question text includes: When it is detected that at least one of the scenario word slot parameter, the business type word slot parameter and the data variable word slot parameter is incomplete, outputting guidance information through the quantized language model; the guidance information is used to guide the user to supplement the missing word slot parameter; When the missing word slot parameters are obtained, the word slot parameters corresponding to the initial question text are determined by the quantized language model according to the missing word slot parameters, the scenario word slot parameters, the business type word slot parameters and the data variable word slot parameters.
4. The method according to claim 2, characterized in that: The determining, according to the scene word slot parameters, a current target question-answering scene corresponding to the initial question text includes: The actual target question and answer scenario corresponding to the initial question text is determined by the quantized language model according to the scenario word slot parameters, and if the actual target question and answer scenario does not match the current target question and answer scenario in which the user is located, the actual target question and answer scenario is updated to the current target question and answer scenario.
5. The method according to claim 1, characterized in that The step of inputting the standardized question text into the vector model to obtain a plurality of documents with the highest degree of relevance to the standardized question text includes: Inputting the standardized question text into the vector model, and vectorizing the standardized question text through the vector model to obtain a vectorized text; A number of local documents with the highest degree of relevance to the vectorized text are retrieved from a local knowledge base through the vector model, and a number of network documents with the highest degree of relevance to the vectorized text are retrieved from a website platform.
6. The method according to claim 1, characterized in that Before inputting the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text, the method further includes: Obtaining an input data matrix; the input data matrix includes feature vectors corresponding to training problem samples; Determine the target coordinates and the quantized values corresponding to the target coordinates from the original weight matrix of the language model to be quantized; the original weight values corresponding to the target coordinates can maximize the reduction value of the loss function when updated to the quantized values; the loss function is determined based on the difference between the original weight matrix and the quantized weight matrix of the language model to be quantized and the input data matrix; Determining a quantized weight matrix according to the target coordinates and the quantized value; The quantized language model is determined according to the quantized weight matrix.
7. A question-answering device, characterized in that: The device comprises: A parameter acquisition module is used to input the user's initial question text into the quantized language model to obtain the word slot parameters corresponding to the initial question text; the word slot parameters include description information related to the target question-answering scenario; the quantized language model is a language model obtained by compressing the model parameters of the large language model; A standardization module, used for inputting the word slot parameters and the initial question text into the quantized language model to obtain a standardized question text; the standardized question text is a text that conforms to a preset text structure and clearly reflects the user's intention; A document acquisition module, used for inputting the standardized question text into a vector model to obtain a number of documents with the highest degree of relevance to the standardized question text; The answer module is used to input the standardized question text and the plurality of documents into the quantized language model to obtain an answer text generated by answering the initial question text.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Retrieval question condition segmentation system generated based on large language model
CN121350061A
Question and answering method and apparatus, computer device, and readable storage medium
WO2026114046A1