Meta-learning based knowledge base question answering vector generation method and system
By optimizing the vector model of the knowledge base question answering system through meta-learning and reinforcement learning, the problems of insufficient generalization ability of static vectors and lack of user feedback are solved. This enables the vector model to adapt quickly and optimize efficiently under new tasks, improves retrieval and generation performance, and reduces computational resource consumption.
Patent Information
- Application Number
- CN202511757538.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-11-27
AI Technical Summary
In existing knowledge base question answering systems, static vector representations have insufficient generalization ability, cannot dynamically adapt to new tasks, lack user feedback mechanisms, are disconnected from retrieval and generation, consume high computational resources, and are difficult to learn efficiently in environments with few samples.
We employ a meta-learning-based approach, generating an adaptive vector model through multi-task pre-training and few-sample adaptive adjustment. We combine a reinforcement learning optimization module and a collaborative optimization module to dynamically adjust the vector representation, and optimize resource consumption through vector index pruning and adaptive quantization techniques.
It enables the vector model to adapt quickly to new tasks, optimizes the user feedback mechanism, improves retrieval and generation effects, reduces computing resource consumption, and is suitable for resource-constrained scenarios.
Smart Images

Figure CN121235063B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of knowledge base question answering and natural language processing, in particular to a knowledge base question answering vector generation method and system based on meta learning. BACKGROUND
[0002] At present, in the field of knowledge base question answering, retrieval enhancement generation technology based on vector retrieval has been widely applied. However, the existing technology still has the following key defects: first, the generalization ability of static vector representation is insufficient, and most of the existing vector generation methods use static embedding models, which have poor adaptability to new tasks and new fields. When the knowledge base content is updated, the original vector cannot be dynamically adjusted, which leads to the gradual distortion of the retrieval results, and the whole embedding model needs to be retrained to adapt to the new data, which is high in cost and low in efficiency. Secondly, the vector optimization lacks feedback mechanism and is difficult to adaptively adjust. The existing technology usually does not consider user feedback, which makes the vector unable to adaptively optimize according to the actual retrieval and generation effect. For example, when the user modifies or rejects the AI generated answer multiple times, the system cannot adjust the vector representation, so as to continuously output low-quality retrieval results. The existing method relies on manual fine-tuning or manual reconstruction of index, which is high in maintenance cost. Thirdly, the retrieval and generation are separated and difficult to optimize cooperatively. Traditional methods usually separate vector retrieval and text generation, and the retrieval model and the generation model are optimized respectively, lacking a cooperative mechanism. This leads to the fact that the retrieved documents are not necessarily the most suitable for generation requirements, which affects the final question and answer effect. In cross-domain tasks, the generation model often cannot adapt to the retrieval content, causing inaccurate or one-sided answers. Finally, the consumption of computing resources is high, and it is difficult to efficiently learn in a small sample environment. The existing method usually relies on large-scale data training, and performs poorly in a small sample scenario. When the knowledge base is updated, the vector model needs to be retrained on a large scale, which is high in computing cost and difficult to apply to resource-constrained scenarios.
[0003] The above content is only used to assist in understanding the technical solutions of the present application, and does not represent the acknowledgement of the above content as prior art. SUMMARY
[0004] The main purpose of the present application is to provide a knowledge base question answering vector generation method and system based on meta learning, which aims to dynamically adapt to new tasks, optimize user feedback mechanism, cooperatively improve retrieval and generation effect, and reduce computing resource consumption.
[0005] To achieve the above purpose, the present application provides a knowledge base question answering vector generation method based on meta learning, which comprises:
[0006] Obtaining user query data and knowledge base document data, generating standardized query data and standardized document data through data preprocessing;
[0007] inputting the standardized query data and the standardized document data into a meta-learning optimization module, generating an adaptive vector model through multi-task pre-training and few-shot adaptive adjustment;
[0008] processing real-time user query data through the adaptive vector model to generate a query vector and a document vector;
[0009] receiving user interaction behavior data, converting the user interaction behavior data into a reward signal through a reinforcement learning optimization module, and dynamically adjusting the query vector and the document vector based on the reward signal to generate an optimized vector;
[0010] inputting the optimized vector into a collaborative optimization module, calculating a vector similarity score through contrastive learning, and generating a collaborative optimization vector by fusing a generated model guidance signal of a knowledge distillation module;
[0011] performing redundancy filtering on the collaborative optimization vector using a vector index pruning technique to generate a simplified vector index;
[0012] compressing the simplified vector index through adaptive quantization technology to generate a final knowledge base question and answer vector.
[0013] In an embodiment, the step of inputting the standardized query data and the standardized document data into a meta-learning optimization module, generating an adaptive vector model through multi-task pre-training and few-shot adaptive adjustment includes:
[0014] constructing a training task set containing multiple knowledge base scenarios;
[0015] inputting the training task set into a model-independent meta-learning algorithm to perform cross-task gradient update on initial model parameters;
[0016] receiving few-shot data of newly added knowledge bases, performing domain adaptation fine-tuning based on the gradient updated initial model parameters to output the adaptive vector model.
[0017] In an embodiment, the step of inputting the training task set into a model-independent meta-learning algorithm to perform cross-task gradient update on initial model parameters includes:
[0018] sampling support set data and query set data from the training task set;
[0019] calculating task gradients based on the support set data;
[0020] updating initial model parameters in the direction of the task gradients to generate gradient updated parameters;
[0021] verifying the generalization performance of the gradient updated parameters on the query set data.
[0022] In an embodiment, the step of receiving user interaction behavior data, converting the user interaction behavior data into reward signals by the reinforcement learning optimization module, and dynamically adjusting the query vector and the document vector based on the reward signals to generate an optimized vector includes:
[0023] Real-time collection of user click behavior data, answer editing data and scoring data as user interaction behavior data;
[0024] Encoding the user interaction behavior data into a multi-dimensional reward signal;
[0025] Processing the multi-dimensional reward signal by a proximal policy optimization algorithm to calculate a ratio update value of policy update;
[0026] Adjusting the vector encoding layer parameters based on the ratio update value to generate the optimized vector.
[0027] In an embodiment, the step of processing the multi-dimensional reward signal by a proximal policy optimization algorithm to calculate a ratio update value of policy update includes:
[0028] Calculating the probability ratio value of the current policy generated vector and the historical policy;
[0029] Limiting the update amplitude of the probability ratio value by a clipping function;
[0030] Combining the advantage function to evaluate the optimization direction of the probability ratio value to output the ratio update value.
[0031] In an embodiment, the step of inputting the optimized vector into a collaborative optimization module, calculating the vector similarity score by contrastive learning, and fusing the generated model guidance signal of the knowledge distillation module to generate a collaborative optimization vector includes:
[0032] Inputting the optimized vector into a contrastive learning loss function to calculate the similarity score of the query vector and the positive and negative samples;
[0033] Inputting the optimized vector with the highest similarity score into a knowledge distillation teacher model;
[0034] Generating a knowledge distillation guidance signal by the teacher model;
[0035] Fusing the similarity score and the knowledge distillation guidance signal to generate the collaborative optimization vector.
[0036] In an embodiment, the step of inputting the optimized vector into a contrastive learning loss function to calculate the similarity score of the query vector and the positive and negative samples includes:
[0037] Constructing a vector set containing positive and negative samples from the optimized vector;
[0038] calculating a positive sample similarity between the query vector and the positive sample vector based on the vector set;
[0039] calculating a negative sample similarity between the query vector and the negative sample vector based on the vector set;
[0040] adjusting the positive sample similarity and the negative sample similarity by a temperature parameter to generate the similarity score.
[0041] In an embodiment, the step of generating the reduced vector index by performing redundancy filtering on the co-optimization vectors using a vector index pruning technique comprises:
[0042] calculating a relevance weight of the co-optimization vectors with respect to historical query vectors;
[0043] deleting co-optimization vectors with a relevance weight lower than a dynamic threshold;
[0044] composing the reduced vector index with the remaining co-optimization vectors.
[0045] In an embodiment, the step of generating the final knowledge base question answering vector by compressing the reduced vector index using an adaptive quantization technique comprises:
[0046] analyzing a numerical distribution range of the reduced vector index;
[0047] selecting a quantization mode parameter according to the numerical distribution range;
[0048] compressing the reduced vector index using the quantization mode parameter and a symmetric quantization algorithm to generate quantized vector data;
[0049] reorganizing the quantized vector data into the final knowledge base question answering vector.
[0050] In addition, to achieve the above object, the present application also provides a knowledge base question answering vector generation system based on meta-learning, which comprises a memory, a processor, and a knowledge base question answering vector generation program based on meta-learning stored in the memory and executable on the processor, and the knowledge base question answering vector generation program based on meta-learning is configured to implement the steps of the knowledge base question answering vector generation method based on meta-learning.
[0051] The knowledge base question answering vector generation method and system based on meta learning provided in the application effectively solve the problems of insufficient static vector generalization ability, missing feedback mechanism and split retrieval and generation, can dynamically adapt to new tasks, optimize the user feedback mechanism, synergistically improve the retrieval and generation effect and reduce the consumption of computing resources. BRIEF DESCRIPTION OF DRAWINGS
[0052] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the accompanying drawings required to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0054] Figure 1 The flowchart provided by an embodiment of the knowledge base question answering vector generation method based on meta learning of the application;
[0055] Figure 2 The detailed flowchart of step S200 in the application Figure 1
[0056] Figure 3 The detailed flowchart of step S220 in the application Figure 2
[0057] Figure 4 The detailed flowchart of step S400 in the application Figure 1
[0058] Figure 5 The detailed flowchart of step S430 in the application Figure 4
[0059] Figure 6 The detailed flowchart of step S500 in the application Figure 1
[0060] Figure 7 The detailed flowchart of step S510 in the application Figure 6
[0061] Figure 8 The detailed flowchart of step S600 in the application Figure 1
[0062] Figure 9 For the detailed flowchart of step S700 in the present application Figure 1
[0063] Figure 10 For the structural diagram provided by an embodiment of the knowledge base question answering vector generation system based on meta-learning in the present application.
[0064] Explanation of reference numerals:
[0065] 10, memory; 20, processor.
[0066] The purpose implementation, functional characteristics and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0067] The technical solutions in the present application will be described clearly and completely in the present application by combining with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. The components of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0068] It should be understood that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second" and the like are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0069] In the prior art, the knowledge base question answering system widely uses vector retrieval technology based on static embedding model. Such method has problems of poor dynamic adaptability, lack of user feedback, and retrieval and generation being split. For example, in the medical knowledge base scenario, when a new rare disease diagnosis and treatment guideline is added, the traditional system cannot quickly adjust the vector representation, resulting in that the retrieval result deviates from the latest medical consensus when the doctor queries. At the same time, the system cannot optimize the vector according to the user's modification behavior of the answer, and continuously returns low-quality documents, affecting the efficiency of clinical decision-making.
[0070] To solve the above problems, researchers found that static model parameter solidification is the core reason for the lack of generalization ability, and a dynamic parameter updating mechanism needs to be established. In view of the situation that user behavior data is not effectively utilized, consider converting interactive behavior into reinforcement learning signal. In order to solve the problem of separation between retrieval and generation, try to establish a collaborative optimization mechanism through contrastive learning. Finally, a multi-stage optimization framework combining meta-learning, reinforcement learning and knowledge distillation is formed, which realizes end-to-end optimization while ensuring computational efficiency.
[0071] Based on this, the embodiment of the application provides a knowledge base question and answer vector generation method based on meta-learning, referring to Figure 1 , the knowledge base question and answer vector generation method based on meta-learning comprises steps S100-S700, wherein:
[0072] Step S100, acquiring user query data and knowledge base document data, generating standardized query data and standardized document data through data preprocessing;
[0073] Step S200, inputting the standardized query data and the standardized document data into a meta-learning optimization module, generating an adaptive vector model through multi-task pre-training and few-shot self-adaptive adjustment;
[0074] Step S300, processing real-time user query data through the adaptive vector model to generate query vectors and document vectors;
[0075] Step S400, receiving user interaction behavior data, converting the user interaction behavior data into reward signals through a reinforcement learning optimization module, and dynamically adjusting the query vectors and the document vectors based on the reward signals to generate optimized vectors;
[0076] Step S500, inputting the optimized vectors into a collaborative optimization module, calculating vector similarity scores through contrastive learning, and generating collaborative optimization vectors by fusing the generation model guidance signals of the knowledge distillation module;
[0077] Step S600, using vector index pruning technology to filter the collaborative optimization vectors to generate a simplified vector index;
[0078] Step S700, compressing the simplified vector index through adaptive quantization technology to generate the final knowledge base question and answer vector.
[0079] In this embodiment, the meta-learning optimization module refers to a component that realizes rapid adaptation of the model through multi-task pre-training and few-shot fine-tuning. A model-independent meta-learning algorithm can be used to construct a cross-task gradient update mechanism to solve the problem of adaptability in new fields. The reinforcement learning optimization module refers to a processor that encodes user clicks and editing behavior as a multi-dimensional reward signal. It dynamically adjusts the vector encoding parameters through a near-end policy optimization algorithm to realize online optimization based on actual use feedback. The collaborative optimization module refers to a processing unit that integrates similarity calculation of contrastive learning and guidance signals of knowledge distillation. It uses a temperature adjustment contrastive loss function combined with a teacher model output fusion strategy to enhance the consistency of retrieval and generation. The vector index pruning technique refers to a processing process that dynamically filters redundant vectors based on correlation weights. It realizes storage optimization by calculating the historical query correlation degree through a sliding window. The adaptive quantization technique refers to an encoding method that dynamically selects compression parameters according to the vector numerical distribution. It uses a symmetric quantization algorithm to reduce storage space occupation.
[0080] In this embodiment, the standardized data enters the meta-learning optimization module for multi-task pre-training. The support set and the query set are alternately trained to improve the model generalization ability. When a small amount of new field data is added, the pre-trained parameters are used for rapid fine-tuning to generate an adaptive model. After real-time queries are encoded by the model, the vector encoding parameters are updated through reinforcement learning strategy combined with user click logs and other interaction data. The optimized vector enters the collaborative optimization module to calculate the similarity of positive and negative samples through contrastive learning, and the generation guidance signal is provided by the knowledge distillation model. After fusion, a vector representation with stronger semantic consistency is formed. In the pruning stage, low-correlation vectors are dynamically filtered according to the historical query frequency, and in the quantization stage, the optimal bit width is selected for compressed storage after analyzing the numerical distribution characteristics.
[0081] Compared with the prior art, the present scheme realizes few-shot rapid adaptation through a meta-learning mechanism, avoiding the computational overhead of retraining in traditional methods. The reinforcement learning module converts user behavior into online optimization signals, breaking through the limitations of static models that cannot be dynamically adjusted. The collaborative optimization mechanism connects the retrieval and generation links, improving the semantic matching accuracy compared to the traditional separate architecture. The dynamic pruning and quantization techniques automatically optimize the storage structure according to the data characteristics, maintaining efficient operation in resource-constrained environments. Through the above technical solutions, the present application can quickly adjust the vector model based on a small amount of newly added case data in the medical knowledge base update scenario, ensuring the accuracy of rare disease retrieval. When doctors modify the system-generated diagnosis suggestions multiple times, the system automatically optimizes the related disease vector weights to improve the quality of subsequent retrieval. The collaborative effect of contrastive learning and knowledge distillation ensures the consistency between the retrieved medical literature and the generated answer clinical guidelines. The adaptive quantization technique enables edge medical devices to efficiently run the latest model, supporting fast question and answer services in offline environments.
[0082] In a feasible implementation, reference is made to Figure 2The step S200 includes steps S210-S230, wherein:
[0083] The step S210 includes constructing a training task set containing multiple knowledge base scenarios.
[0084] The step S220 includes inputting the training task set into a model-independent meta-learning algorithm to perform cross-task gradient update on initial model parameters.
[0085] The step S230 includes receiving few-shot data of a new knowledge base, performing domain adaptation fine-tuning based on the gradient-updated initial model parameters, and outputting the adaptive vector model.
[0086] In the embodiment, the training task set refers to a sample set covering different knowledge base scenarios, which can be constructed by combining question and answer pairs in the fields of law, medicine, finance, etc., and is used to simulate a multi-task learning environment. The model-independent meta-learning algorithm refers to a meta-learning method that does not depend on a specific model structure, which can be a meta-learning framework based on gradient optimization. The cross-task gradient update refers to sharing parameter update directions between different tasks, which can be achieved by calculating task gradients on a support set and verifying the generalization performance on a query set, so that the model can quickly adapt to new tasks. The few-shot data refers to a data set with a limited number of labeled samples in the new knowledge base, which can include 5-20 labeled samples, and is used to trigger the rapid adaptation ability of the model. The domain adaptation fine-tuning refers to targeted adjustment based on a pre-trained model, which can use a fine-tuning strategy based on gradient-updated parameters to make the model parameters adapt to the distribution characteristics of the new knowledge base.
[0087] In the embodiment, after the standardized data processing is completed, a training task set containing multiple knowledge base scenarios is first constructed, for example, question and answer data in different fields such as legal provisions, medical diagnosis guidelines, and financial product descriptions are combined into independent tasks. Then, the model-independent meta-learning algorithm is used to perform cross-task gradient update on the initial model parameters, for example, after calculating the gradient on the support set of each task, the parameters are updated along the gradient direction, and the generalization performance of the updated parameters is verified on the query set. When the few-shot data of the new knowledge base is input, the domain adaptation fine-tuning is performed based on the optimized initial parameters, for example, through multiple iterations of training with a small amount of samples, the model parameters are adjusted to adapt to the semantic characteristics of the new knowledge base, and finally the adaptive vector model that can quickly adapt to new scenarios is output.
[0088] In this embodiment, the scheme establishes a general parameter basis through cross-task gradient update, realizes rapid adaptation in combination with few-shot fine-tuning, avoids large-scale repeated training, and makes the model learn cross-domain common features through multi-task pre-training, thereby significantly reducing the demand for the amount of data in a new domain. In this way, the application can effectively solve the problem that the static vector model is difficult to adapt to a new domain, so that only a small amount of labeled data is needed to complete model optimization in the scenario of adding a new knowledge base, thereby reducing the computational resource consumption of model retraining. At the same time, the general parameter basis established through cross-task gradient update enables the model to maintain high generalization performance when facing unknown domains, thereby improving the application feasibility of the knowledge base question-answering system in a few-shot scenario.
[0089] In a feasible implementation manner, referring to Figure 3 , step S220 includes steps S221-S224, in which:
[0090] Step S221, sampling support set data and query set data from the training task set;
[0091] Step S222, calculating a task gradient based on the support set data;
[0092] Step S223, updating the initial model parameters in the direction of the task gradient to generate gradient updated parameters;
[0093] Step S224, verifying the generalization performance of the gradient updated parameters on the query set data.
[0094] In this embodiment, the model-agnostic meta-learning algorithm refers to a meta-learning method allowing an arbitrary gradient descent model to quickly adapt to a new task, which can be implemented by using a model-agnostic meta-learning framework. The model-agnostic meta-learning framework functions to enable the model to quickly adapt to different knowledge base scenarios through cross-task gradient update. The support set data refers to a training subset for model parameter update, which can be extracted from the training task set by using a random sampling method. The function of the support set data is to provide basic data for gradient calculation for each task. The query set data refers to a test subset for verifying the generalization performance of the model, which can be obtained by using a sampling method that is mutually exclusive with the support set. The function of the query set data is to evaluate whether the model after parameter update has cross-task adaptation capability. The task gradient refers to the parameter update direction calculated for a single task, which can be implemented by using a back propagation algorithm. The function of the task gradient is to capture common features and different features between different tasks.
[0095] In the training stage of the embodiment, support set data and query set data are first randomly extracted from a training task set containing multiple knowledge base scenarios. The support set data is input into an initial model, and a task gradient is obtained through forward propagation and loss calculation. The gradient is used to update the initial model parameters in a specific direction to generate gradient update parameters suitable for the current task. Then, the query set data is input into the updated model, and the performance indicators on unseen data are calculated to verify whether the parameter update improves the cross-task generalization ability. Through repeated iteration of the process, the model gradually learns the shared knowledge between different tasks and forms a parameter initialization state that can quickly adapt to new tasks.
[0096] In the embodiment, the scheme performs gradient sharing and parameter updating among multiple tasks through a model-independent meta-learning algorithm, so that the model can capture the common rules between tasks under a small amount of samples, significantly reduce the dependence on the amount of data of new tasks, and enable the vector generation model to quickly adapt to new knowledge bases in a small sample scenario, avoiding the overfitting problem caused by insufficient data in traditional methods. At the same time, the cross-task gradient update mechanism effectively reduces the number of model retraining, significantly reducing the consumption of computing resources in the scenario of frequent updates of knowledge bases.
[0097] In a feasible implementation, with reference to Figure 4 , the step S400 includes steps S410-S440, in which:
[0098] In step S410, user click behavior data, answer editing data and score data are collected in real time as user interaction behavior data.
[0099] In step S420, the user interaction behavior data is encoded into a multi-dimensional reward signal.
[0100] In step S430, the multi-dimensional reward signal is processed by a proximal policy optimization algorithm to calculate a ratio update value of policy update.
[0101] In step S440, the vector encoding layer parameters are adjusted based on the ratio update value to generate the optimized vector.
[0102] In this embodiment, the user interaction behavior data refers to the operation records generated by the user in the question and answer process, which can be implemented by using click logs, answer modification records, and scoring feedback data to reflect the user's preferences and needs for the search results. The multi-dimensional reward signal refers to converting different interaction behaviors into numerical evaluation indicators, which can be implemented by using weighted summation and multi-channel encoder to quantify the guiding effect of user behavior on vector optimization. The proximal policy optimization algorithm refers to a reinforcement learning method based on policy gradient, which can be implemented by using probability ratio clipping and advantage function evaluation to adjust the vector generation strategy while ensuring the stability of the training. The ratio update value refers to the amplitude indicator of the policy parameter adjustment, which can be implemented by using gradient backpropagation and policy loss function calculation to control the update strength of the vector encoding layer parameters.
[0103] In this embodiment, the user click behavior data can record the browsing time or repeated click times of the user on the answer, the answer editing data can capture the addition and deletion operations of the user on the generated answer, and the scoring data can collect the scoring of the user on the answer quality. These data are converted into reward signals containing accuracy, relevance, and user satisfaction dimensions through a multi-dimensional encoder. The proximal policy optimization algorithm calculates the probability ratio of the current policy and the historical policy, limits the update amplitude by using a clipping function, and uses an advantage function to evaluate the optimization direction to finally generate a ratio update value. The vector encoding layer parameters are dynamically adjusted according to the ratio update value, so that the generated query vector and document vector can adapt to the user behavior feedback in real time.
[0104] In this embodiment, the present scheme converts user behavior into a reward signal of reinforcement learning, and dynamically updates the vector parameters by combining the proximal policy optimization algorithm, which avoids the cost of manual intervention and improves the real-time performance and accuracy of vector optimization. For example, when the user frequently modifies the answer, the existing technology cannot automatically identify the guiding significance of this behavior to vector optimization, but the present scheme can automatically enhance the weight of the relevant document vector through the reward signal. In this way, the present application can dynamically optimize the vector representation according to the actual interaction behavior of the user, so that the generated query vector and document vector are more in line with the user's needs. For example, in the scenario where the user modifies the answer multiple times, the system can automatically adjust the vector encoding parameters to improve the matching degree of the subsequent search results and the user's intention, while reducing the cost of manually maintaining the vector index. In addition, by combining reinforcement learning and proximal policy optimization, the vector parameters are continuously optimized while ensuring the stability of the training, effectively solving the problem of declining search quality caused by the lack of feedback mechanism in traditional methods.
[0105] In a possible implementation, with reference to Figure 5 , step S430 includes steps S431-S433, wherein:
[0106] Step S431, calculating a probability ratio of the current policy generation vector and the historical policy;
[0107] Step S432, limiting the updating amplitude of the probability ratio by a clipping function;
[0108] Step S433, outputting the ratio updating value by evaluating the optimization direction of the probability ratio combined with a advantage function.
[0109] In this embodiment, the probability ratio refers to the ratio of the conditional probability of the current policy generation vector and the corresponding probability of the historical policy, which can be calculated by using the logarithmic probability difference, and is used to quantify the relative amplitude of policy updating. The clipping function refers to a nonlinear function for limiting the amplitude of the probability ratio, which can be implemented by using a piecewise linear function with upper and lower threshold values, and is used to prevent model oscillation caused by excessive policy updating amplitude. The advantage function refers to a function for evaluating the deviation of action value from the average level, which can be implemented by using the time difference error or the generalized advantage estimation method, and is used to determine the optimization direction of policy updating.
[0110] In this embodiment, when the multi-dimensional reward signal is encoded as the input of policy optimization, the probability ratio is first calculated based on the probability distribution difference between the current policy and the historical policy, which reflects the relative strength of policy adjustment. Subsequently, the clipping function limits the amplitude of the probability ratio, for example, limits the ratio to the interval of 0.8 to 1.2, to avoid damaging the model stability due to excessive updating amplitude. Finally, the optimization direction of the probability ratio is evaluated combined with the advantage function, which dynamically adjusts the direction and strength of policy updating by comparing the difference in expected return between the current policy and the baseline policy, thereby generating a stable and effective ratio updating value.
[0111] In this embodiment, by introducing the clipping function and the advantage function, the instability in the updating process is effectively suppressed while the policy self-adaptation capability is retained, and the optimization direction is matched with the actual value of user feedback, so that the present application can realize precise control of policy updating based on user interaction behavior data, avoid degradation of model performance when dynamically adjusting the vector encoding parameters, reduce the need for manual intervention, and significantly improve the reliability and automation level of vector optimization.
[0112] In a feasible implementation manner, referring to Figure 6 , step S500 includes steps S510-S540, wherein:
[0113] Step S510, inputting the optimized vector into a contrastive learning loss function to calculate the similarity score of the query vector and the positive and negative samples;
[0114] Step S520, inputting the optimized vector with the highest similarity score into a knowledge distillation teacher model;
[0115] Step S530, generating a knowledge distillation guidance signal through the teacher model;
[0116] Step S540, fusing the similarity score and the knowledge distillation guidance signal to generate the collaborative optimization vector.
[0117] In this embodiment, the contrastive learning loss function refers to a method of optimizing vector representation by comparing the similarity difference between positive samples and negative samples. Specifically, it can be implemented by using cosine similarity combined with temperature parameter adjustment to enhance the discrimination degree of query vector and relevant document vector. The knowledge distillation teacher model refers to a pre-trained large-scale generative model, which can be implemented by using GPT-3 or T5 model structure to pass the implicit semantic association information through the generation of soft label guidance signal. The knowledge distillation guidance signal refers to the intermediate layer attention weight or probability distribution generated by the teacher model for the input vector, which can be transmitted through cross-entropy loss or KL divergence to constrain the generation direction of the collaborative optimization vector. The collaborative optimization vector refers to the comprehensive vector representation after fusing the contrastive learning similarity score and the knowledge distillation guidance signal, which can be generated by using weighted summation or concatenation followed by linear transformation to balance the retrieval accuracy and generation adaptability.
[0118] In this embodiment, the optimized vector is input into the contrastive learning loss function to calculate the similarity score between the query vector and the positive sample and the negative sample. The positive sample can be a document vector matching the query semantics, and the negative sample can be an irrelevant document vector obtained by random sampling or case mining. The temperature parameter is used to adjust the steepness of the similarity score distribution, for example, setting it to a value in the range of 0.05 to 0.2 to enhance the discrimination degree. The optimized vector with the highest similarity score is input into the knowledge distillation teacher model, and the teacher model generates a knowledge distillation guidance signal containing semantic association through self-attention mechanism. The guidance signal and the contrastive learning similarity score are combined through a gating fusion mechanism, for example, using a learnable weight parameter to dynamically adjust the contribution proportion of the two, and finally outputting a collaborative optimization vector with both retrieval discrimination and generation adaptability.
[0119] In this embodiment, the present scheme optimizes the vector representation through the synergy of contrastive learning and knowledge distillation, which encodes both the retrieval relevance and the generated adaptive features, thereby directly improving the downstream generation quality. The existing problem of fragmented optimization of retrieval and generation modules is transformed into joint representation learning in vector space, avoiding the complexity of manually designing intermediate adaptive layers. In this way, the present application can make the retrieved document vector more consistent with the semantic understanding requirements of the generation model, reducing the answer deviation caused by inconsistent retrieval and generation goals. In cross-domain question answering scenarios, the synergistically optimized vector can adaptively adjust the semantic representation center of gravity, such as strengthening the clause relevance features in legal document retrieval and highlighting the disease causal relationship features in medical question answering, thereby improving the accuracy and completeness of the generated answers. In addition, the introduction of knowledge distillation guidance signals reduces the secondary analysis burden of the generation model on the retrieval results, reducing the computational resource consumption during end-to-end optimization.
[0120] In a feasible implementation, the reference Figure 7 , step S510 includes steps S511-S514, wherein:
[0121] Step S511, constructing a vector set containing positive samples and negative samples from the optimized vector;
[0122] Step S512, calculating the positive sample similarity between the query vector and the positive sample vector based on the vector set;
[0123] Step S513, calculating the negative sample similarity between the query vector and the negative sample vector based on the vector set;
[0124] Step S514, adjusting the positive sample similarity and the negative sample similarity by a temperature parameter to generate the similarity score.
[0125] In this embodiment, the positive sample refers to the document vector that is semantically matched with the query vector, which can be implemented by using the document vector corresponding to the actually selected answer in the user click behavior data to establish the association between the query and the correct answer. The negative sample refers to the document vector that is semantically irrelevant to the query vector, which can be implemented by using the document vector that is not selected by the user or the randomly sampled interference vector to enhance the model's ability to distinguish noise data. The temperature parameter refers to a hyperparameter for adjusting the dispersion degree of the similarity distribution, which can be implemented by using a learnable neural network parameter or a dynamically adjusted numerical variable to control the discrimination degree of the positive and negative sample similarities.
[0126] In the contrastive learning process in this embodiment, first, the positive sample vectors with strong association with the current query and the negative sample vectors with weak association or no association are selected from the vector set optimized by reinforcement learning. The cosine similarity between the query vector and the positive sample vector is calculated as the positive sample similarity, and the cosine similarity between the query vector and multiple negative sample vectors is calculated as the negative sample similarity. A temperature parameter is introduced into the similarity calculation process, and the original similarity is scaled by an exponential function, so that the model can dynamically adjust the differentiation boundary of positive and negative samples according to the current data distribution. For example, when multiple negative samples are detected to have potential association with the query vector, the temperature parameter is automatically reduced in value to enhance the significance of the similarity difference, thereby improving the model's ability to handle fuzzy boundaries.
[0127] In this embodiment, by introducing an adjustable temperature parameter, the distribution pattern of the similarity score can be adaptively changed, and the training stability of the contrastive learning can be effectively improved in the scene where the data noise is large or the differentiation between positive and negative samples is low. For example, when processing cross-domain knowledge bases, the temperature parameter can be automatically adjusted according to the feature differences of different domain data, avoiding the problem of false matching caused by different similarity benchmarks between domains. Through the above technical solutions, the present application can dynamically adjust the similarity calculation process of positive and negative samples, and improve the model's ability to handle fuzzy semantic boundaries. In the scene where user interaction feedback has noise or knowledge base documents have semantic overlap, this scheme can effectively enhance the differentiation of vector representation and reduce the probability of occurrence of false matching documents in the retrieval results. At the same time, the dynamic adjustment mechanism of the temperature parameter avoids the maintenance cost brought by manual parameter adjustment, so that the system can adapt to the application requirements in different domains and different data quality environments.
[0128] In a feasible implementation manner, referring to Figure 8 , the step S600 comprises steps S610-S630, wherein:
[0129] In step S610, the correlation weight of the collaborative optimization vector and the historical query vector is calculated.
[0130] In step S620, the collaborative optimization vector with a correlation weight lower than a dynamic threshold is deleted.
[0131] In step S630, the retained collaborative optimization vectors are combined to form the reduced vector index.
[0132] In this embodiment, the relevance weight refers to the semantic correlation strength between the vector and the historical query vector, which can be calculated by using the cosine similarity algorithm combined with the attention mechanism, and is used to quantify the matching degree of the current vector and the historical query demand. The dynamic threshold refers to the filtering standard automatically adjusted according to the historical query data distribution, which can be realized by using the sliding window statistical method combined with the percentile algorithm, and is used to dynamically adapt to the redundancy judgment demand in different scenes. The vector index pruning technology refers to the vector screening method based on relevance evaluation, which can be realized by constructing a hash mapping table combined with a quicksort algorithm, and is used to remove low-value vectors to reduce the index size.
[0133] In this embodiment, during the operation of the knowledge base question answering system, the collaborative optimization vector set continuously accumulates historical query vector data. The system calculates the average similarity between each collaborative optimization vector and the last N historical query vectors as the relevance weight, where N can be the size of the sliding window, for example, set to 50 queries. When the relevance weight is lower than the current dynamic threshold, the vector is judged as redundant data and removed from the index. The dynamic threshold is automatically adjusted according to the weight distribution in the last M hours, for example, the 30th percentile value is calculated every hour as the new threshold. The retained vectors are reorganized by a hash table to form a compact index, for example, using an open addressing method hash structure to store the vectors and their metadata.
[0134] In this embodiment, through the dynamic threshold and historical query association mechanism, vectors that have not been effectively utilized for a long time can be automatically identified, the index size is continuously optimized under the premise of ensuring the retrieval recall rate, the problem of retrieval efficiency decline caused by index expansion during knowledge base update is solved, and the edge device can still maintain efficient retrieval under limited storage resources. For example, when rare disease cases are added to the medical knowledge base, the system can automatically filter vectors with low correlation to common diseases, avoiding unlimited growth of the index size affecting real-time retrieval performance. At the same time, the frequency of manual maintenance of the index is reduced, and the utilization rate of vector storage space can still be maintained in the few-sample scenario.
[0135] In a feasible implementation manner, referring to Figure 9 , step S700 includes steps S710-S740, wherein:
[0136] Step S710, analyze the numerical value distribution range of the compact vector index;
[0137] Step S720, select a quantization mode parameter according to the numerical value distribution range;
[0138] Step S730, compress the compact vector index using the quantization mode parameter and a symmetric quantization algorithm to generate quantized vector data;
[0139] Step S740, reorganize the quantized vector data into the final knowledge base question and answer vector.
[0140] In this embodiment, the adaptive quantization technology refers to a compression method that dynamically adjusts the quantization strategy according to the data distribution characteristics. Specifically, a dynamic bit width allocation algorithm based on statistical histogram analysis can be used to realize it, which is used to reduce the storage space occupation of the vector. The numerical value distribution range refers to the maximum value and minimum value interval of the vector elements in the numerical value space, which can be determined by calculating the global extreme value or quantile statistical value of the vector set, and is used to guide the division of the quantization interval. The quantization mode parameters include bit width selection, scaling factor and zero point offset, which can be automatically generated by an optimization algorithm that minimizes the quantization error, and are used to balance the compression rate and information loss. The symmetric quantization algorithm refers to a linear quantization method that is symmetrically distributed around the zero point, which can be realized by using uniform quantization or non-uniform quantization, and is used to maintain the relative distance relationship between vectors.
[0141] In this embodiment, in the compression process, first, the numerical value distribution of the simplified vector index is analyzed, for example, by traversing all vector elements to determine the maximum value and minimum value, and the quantization range is determined. According to the distribution range, the quantization parameters are dynamically selected, for example, when the numerical value distribution is detected to be Gaussian, the non-uniform quantization mode is used to focus on preserving the accuracy of the central area. Then, the symmetric quantization algorithm is used to compress the vector, for example, the 32-bit floating point vector is mapped to the 8-bit integer space, while the zero point alignment feature is preserved to reduce the calculation error. Finally, the compressed quantized vector is reorganized according to the original dimension structure to form a low-dimensional representation that can be directly used for similarity calculation.
[0142] In some specific embodiments, when analyzing the numerical value distribution range, a sliding window statistical method can be used, for example, the most recently updated vector in the time window is taken as the analysis object, and the quantization interval is dynamically adjusted to adapt to the change of data distribution. The selection of quantization mode parameters can be realized by online learning, for example, the bit width allocation strategy is automatically adjusted according to the historical quantization error feedback. The implementation of the symmetric quantization algorithm can be optimized in combination with the hardware acceleration instruction set, for example, the parallel computing capability of GPU is used to accelerate large-scale vector compression.
[0143] In this embodiment, the scheme can maximize the preservation of vector semantic information while ensuring the compression rate by dynamically analyzing the numerical distribution range and adaptively selecting the quantization parameter. In addition, the application of symmetric quantization algorithm enables the compressed vector to maintain the consistency of distance calculation, avoiding the distortion of retrieval results caused by quantization deviation, effectively solving the problem of high consumption of vector storage resources in the knowledge base question answering system, and realizing efficient compression of large-scale vector indexing under limited computing resources. The method can dynamically optimize the compression strategy according to the actual data distribution characteristics, reduce the storage space occupation while maintaining the retrieval accuracy, and is particularly suitable for real-time question answering scenarios in edge devices or private cloud environments. The quantized vector can directly participate in similarity calculation without the need for decompression operation, further improving the system response speed.
[0144] In the embodiments of the present application, the knowledge base question answering vector generation method based on meta-learning realizes cross-task parameter updating and few-sample adaptive fine-tuning through the meta-learning optimization module, dynamically adjusts the vector encoding in combination with the reinforcement learning optimization module, and utilizes the collaborative optimization module to fuse the contrast learning and knowledge distillation signals, effectively solving the problems of insufficient static vector generalization ability, missing feedback mechanism, and retrieval generation fragmentation, and can dynamically adapt to new tasks, optimize user feedback mechanism, collaboratively improve retrieval and generation effect, and reduce computing resource consumption.
[0145] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the knowledge base question answering vector generation method based on meta-learning of the present application. More forms of simple transformation based on this technical concept are within the protection scope of the present application.
[0146] The present application also provides a knowledge base question answering vector generation system based on meta-learning, which refers to Figure 10 The knowledge base question answering vector generation system based on meta-learning includes a memory 10, a processor 20, and a knowledge base question answering vector generation program based on meta-learning stored on the memory 10 and executable on the processor 20, which is configured to implement the steps of the knowledge base question answering vector generation method based on meta-learning.
[0147] The knowledge base question answering vector generation system based on meta-learning provided by the present application adopts the knowledge base question answering vector generation method based on meta-learning in the above embodiments, which can dynamically adapt to new tasks, optimize user feedback mechanism, collaboratively improve retrieval and generation effect, and reduce computing resource consumption. Compared with the prior art, the knowledge base question answering vector generation system based on meta-learning provided by the present application has the same beneficial effects as the knowledge base question answering vector generation method based on meta-learning provided by the above embodiments, and other technical features in the knowledge base question answering vector generation system based on meta-learning are the same as the features disclosed in the above method, which will not be repeated here.
[0148] It should be understood that portions of the application disclosed herein can be implemented with hardware, software, firmware or combinations thereof. In the description of the embodiments above, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner without departing from the scope of the application.
[0149] The above description is merely illustrative of the application and not restrictive.
Claims
1. A method for generating a vector of a knowledge base question answering based on meta learning, characterized in that, The method comprises: acquiring user query data and knowledge base document data, and generating standardized query data and standardized document data through data preprocessing; inputting the standardized query data and the standardized document data into a meta-learning optimization module, generating an adaptive vector model through multi-task pre-training and few-sample adaptive adjustment; processing real-time user query data through the adaptive vector model to generate query vectors and document vectors; receiving user interaction behavior data, converting the user interaction behavior data into a reward signal through a reinforcement learning optimization module, dynamically adjusting the query vectors and the document vectors based on the reward signal, and generating optimized vectors; inputting the optimized vectors into a collaborative optimization module, calculating vector similarity scores through contrastive learning, and generating collaborative optimization vectors by fusing generated model guidance signals of a knowledge distillation module; performing redundancy filtering on the collaborative optimization vectors using vector index pruning technology to generate simplified vector indexes; compressing the simplified vector indexes through adaptive quantization technology to generate final knowledge base question and answer vectors. 2.The meta-learning based knowledge base question answering vector generation method of claim 1, wherein, The step of inputting the standardized query data and the standardized document data into a meta-learning optimization module to generate an adaptive vector model through multi-task pre-training and few-sample adaptive adjustment comprises: constructing a training task set containing multiple knowledge base scenarios; inputting the training task set into a model-independent meta-learning algorithm to perform cross-task gradient updates on initial model parameters; receiving few-sample data of a newly added knowledge base, performing domain adaptation fine-tuning based on the gradient-updated initial model parameters to output the adaptive vector model. 3.The meta-learning based knowledge base question answering vector generation method of claim 2, wherein, The step of inputting the training task set into a model-independent meta-learning algorithm to perform cross-task gradient updates on initial model parameters comprises: sampling support set data and query set data from the training task set; calculating task gradients based on the support set data; updating initial model parameters in the direction of the task gradients to generate gradient-updated parameters; verifying the generalization performance of the gradient-updated parameters on the query set data. 4.The meta-learning based knowledge base question answering vector generation method of claim 1, wherein, The step of receiving user interaction behavior data, converting the user interaction behavior data into a reward signal through a reinforcement learning optimization module, dynamically adjusting the query vectors and the document vectors based on the reward signal, and generating optimized vectors comprises: real-time collection of user click behavior data, answer editing data, and scoring data as user interaction behavior data; encoding the user interaction behavior data into a multi-dimensional reward signal; processing the multi-dimensional reward signal through a proximal policy optimization algorithm to calculate a ratio update value of policy update; adjusting vector encoding layer parameters based on the ratio update value to generate the optimized vectors. 5.The meta-learning based knowledge base question answering vector generation method of claim 4, wherein, The step of processing the multi-dimensional reward signal through a proximal policy optimization algorithm to calculate a ratio update value of policy update comprises: calculating a probability ratio value of a current policy generated vector and a historical policy; limiting the update amplitude of the probability ratio value through a clipping function; combining an advantage function to evaluate the optimization direction of the probability ratio value to output the ratio update value. 6.The meta-learning based knowledge base question answering vector generation method of claim 1, wherein, The optimized vector is input into a collaborative optimization module, a vector similarity score is calculated through contrastive learning, and a generative model guidance signal of a knowledge distillation module is fused to generate a collaborative optimization vector, and the steps include: The optimized vector is input into a contrastive learning loss function to calculate the similarity score of the query vector and positive and negative samples. The optimized vector with the highest similarity score is input into a knowledge distillation teacher model. A knowledge distillation guidance signal is generated through the teacher model. The similarity score and the knowledge distillation guidance signal are fused to generate the collaborative optimization vector.
7. The meta-learning based knowledge base question answering vector generation method of claim 6, wherein, The step of inputting the optimized vector into the contrastive learning loss function to calculate the similarity score of the query vector and positive and negative samples includes: A vector set containing positive and negative samples is constructed from the optimized vector. The positive sample similarity of the query vector and the positive sample vector is calculated based on the vector set. The negative sample similarity of the query vector and the negative sample vector is calculated based on the vector set. The positive sample similarity and the negative sample similarity are adjusted by a temperature parameter to generate the similarity score. 8.The meta-learning based knowledge base question answering vector generation method of claim 1, wherein, The step of performing redundancy filtering on the collaborative optimization vector using vector index pruning technology to generate a simplified vector index includes: The relevance weight of the collaborative optimization vector and the historical query vector is calculated. The collaborative optimization vector with a relevance weight lower than a dynamic threshold is deleted. The retained collaborative optimization vectors are combined to form the simplified vector index. 9.The meta-learning based knowledge base question answering vector generation method of claim 1, wherein, The step of compressing the simplified vector index through adaptive quantization technology to generate the final knowledge base question and answer vector includes: The numerical value distribution range of the simplified vector index is analyzed. The quantization mode parameter is selected according to the numerical value distribution range. The simplified vector index is compressed using the quantization mode parameter and a symmetric quantization algorithm to generate quantized vector data. The quantized vector data is reorganized into the final knowledge base question and answer vector.
10. A meta-learning based knowledge base question answering vector generation system, characterized by, The meta-learning-based knowledge base question and answer vector generation system includes a memory, a processor, and a meta-learning-based knowledge base question and answer vector generation program stored on the memory and executable on the processor, and the meta-learning-based knowledge base question and answer vector generation program is configured to implement the steps of the meta-learning-based knowledge base question and answer vector generation method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Question and answer pair evaluation data generation method and device, computer equipment and storage medium
CN116775843A
Video clip retrieval method and device based on comparative learning, equipment and medium
CN119691219A