Question answering method based on large model and related equipment

By clustering the prompt example vectors using a Gaussian mixture model, the most relevant examples to the user's input question are selected. This solves the problem of poor generalization of prompt word selection in large-scale question answering models, and improves the accuracy and applicability of question answering.

CN121638267BActive Publication Date: 2026-06-09CHINA TELECOM CORP LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2026-02-04
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In large-scale question answering models, the selection of prompt words has poor generalization, making it difficult to balance the relevance and diversity of examples, resulting in low retrieval efficiency and low accuracy.

Method used

The set of prompt example vectors is clustered using a Gaussian mixture model to determine the cluster set that meets the similarity score condition. Based on the large model, the target prompt example is selected to generate the response text.

Benefits of technology

It improves the accuracy and relevance of the selected prompt examples, thereby enhancing the accuracy and applicability of large-scale question answering models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638267B_ABST
    Figure CN121638267B_ABST
Patent Text Reader

Abstract

The disclosure provides a large model-based question and answer method and related equipment, and relates to the technical field of computers. The method comprises the following steps: obtaining a to-be-answered vector and a prompt example vector set, clustering the prompt example vector set through a Gaussian mixture model to obtain a plurality of clustering sets of prompt example vectors, determining, from the plurality of clustering sets, a first clustering set in which a first similarity score meets a first preset condition, the first similarity score being the sum of the similarity scores of the prompt example vectors in each clustering set and the to-be-answered vector, determining, based on each first clustering set, a target prompt example corresponding to a target prompt example vector in which a second similarity score meets a second preset condition, and obtaining an answer text according to an input question and the target prompt example through a large model. Through the processing mode of clustering analysis and recall retrieval, the accuracy and relevance of prompt example selection are improved, thereby improving the accuracy of large model question and answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a question-answering method and related equipment based on a large model. Background Technology

[0002] With the development of large model technology, the requirements for the accuracy of large model question answering are becoming increasingly higher. In related fields, in order to improve the accuracy of large model question answering, selecting prompt words is a method with relatively low requirements for relevant domain datasets and training computing power.

[0003] In related technologies, large-scale model question answering has the following problems: the prompt word selection method performs well across different self-evaluation datasets, making it difficult for users to choose how to use it; the selection method has poor generalization, limiting its application scenarios; it is difficult to balance the relevance and diversity of examples; and the efficiency of retrieving prompt words is low. Based on the above problems, the accuracy of large-scale model question answering is not high.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] This disclosure provides a question-answering method and related equipment based on a large model, which at least to some extent overcomes the problem of low accuracy in large model question-answering in related technologies.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] In a first aspect, embodiments of this disclosure provide a question-answering method based on a large model, the method comprising:

[0008] Obtain a vector to be answered and a set of example prompt vectors; the vector to be answered is a vector obtained based on the user's input question, and the set of example prompt vectors is a set of vectors obtained based on examples of prompts to be selected.

[0009] The cue example vector set is clustered using a Gaussian mixture model to obtain multiple cluster sets of cue example vectors;

[0010] From the plurality of cluster sets, a first cluster set whose first similarity score satisfies a first preset condition is determined; the first similarity score is the sum of the similarity scores of the prompt example vector and the vector to be answered in each cluster set;

[0011] Based on each of the first cluster sets, a target prompt example corresponding to a target prompt example vector whose second similarity score meets the second preset condition is determined; the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set;

[0012] The large model is used to obtain the answer text based on the input question and the target prompt example.

[0013] In one possible embodiment, obtaining the set of vectors to be answered and the set of example prompt vectors includes:

[0014] Based on the pre-answer large model and the input question, the text to be retrieved is generated; the parameter size of the pre-answer large model is smaller than the preset parameter size.

[0015] The text to be retrieved and the example prompts to be selected are input into the text feature extraction module to obtain a set of vectors for the text to be retrieved and vectors for the example prompts to be selected.

[0016] The text vector to be retrieved and the set of example vectors for prompts to be selected are input into the unified manifold approximation and projection algorithm for dimensionality reduction to obtain the vector to be answered and the set of example vectors for prompts.

[0017] In one possible embodiment, the step of inputting the text vector to be retrieved and the set of example vectors for prompts to be selected into a unified manifold approximation and projection algorithm for dimensionality reduction to obtain the vector to be answered and the set of example vectors for prompts includes:

[0018] For any vector in the set of text vectors to be retrieved and example vectors to be selected, the dimensionality-reduced coordinates of any two vectors to be processed are determined.

[0019] Based on the coordinates corresponding to the vector to be processed, determine the point connection probability of the vector to be processed in the low-dimensional mapping;

[0020] By using a unified manifold approximation and projection algorithm, a weighted graph between vectors to be processed is constructed in a high-dimensional space, and the connection probability of the vectors to be processed in the high-dimensional space is determined.

[0021] Based on the point connection probability and the connection probability, determine the value of the graph cross-entropy distance function that minimizes the graph.

[0022] Using the minimum inter-graph cross-entropy distance function value between every two vectors to be processed as a constraint, the vectors to be processed are dimensionality reduced to obtain the dimensionality-reduced vectors to be answered and the set of prompt example vectors.

[0023] In one possible embodiment, the step of clustering the set of cue example vectors using a Gaussian mixture model to obtain multiple cluster sets of the cue example vectors includes:

[0024] The set of example prompt vectors is input into the Gaussian mixture model, and iterative updates are performed based on the expectation-maximization algorithm until the model parameters of the Gaussian mixture model converge, thus obtaining the optimal model parameters.

[0025] Based on the optimal model parameters, the optimal number of clusters in the Gaussian mixture model is determined using the Bayesian information criterion.

[0026] Based on the optimal model parameters and the optimal number of clusters, the set of prompt example vectors is clustered using the Gaussian mixture model to obtain the multiple cluster sets.

[0027] In one possible embodiment, the first preset condition is that the sum of the similarity scores of the prompt example vectors and the vectors to be answered in the cluster set is ranked before a first preset number in the entire cluster set;

[0028] Determining the first cluster set whose first similarity score satisfies the first preset condition from the plurality of cluster sets includes:

[0029] For any cluster set, perform dense vector retrieval and sparse vector retrieval to obtain the dense score and sparse score between each hint example vector and the vector to be answered;

[0030] Based on the dense and sparse scores, a fusion similarity score is determined between each hint example vector and the vector to be answered.

[0031] Based on the fusion similarity score, a first similarity score is determined for any one of the cluster sets;

[0032] The clusters are sorted according to their first similarity scores to determine the first clusters whose first similarity scores meet the first preset conditions.

[0033] In one possible embodiment, the second preset condition is that the second similarity score in any of the first cluster sets is ranked before a second preset number;

[0034] The step of determining the target suggestion example corresponding to the target suggestion example vector whose second similarity score satisfies the second preset condition based on each of the first cluster sets includes:

[0035] For any one of the first cluster sets, perform dense vector retrieval and sparse vector retrieval to determine the dense score and sparse score between each prompt example vector and the vector to be answered;

[0036] Based on the dense score and the sparse score, a second similarity score is determined between each prompt example vector and the vector to be answered.

[0037] In each of the first cluster sets, the target prompt example vectors are determined according to the second similarity scores to satisfy the second preset conditions.

[0038] Determine the target cue example corresponding to the target cue example vector.

[0039] Secondly, embodiments of this disclosure provide a large-model-based question-answering device, comprising:

[0040] The acquisition unit is used to acquire a vector to be answered and a set of prompt example vectors; the vector to be answered is a vector obtained based on the user's input question, and the set of prompt example vectors is a set of vectors obtained based on prompt examples to be selected.

[0041] Clustering unit, used to cluster the set of cue example vectors using a Gaussian mixture model to obtain multiple cluster sets of the cue example vectors;

[0042] The first determining unit is configured to determine, from the plurality of cluster sets, a first cluster set whose first similarity score satisfies a first preset condition; the first similarity score is the sum of the similarity scores of the prompt example vector and the unanswered vector in each cluster set;

[0043] The second determining unit is used to determine, based on each of the first cluster sets, the target prompt example corresponding to the target prompt example vector whose second similarity score meets the second preset condition; the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set;

[0044] The question-answering unit is used to obtain the answer text based on the input question and the target prompt example through the large model.

[0045] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method described in the first aspect above by executing the executable instructions.

[0046] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.

[0047] Fifthly, according to another aspect of this disclosure, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the methods described in any of the preceding claims.

[0048] This disclosure provides a large-model-based question-answering method and related equipment, relating to the field of computer technology. The method includes: acquiring a vector to be answered and a set of prompt example vectors; clustering the prompt example vector set using a Gaussian mixture model to obtain multiple cluster sets of prompt example vectors; determining a first cluster set from the multiple cluster sets whose first similarity score satisfies a first preset condition, where the first similarity score is the sum of the similarity scores of the prompt example vector and the vector to be answered in each cluster set; based on each first cluster set, determining a target prompt example corresponding to a target prompt example vector whose second similarity score satisfies a second preset condition, where the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set; and obtaining the answer text using a large-model approach based on the input question and the target prompt example. By employing cluster analysis and recall retrieval, the accuracy and relevance of prompt example selection are improved, thereby enhancing the accuracy of large-model question answering.

[0049] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0051] Figure 1 A flowchart illustrating a question-answering method based on a large model is shown in an embodiment of this disclosure;

[0052] Figure 2 This diagram illustrates a flowchart of obtaining a vector according to an embodiment of the present disclosure;

[0053] Figure 3 This diagram illustrates a flowchart of a dimensionality reduction process according to an embodiment of the present disclosure;

[0054] Figure 4 This diagram illustrates a flowchart of a clustering process according to an embodiment of the present disclosure;

[0055] Figure 5 This diagram illustrates a flowchart of determining a first cluster set according to an embodiment of the present disclosure;

[0056] Figure 6 A flowchart illustrating an example of determining a target prompt in an embodiment of this disclosure is shown;

[0057] Figure 7 A schematic diagram of the structure of a question-answering device based on a large model is shown in an embodiment of this disclosure;

[0058] Figure 8 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0059] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0060] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0061] The terms used in this disclosure are explained.

[0062] Large Language Model (LLM) is a machine learning model with a large number of parameters, primarily used for natural language processing tasks such as language generation and understanding. LLMs learn the statistical patterns of language through self-supervised learning on massive amounts of text data, enabling them to generate coherent natural language text or perform complex language understanding tasks.

[0063] Prompts are the input text or instructions provided when interacting with an artificial intelligence model. They tell the model the specific task to complete or the type of content to generate. A typical prompt may include role settings, task descriptions, examples, or constraints to help the model accurately understand the user's intent and generate the expected results.

[0064] The Uniform Manifold Approximation and Projection (UMAP) algorithm is a nonlinear dimensionality reduction technique that can be used to visualize high-dimensional data or perform general dimensionality reduction processing. Based on manifold learning theory, UMAP maps data to a lower-dimensional space for analysis and visualization by preserving the neighborhood structure of the data in the high-dimensional space.

[0065] Gaussian Mixture Model (GMM) is a probabilistic soft clustering model that assumes the data is generated by a mixture of multiple Gaussian distributions. GMM calculates the probability of a sample belonging to each cluster by estimating the mean, covariance, and mixing coefficient of each component (Gaussian distribution), thus achieving a probabilistic partitioning of the data.

[0066] The Bayesian Information Criterion (BIC) is a model selection criterion used to choose the optimal model from a finite number of candidate models. BIC is based on maximum likelihood estimation and penalizes model complexity.

[0067] The Expectation-Maximization Algorithm (EM algorithm) is an iterative method for estimating parameters of statistical models containing latent variables.

[0068] The BM25 algorithm (Okapi BM25) is a document ranking function based on a probabilistic retrieval framework, used to evaluate the relevance between a document and a query. BM25 considers factors such as term frequency, document length, and inverse document frequency, and performs a weighted summation of the occurrences of each word in the query within the document to output a relevance score.

[0069] Reciprocal Rank Fusion (RRF) is a ranking fusion method used to integrate ranking results from multiple retrieval models or systems into a single ranked list.

[0070] Currently, numerous large-scale models with various architectures and parameter scales are emerging. Evaluations by various large-scale model capability testing platforms and comparative experiments by numerous researchers have provided detailed conclusions regarding the advantages and disadvantages of different underlying architectures for large-scale models. Recent research on optimizing the underlying architecture of large-scale models no longer significantly improves their performance. Therefore, rather than improving the performance of large-scale models by perfecting or modifying their underlying architecture, exploring how to better unleash the full potential of existing large-scale models may be a more important research direction in the field. For base-level large-scale models, without changing their underlying architecture, their performance on specific downstream tasks can be further enhanced through unsupervised incremental pre-training, supervised fine-tuning, reinforcement learning based on human feedback, and cue engineering. Among these methods, cue engineering has the lowest requirements for datasets and training computational power in the relevant domain, making it the easiest and fastest way to improve the performance of large-scale models in specific domains. Many cue engineering methods do not require collecting training sets for specific tasks to update the large-scale model parameters, or only require a small amount of data to update some parameters of the large-scale model to achieve the same effect as fine-tuning methods. Based on this, hint engineering has become one of the best methods for many large models used in vertical applications to improve their performance on downstream tasks.

[0071] Due to the following problems in the related technologies, large-scale model question answering has low accuracy: the prompt word selection method performs well in different self-evaluation datasets, making it difficult for users to choose how to use it; the selection method has poor generalization, limiting its application scenarios; it is difficult to take into account the relevance and diversity of examples; and the efficiency of retrieving prompt words is low.

[0072] Specifically, this addresses how to improve the accuracy of large model question answering with a smaller parameter scale without using a large amount of sample data, updating the weights of the large model, or the underlying architecture.

[0073] In the process of question answering large models, the selection of prompt examples in the prompt words generally includes two major directions: individual features and overall features, and each major direction is further divided into three subcategories.

[0074] Individual features are mainly for the selection and construction of each example sample to ensure that each example sample provides better information for the large model, including example structure, example content and example quality.

[0075] The example structure approach primarily studies how to optimize the structure of examples to improve their effectiveness, such as adding or removing a component of an example. Providing examples with intermediate reasoning steps as part of the prompt can significantly improve the ability of large models to perform complex reasoning. This involves expanding the example structure to three parts: question, reasoning process, and answer. The label (i.e., the answer) of the example is indispensable; the absence of a label will significantly reduce the effectiveness of the prompt.

[0076] The focus of example content research is on selecting examples with certain characteristics or that meet certain metrics to improve example performance. For example, a common approach is to retrieve examples semantically similar to the test question as prompt examples to improve the performance of large-scale model-generated content. However, it has been found that examples with diverse content perform better than those selected based on semantic similarity. Additionally, some researchers use information content as an evaluation metric to select prompt examples.

[0077] The example quality direction mainly studies the impact of the correctness of the various components of an example and the relationships between them on the example's effectiveness, such as the correctness of the example's reasoning process.

[0078] The overall features mainly target the overall structure of all example samples in a prompt word. By optimizing the overall sample structure, the accuracy of the content generated by the large model can be improved, including the example order, the number of examples, and the example distribution.

[0079] The example ordering direction mainly explores the best arrangement of a selected set of examples, usually sorted according to a certain metric, such as the semantic similarity between the examples and the test question or the information content of the examples.

[0080] The study on the number of examples primarily examines the relationship between the number of examples and the output performance of large models. However, given other factors influencing the construction of cue examples, increasing the number of examples may not yield the desired effect.

[0081] The example distribution approach primarily studies the impact of the examples themselves and the distribution of their components on the accuracy of large-scale model-generated answers. For example, a diverse range of examples in the prompt words is more effective than selecting all examples of the same category based on semantic similarity. The balance of prompt example labels in the prompt words also affects the accuracy of large-scale model-generated answers; in particular, the influence of the majority of example labels in the prompt words is significant, with an imbalanced label distribution having a substantial impact on the predictions of large-scale models.

[0082] In summary, the following problems may exist:

[0083] 1. The suggested selection methods are varied and complex, and all of them perform well on their respective evaluation sets, making it difficult for users to choose.

[0084] 2. Each example suggestion method is optimized for one direction only, which has poor generalization and is difficult to apply to a wider range of scenarios.

[0085] 3. There is a lack of multi-strategy fusion methods for selecting prompt examples that can take into account various directions of prompt example research and thus combine the advantages of various mainstream methods.

[0086] 4. Existing example selection methods struggle to balance the relevance and diversity of examples.

[0087] 5. Automated integration prompts often result in computationally inefficient selection methods.

[0088] Based on this, the embodiments of this disclosure provide a large-scale model-based question answering method and related equipment, relating to the field of computer technology. The method includes: obtaining a set of vectors to be answered and a set of prompt example vectors; clustering the set of prompt example vectors using a Gaussian mixture model to obtain multiple cluster sets of prompt example vectors; determining a first cluster set from the multiple cluster sets whose first similarity score satisfies a first preset condition, where the first similarity score is the sum of the similarity scores of the prompt example vectors and the vector to be answered in each cluster set; determining a target prompt example corresponding to a target prompt example vector whose second similarity score satisfies a second preset condition, where the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set; and obtaining the answer text using a large-scale model based on the input question and the target prompt example. By employing cluster analysis and recall retrieval, the accuracy and relevance of prompt example selection are improved, thereby enhancing the accuracy of large-scale model question answering and improving the applicability of the large-scale model question answering process.

[0089] The following detailed description of this exemplary implementation method is provided in conjunction with the accompanying drawings and embodiments.

[0090] First, this disclosure provides a question-answering method based on a large model, which can be executed by any electronic device with computing power. In the following process, an electronic device is used as an example of a terminal device.

[0091] Figure 1 The flowchart illustrates a question-answering method based on a large model, as shown in an embodiment of this disclosure. Figure 1 As shown, the question-answering method based on a large model provided in this embodiment includes the following steps:

[0092] S102: Obtain the vector to be answered and the set of example prompt vectors. The vector to be answered is a vector obtained based on the user's input question, and the set of example prompt vectors is a set of vectors obtained based on the example prompts to be selected.

[0093] S104: Cluster the set of cue example vectors using a Gaussian mixture model to obtain multiple cluster sets of cue example vectors.

[0094] S106: From multiple cluster sets, determine the first cluster set whose first similarity score satisfies the first preset condition. The first similarity score is the sum of the similarity scores of the prompt example vector and the vector to be answered in each cluster set.

[0095] S108: Based on each first cluster set, determine the target prompt example corresponding to the target prompt example vector whose second similarity score meets the second preset condition. The second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set.

[0096] S110: Using a large model, the answer text is obtained based on the input question and the target prompt example.

[0097] By employing the above method, the examples are first processed for relevance through clustering, ensuring that examples in each cluster have a certain degree of semantic similarity, while the semantic similarity between different clusters is low. This achieves effective unsupervised classification of examples. Furthermore, the first cluster set with high relevance to the vector to be answered is selected from the cluster set. Then, target prompt examples with high relevance to the vector to be answered are retrieved from each of the first cluster sets. This ensures that the recalled examples have semantic similarity to the user's input question, while also making the recalled example set diverse and not homogeneous. The retrieved examples are then added to the prompt words, improving the accuracy and relevance of prompt example selection, thereby improving the accuracy of large-scale model question answering.

[0098] For S102, the methods for obtaining the set of vectors to be answered and the set of example vectors for hints can include the following: Figure 2 A flowchart illustrating one method of obtaining a vector is shown in an embodiment of this disclosure, such as... Figure 2 As shown, it includes the following steps:

[0099] S202: Generate the text to be retrieved based on the pre-answered large model and the input question. The parameter size of the pre-answered large model is smaller than the preset parameter size.

[0100] In one possible implementation, the current suggestion example selection method directly uses the user input question for example retrieval and selection, which is difficult to match effectively because the example is a question-answer pair, while the user input is only a question, with significant differences in semantics and text structure. Based on this, a pre-answer big model can be used to provide an initial answer, and the user input question and the preliminary answer generated by the pre-answer big model can be concatenated as the text to be retrieved.

[0101] By employing the above method, the text to be searched and the text in the example prompt have the same text structure, both being question-and-answer structures. They share similarities in syntax and text structure, which can improve the accuracy of subsequent retrieval and matching.

[0102] Furthermore, considering efficiency, the pre-response model used in this step can be a model with a smaller parameter size, and the correctness of its generated answers will not have a significant impact on the subsequent retrieval results.

[0103] S204: Feature extraction module for the text to be retrieved and the example input text for the prompts to be selected, to obtain a set of vectors for the text to be retrieved and vectors for the example prompts to be selected.

[0104] In one possible embodiment, the text feature extraction module includes: a block segmentation module, a vectorization processing module, and a pooling processing module, wherein the pooling processing module includes an average pooling module or a max pooling module.

[0105] In the chunking module, the text to be retrieved, q, is chunked according to the set maximum chunk length, resulting in a chunk set. There are n blocks in total. When dividing the blocks, sentences are used as the smallest unit for splicing to ensure the integrity of sentences within each block. The overlap length between adjacent blocks is set to ensure the semantic integrity and continuity of each block.

[0106] In the vectorization processing module, each block in the block set is processed using a vectorization model to obtain a high-dimensional semantic vector for each block.

[0107] Pooling is performed in the pooling module to generate the overall semantic vector of the text to be retrieved, i.e., the text vector to be retrieved. The processing method in the pooling module can be as shown in the following formula (1).

[0108] (1)

[0109] in, This represents the vector of text to be retrieved. This represents the high-dimensional semantic vector of the k-th block.

[0110] In one possible embodiment, after processing each candidate prompt example using the text feature extraction module, a vector set of all prompt examples can be obtained, i.e., the candidate prompt example vector set, which is represented as follows: .

[0111] The example of the prompt to be selected is shown as follows: ,in This represents an example of the f-th option to be selected. This represents the set of all available hint examples, with a total of N examples.

[0112] The pooling processing module in this embodiment may include a max pooling module or an average pooling module. For the pooling of the high-dimensional semantic vector of each block, average pooling and max pooling can be selected according to specific needs. Average pooling is beneficial for preserving overall information, while max pooling is beneficial for reflecting significant features.

[0113] By combining block encoding and pooling, the user input question is divided into overlapping blocks with sentences as the smallest unit. Block-level semantic vectors are extracted using a vectorization model, and then average pooling or max pooling is used to generate the overall question vector. The example processing follows the same principle. This mechanism ensures the semantic integrity and coherence of long texts while avoiding the performance bottleneck of single-sentence encoding when processing long texts. Compared with existing single-sentence encoding methods, it has stronger expressive power and applicability.

[0114] S206: Input the text vector to be retrieved and the set of example vectors of prompts to be selected into the unified manifold approximation and projection algorithm for dimensionality reduction to obtain the vector to be answered and the set of example vectors of prompts.

[0115] In one possible embodiment, the above steps result in a high-dimensional vector. The high dimensionality leads to low computational efficiency and consumes a lot of computing power, so dimensionality reduction can be performed.

[0116] The dimensionality reduction process uses a unified manifold approximation and projection algorithm, which constructs a weighted graph in a high-dimensional space. By minimizing the cross-entropy distance function between graphs, it completes the mapping from high-dimensional vectors to low-dimensional vectors. This preserves the local and global structure of high-dimensional data in the low-dimensional space, thus ensuring that the semantic vectors after dimensionality reduction do not suffer significant information loss. It not only achieves nonlinear dimensionality reduction to obtain the set of vectors to be answered and the set of example vectors for hints, but also retains the semantic information in the vectors, thereby improving computational efficiency. Furthermore, the embodiments of this disclosure employ a non-limited dimensionality reduction method. Compared to directly calculating in the original high-dimensional space or using linear dimensionality reduction techniques, UMAP not only reduces the computational overhead of subsequent clustering and retrieval, but also preserves more semantic information, improving overall efficiency.

[0117] In one possible embodiment, Figure 3 A flowchart of a dimensionality reduction process according to an embodiment of this disclosure is shown, such as... Figure 3 As shown, it includes the following steps:

[0118] S302: Using any vector from the set of text vectors to be retrieved and example vectors of prompts to be selected as vectors to be processed, determine the dimensionality-reduced coordinates of any two vectors to be processed.

[0119] S304: Based on the coordinates of the vector to be processed, determine the point connection probability of the vector to be processed in the low-dimensional mapping.

[0120] S306: Construct a weighted graph between vectors to be processed in a high-dimensional space by using a unified manifold approximation and projection algorithm to determine the connection probability of the vectors to be processed in the high-dimensional space.

[0121] S308: Determine the minimum value of the inter-graph cross-entropy distance function based on the point connection probability and the connection probability.

[0122] S310: Using the minimum inter-graph cross-entropy distance function value between every two vectors to be processed as a constraint, the vectors to be processed are dimensionality reduced to obtain a set of vectors to be answered and a set of hint example vectors.

[0123] In one possible embodiment, the above processing procedure can be determined based on the following formulas, such as formulas (2) and (3) below.

[0124] (2)

[0125] (3)

[0126] Where i and j represent any two vectors to be processed in the high-dimensional space. This represents the coordinates of the vector i after dimensionality reduction. This represents the coordinates of the vector j after dimensionality reduction. This represents the connection probability of the corresponding points in the low-dimensional mapping. This represents the hyperparameters used in the dimensionality reduction process, without specific limitations. This represents the connection probability between vectors i and j to be processed in a high-dimensional space. Let represent the cross-entropy distance function value, and formula (2) is the cross-entropy distance function.

[0127] In the above calculation process, during the dimensionality reduction process, by minimizing the cross-entropy distance function value between graphs, the vectors after dimensionality reduction can also retain the local and global structure of the high-dimensional data, and retain the semantic vector information loss with minimal loss.

[0128] The vector to be answered is obtained after dimensionality reduction. and the set of example vectors for prompts .

[0129] In one possible embodiment, the text vector to be retrieved can be used as the vector to be processed, and the vector to be processed can be selected from the set of sample vectors for prompts to be selected. The minimum inter-graph cross-entropy distance function value between the vectors in the set of sample vectors for prompts to be selected and the text vector to be retrieved can be calculated respectively to complete the dimensionality reduction.

[0130] Regarding S104, Figure 4 A flowchart of a clustering process according to an embodiment of this disclosure is shown, such as Figure 4 As shown, it includes the following steps:

[0131] S402: Input the set of example vectors into the Gaussian mixture model, and iteratively update it based on the expectation-maximization algorithm until the model parameters of the Gaussian mixture model converge, thus obtaining the optimal model parameters.

[0132] S404: Based on the optimal model parameters, determine the optimal number of clusters in the Gaussian mixture model using the Bayesian information criterion.

[0133] S406: Based on the optimal model parameters and the optimal number of clusters, the set of prompt example vectors is clustered using a Gaussian mixture model to obtain multiple cluster sets.

[0134] In one possible embodiment, the cue example vectors in the dimensionality-reduced cue example vector set can be represented as: N also represents the total number of cue example vectors, which is the same as the total number of cue examples to be selected.

[0135] A Gaussian mixture model is built for the set of dimensionality-reduced suggestion example vectors, and the number of mixture components K is set, i.e., the proposed number of clusters. The model parameters are as follows. , These are the first, second, and third model parameters, respectively. As the value of k changes, they represent different cluster sets, and the values ​​of their model parameters can be different. The Gaussian mixture model is iteratively updated using the EM algorithm, after which the a posteriori probability is calculated and the parameters are updated until the model parameters converge, thus obtaining the optimal model parameters.

[0136] In the iterative update process, the proposed number of clusters K can be calculated based on the BIC criterion. The optimal number of clusters requires the optimal model parameters to participate in the calculation. The two are iterated together in the iterative update process. When the model parameters converge to obtain the optimal model parameters, the optimal number of clusters can then be obtained.

[0137] The calculation of the optimal number of clusters can be based on the following formulas (4) and (5).

[0138] (4)

[0139] (5)

[0140] in, This indicates that the BIC value, or K value, is calculated using the BIC criterion. This represents the optimal model parameters after the EM algorithm converges. The log-likelihood of the optimal model is represented by . The total number of model parameters is represented, including weights, mean, and covariance matrix. N represents the total number of cue example vectors, and d represents the dimension after dimensionality reduction.

[0141] Using the above formula, the minimum BIC value is obtained as the optimal number of clusters, expressed as: This is used to perform Gaussian mixture model clustering on all the cue example vectors, ultimately yielding a cluster set. The clustering method used in this disclosure is soft clustering, so the resulting cluster sets belong to soft cluster sets. The cue example vectors in each cluster set have a certain degree of semantic similarity, while the semantic similarity of examples between different cluster sets is low, thereby achieving effective unsupervised classification for examples.

[0142] In this embodiment, clustering does not require manual setting of the number of clusters. Furthermore, the soft clustering capability of GMM provides a posterior probability distribution, resulting in more refined semantic segmentation of examples within the cluster set. Compared to commonly used clustering methods, it offers significant advantages in automation, rigor, and clustering quality.

[0143] Regarding S106, Figure 5 A flowchart illustrating one embodiment of the present disclosure for determining a first cluster set is shown, as follows: Figure 5 As shown, it includes the following steps:

[0144] S502: Perform dense vector retrieval and sparse vector retrieval for any cluster set to obtain the dense score and sparse score between each hint example vector and the vector to be answered.

[0145] In one possible embodiment, the scores for dense vector retrieval and sparse vector retrieval processes can be determined by the following formula, as shown in Formula (6). Dense vector retrieval refers to retrieval based on the similarity of semantic vectors (or text vectors), mainly calculating the cosine similarity between the vector to be answered and the prompt example vector.

[0146] (6)

[0147] in, Examples of the vector of answers and prompts to be selected for the text q to be retrieved. Corresponding prompt example vector The similarity between them, i.e., the density score, Let f represent the f-th cue example vector, where f takes values ​​from 1 to M, indicating that the total number of cue example vectors in the current cluster set is M.

[0148] The sparse score of sparse vector retrieval is determined based on the following formula (7). Sparse vector retrieval is based on the BM25 algorithm to calculate the BM25 score of the vector to be answered in the prompt example vector.

[0149] It should be noted that when calculating the sparsity score, the text of the prompt examples to be selected is used. For any cluster set, the total number of prompt example vectors and the total number of text of the prompt example text corresponding to the prompt example vectors are equal, both represented by M.

[0150] (7)

[0151] (8)

[0152] in, This section presents an example of a selection prompt calculated based on the BM25 algorithm. The sparse score between the text to be retrieved and the text q is This indicates that the word 'w' belongs to the text 'q' to be retrieved. This indicates that w is in the example of a prompt for selection. word frequency in These are the hyperparameters in the BM25 algorithm. This represents the average text length of all the suggested prompts. Example of a prompt for selection The length of the text. Indicates inverse document frequency. For inclusion The number of example suggestions to be selected, where M represents the total number of texts for example suggestions to be selected.

[0153] S504: Determine the fusion similarity score between each hint example vector and the unanswered vector based on the density score and the sparsity score.

[0154] S506: Determine the first similarity score of any cluster set based on the fusion similarity score.

[0155] S508: Sort each cluster set according to its first similarity score, and determine the first cluster set whose first similarity score meets the first preset condition.

[0156] In one possible embodiment, a fused similarity score can be obtained by combining dense and sparse scores and then sorted. This can be achieved in various ways, and no specific method is limited in this disclosure.

[0157] For example, the score can be determined by weighted fusion using the following formula (9), as shown below.

[0158] (9)

[0159] in, Example of a prompt for selection The weighted fusion score between the text q and the text to be retrieved can be used as the fusion similarity score. The fusion weight is greater than or equal to 0, and less than or equal to 1. Example of a prompt to select. The maximum value obtained by the BM25 algorithm when the example prompt t is to be selected is t.

[0160] Based on the weighted fusion score obtained in the above manner, the fusion similarity scores can be summed according to the cluster set to obtain the first similarity score of each cluster set.

[0161] For example, the inverse ranking fusion (RRF) method can be used to calculate the inverse ranking score as the fusion similarity score, and the first similarity score can be obtained and then sorted.

[0162] For example, a Transformer-based re-ranking model can be selected to calculate and score the similarity score, which is then used as the fusion similarity score to obtain the first similarity score, and then ranked.

[0163] The first preset condition is that the sum of the similarity scores of the prompt example vectors and the vectors to be answered in the cluster set is ranked before a first preset number in the entire cluster set.

[0164] Through the above-described method, this embodiment employs a dual-path recall and secondary ranking approach. During the retrieval phase, dense vector cosine similarity retrieval and sparse vector BM25 retrieval are used simultaneously. Then, the results from both paths are secondary-ranked using adjustable weight fusion, inverse ranking fusion, or a Transformer-based re-ranking model. This overcomes the problems of "missed recall" or "recall irrelevance" that easily occur with single retrieval strategies. By comprehensively integrating semantic and word frequency information, the accuracy and completeness of the recall list are improved, resulting in better recall performance compared to existing technologies that only use dense or sparse retrieval.

[0165] Regarding S108, Figure 6 A flowchart illustrating an example of determining a target prompt in an embodiment of this disclosure is shown, such as... Figure 6 As shown, it includes the following steps:

[0166] S602: Perform dense vector retrieval and sparse vector retrieval for any first cluster set, and determine the dense score and sparse score between each hint example vector and the vector to be answered.

[0167] S604: Determine a second similarity score between each hint example vector and the unanswered vector based on the density score and the sparsity score.

[0168] S606: In each first cluster set, sort according to the second similarity score, and determine the target prompt example vector whose second similarity score meets the second preset condition.

[0169] S608: Determine the target cue example corresponding to the target cue example vector.

[0170] In one possible embodiment, using and Figure 5 The dense and sparse scores are calculated in a similar manner, and the second similarity score can be obtained by weighted fusion, inverse ranking fusion or Transformer-based reordering model, etc., and then sorted to select the target prompt example vector that meets the second preset condition.

[0171] The second preset condition is that the second similarity score in any first cluster set is ranked before the second preset number.

[0172] It should be noted that in this embodiment of the disclosure, a second preset number of target cue example vectors may be selected for each first cluster set. For example, if there are 5 first cluster sets, and 10 target cue example vectors are to be recalled, then 2 target cue example vectors can be selected in each first cluster set.

[0173] pass Figure 5 and Figure 6 This approach employs a hierarchical retrieval strategy, first using distributed recall through clustering sets. This ensures high relevance between examples and questions while introducing diversity and avoiding homogenization issues. Compared to traditional one-time full-database retrieval or single-cluster centralized retrieval methods, it significantly improves the overall quality and robustness of suggested examples.

[0174] The method in this disclosure has a wider range of applications, for example, it can be applied to mathematical problem scenarios, medical scenarios, etc., as shown below.

[0175] Example 1: Mathematical problem scenario.

[0176] In scenarios where users use a large model to answer Chinese math questions, the first step is to reconstruct the user's input question. The user's math question can be input into a pre-answer large model to generate a preliminary answer. This answer is then concatenated with the user's input question to form the text to be retrieved.

[0177] Next, the retrieved text is vectorized, with the maximum block length set to the maximum context length of 512 tokens. Therefore, if the retrieved text length exceeds 512 tokens, the text needs to be segmented, and each segment is vectorized sequentially. Then, the vectors from all segments are average-pooled to generate the overall semantic vector of the retrieved text, i.e., the retrieved text vector. Average pooling is used here to ensure that the final vector retains overall information. If more significant features need to be highlighted, max pooling can be used.

[0178] The above process is used to vectorize all math problem examples in the example library, which can generate 1024-dimensional dense vectors. For dimensionality reduction, the UMAP algorithm can be used to reduce the dimensionality of all 1024-dimensional dense vectors to 512-dimensional vectors for the set of text vectors to be retrieved and the set of example vectors to be selected.

[0179] All example texts of math problems and their corresponding dimensionality-reduced dense vectors need to be stored in the Milvus database. The dense vectors are set using the Milvus database's dense vector field type, and the indexing method is set to the Hierarchical Navigable Small World (HNSW) algorithm. The HNSW algorithm is a graph-based indexing type that can achieve a high vector recall rate.

[0180] For the adaptive clustering step, a Gaussian Mixture Model (GMM) and the Bayesian Information Criterion (BIC) are used to cluster the dimensionality-reduced vectors corresponding to all math problem examples. The optimal number of clusters is determined from the candidate number of clusters using the Bayesian Information Criterion. Then, based on the Gaussian Mixture Model, all cluster sets with the optimal number of clusters are obtained, and the example vector corresponding to the cluster center of each cluster is calculated and labeled.

[0181] Based on hierarchical retrieval, dense scores and sparse scores are determined separately using a dual-path recall method. Based on these scores, a first cluster set with the highest relevance ranking is determined, for example, three first cluster sets. Then, dual-path recall and re-ranking methods are used again to retrieve target prompt examples from these three first cluster sets. The top five math questions with the highest relevance ranking are selected as target prompt examples. These target prompt examples are then embedded into prompt words and input into the large model to answer, thereby improving the accuracy of the large model's answers to user-inputted math questions.

[0182] Example 2: Healthcare Scenario.

[0183] For scenarios where users consult healthcare information using a large model, the first step is to reconstruct the user-inputted healthcare question text. This question is then fed into a pre-answer model to generate a preliminary answer, which is then concatenated with the original user question to form the text to be retrieved. Next, the retrieved text is vectorized, with the maximum block length set to a maximum context length of 8192 tokens. Therefore, if the retrieved text length exceeds 8192 tokens, text segmentation is required. Simultaneously, the overlap length between adjacent blocks is set to 80 tokens to ensure the semantic integrity and continuity of each block.

[0184] Each block is vectorized sequentially, and then the vectors from all blocks are average-pooled to generate the overall semantic vector of the text to be retrieved, i.e., the text vector to be retrieved. Max pooling is used here to highlight locally salient features, because in a health consultation scenario, it may be necessary to focus more on key symptoms or disease names mentioned in the user's consultation. If it is necessary to retain the overall information of the retrieved text, an average pooling scheme can be used.

[0185] Similarly, all medical and health question-and-answer examples in the example library are vectorized using the above process to generate corresponding 1024-dimensional dense vectors.

[0186] For the dimensionality reduction step, the UMAP algorithm is used to reduce all 1024-dimensional dense vectors to 256-dimensional vectors, based on the set of text vectors to be retrieved and the set of example vectors to be selected. The dimensionality reduction can be dynamically adjusted according to business needs. For example, in scenarios with high requirements for recall and accuracy, a higher dimensionality reduction can be selected to improve the retrieval effect, but the computational resources consumed must be weighed.

[0187] All sample texts of medical and health Q&A, along with their corresponding dimensionality-reduced dense vectors, need to be stored in an Elasticsearch database. The dense vector field should be set to the Elasticsearch database's dense vector type, and the analyzer for this field needs to be configured with the KNN algorithm to achieve efficient approximate nearest neighbor retrieval, ensuring the accuracy and timeliness of medical and health question recall. Alternatively, the Milvus vector database can be used for storage in this step.

[0188] For the adaptive clustering step, a Gaussian Mixture Model (GMM) and Bayesian Information Criterion (BIC) are used to perform clustering analysis on the dimensionality-reduced vectors of all healthcare examples. The optimal number of clusters is determined from the candidate clusters using the Bayesian Information Criterion, and then the Gaussian Mixture Model is used to obtain each cluster set, along with the corresponding examples for each cluster set. This step effectively improves the focus of the retrieval, especially in healthcare where the issues are broad, enabling more accurate example matching.

[0189] After obtaining the cluster sets, a hierarchical retrieval process is performed. This involves searching all cluster sets and selecting the top five clusters with the highest relevance ranking. Then, a dual-path recall and re-ranking method is used to retrieve examples again. Finally, the top 10 healthcare examples with the highest relevance ranking are selected as target suggestion examples. These target suggestion examples are then embedded into prompt words and fed into a large model for answering user-inputted healthcare questions, thereby improving the accuracy of the large model's responses. A Transformer-based re-ranking model can be used to calculate scores and rank the results.

[0190] Based on the same inventive concept, this disclosure also provides a question-answering device based on a large model, as shown in the following embodiment. Since the principle of this device embodiment in solving the problem is similar to that of the above method embodiment, the implementation of this device embodiment can refer to the implementation of the above method embodiment, and repeated details will not be described again.

[0191] Figure 7 This diagram illustrates the structure of a large-model-based question-answering device according to an embodiment of the present disclosure, such as... Figure 7 As shown, the device 70 includes: an acquisition unit 701, used to acquire a vector to be answered and a set of prompt example vectors; the vector to be answered is a vector obtained based on the user's input question, and the set of prompt example vectors is a set of vectors obtained based on prompt examples to be selected; a clustering unit 702, used to cluster the set of prompt example vectors using a Gaussian mixture model to obtain multiple cluster sets of prompt example vectors; a first determination unit 703, used to determine a first cluster set from the multiple cluster sets whose first similarity score meets a first preset condition; the first similarity score is the sum of the similarity scores of the prompt example vectors and the vector to be answered in each cluster set; a second determination unit 704, used to determine the target prompt example corresponding to the target prompt example vector whose second similarity score meets a second preset condition based on each first cluster set; the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set; and a question answering unit 705, used to obtain the answer text based on the input question and the target prompt example using a large model.

[0192] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0193] The following reference Figure 8To describe an electronic device 800 according to such an embodiment of the present disclosure. Figure 8 The electronic device 800 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0194] like Figure 8 As shown, the electronic device 800 is manifested in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including storage unit 820 and processing unit 810).

[0195] The storage unit stores program code that can be executed by the processing unit 810, causing the processing unit 810 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 810 can perform the steps of any of the above-described method embodiments.

[0196] Storage unit 820 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include a read-only memory (ROM) 8203.

[0197] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0198] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0199] Electronic device 800 can also communicate with one or more external devices 840 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 800, and / or with any device that enables electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0200] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0201] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods described above.

[0202] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.

[0203] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0204] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.

[0205] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0206] In practice, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0207] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0208] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0209] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0210] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

Claims

1. A question-answering method based on a large model, characterized in that, The method includes: Obtain a vector to be answered and a set of example prompt vectors; the vector to be answered is a vector obtained based on the user's input question, and the set of example prompt vectors is a set of vectors obtained based on examples of prompts to be selected. The cue example vector set is clustered using a Gaussian mixture model to obtain multiple cluster sets of cue example vectors; From the plurality of cluster sets, a first cluster set whose first similarity score satisfies a first preset condition is determined; the first similarity score is the sum of the similarity scores of the prompt example vector and the vector to be answered in each cluster set; Based on each of the first cluster sets, a target prompt example corresponding to a target prompt example vector whose second similarity score meets the second preset condition is determined; the second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set; The large model is used to obtain the answer text based on the input question and the target prompt example.

2. The method according to claim 1, characterized in that, The process of obtaining the set of vectors to be answered and the set of example vectors for prompts includes: Based on the pre-answer large model and the input question, the text to be retrieved is generated; the parameter size of the pre-answer large model is smaller than the preset parameter size. The text to be retrieved and the example prompts to be selected are input into the text feature extraction module to obtain a set of vectors for the text to be retrieved and vectors for the example prompts to be selected. The text vector to be retrieved and the set of example vectors for prompts to be selected are input into the unified manifold approximation and projection algorithm for dimensionality reduction to obtain the vector to be answered and the set of example vectors for prompts.

3. The method according to claim 2, characterized in that, The step of inputting the text vector to be retrieved and the set of example vectors for the prompts to be selected into a unified manifold approximation and projection algorithm for dimensionality reduction, to obtain the vector to be answered and the set of example vectors for the prompts, includes: For any vector in the set of text vectors to be retrieved and example vectors to be selected, the dimensionality-reduced coordinates of any two vectors to be processed are determined. Based on the coordinates corresponding to the vector to be processed, determine the point connection probability of the vector to be processed in the low-dimensional mapping; By using a unified manifold approximation and projection algorithm, a weighted graph between vectors to be processed is constructed in a high-dimensional space, and the connection probability of the vectors to be processed in the high-dimensional space is determined. Based on the point connection probability and the connection probability, determine the value of the graph cross-entropy distance function that minimizes the graph. Using the minimum inter-graph cross-entropy distance function value between every two vectors to be processed as a constraint, the vectors to be processed are dimensionality reduced to obtain the dimensionality-reduced vectors to be answered and the set of prompt example vectors.

4. The method according to claim 1, characterized in that, The step involves clustering the set of cue example vectors using a Gaussian mixture model to obtain multiple cluster sets of the cue example vectors, including: The set of example prompt vectors is input into the Gaussian mixture model, and iterative updates are performed based on the expectation-maximization algorithm until the model parameters of the Gaussian mixture model converge, thus obtaining the optimal model parameters. Based on the optimal model parameters, the optimal number of clusters in the Gaussian mixture model is determined using the Bayesian information criterion. Based on the optimal model parameters and the optimal number of clusters, the set of prompt example vectors is clustered using the Gaussian mixture model to obtain the multiple cluster sets.

5. The method according to claim 1, characterized in that, The first preset condition is that the sum of the similarity scores of the prompt example vectors and the vectors to be answered in the cluster set is ranked before a first preset number in the entire cluster set; Determining the first cluster set whose first similarity score satisfies the first preset condition from the plurality of cluster sets includes: For any cluster set, perform dense vector retrieval and sparse vector retrieval to obtain the dense score and sparse score between each hint example vector and the vector to be answered; Based on the dense and sparse scores, a fusion similarity score is determined between each hint example vector and the vector to be answered. Based on the fusion similarity score, a first similarity score is determined for any one of the cluster sets; The clusters are sorted according to their first similarity scores to determine the first clusters whose first similarity scores meet the first preset conditions.

6. The method according to claim 1, characterized in that, The second preset condition is that the second similarity score in any of the first cluster sets is ranked before a second preset number; The step of determining the target suggestion example corresponding to the target suggestion example vector whose second similarity score satisfies the second preset condition based on each of the first cluster sets includes: For any one of the first cluster sets, perform dense vector retrieval and sparse vector retrieval to determine the dense score and sparse score between each prompt example vector and the vector to be answered; Based on the dense score and the sparse score, a second similarity score is determined between each prompt example vector and the vector to be answered. In each of the first cluster sets, the target prompt example vectors are determined according to the second similarity scores to satisfy the second preset conditions. Determine the target cue example corresponding to the target cue example vector.

7. A question-answering device based on a large model, characterized in that, include: The acquisition unit is used to acquire the set of vectors to be answered and the set of example vectors for hints; The vector to be answered is a vector obtained based on the user's input question, and the set of prompt example vectors is a set of vectors obtained based on the prompt examples to be selected. Clustering unit, used to cluster the set of cue example vectors using a Gaussian mixture model to obtain multiple cluster sets of the cue example vectors; The first determining unit is used to determine, from the plurality of cluster sets, a first cluster set whose first similarity score satisfies a first preset condition; The first similarity score is the sum of the similarity scores of the prompt example vector and the vector to be answered in each cluster set; The second determining unit is used to determine, based on each of the first cluster sets, the target prompt example corresponding to the target prompt example vector whose second similarity score satisfies the second preset condition; The second similarity score is the similarity score between each prompt example vector and the vector to be answered in the first cluster set; The question-answering unit is used to obtain the answer text based on the input question and the target prompt example through the large model.

8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 6 by executing the executable instructions.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method described in any one of claims 1 to 6.

10. A computer program product, comprising: A computer program or instruction, characterized in that, when executed by a processor, the computer program or instruction implements the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Similar document retrieval method and device

    CN111813930A

  • Text reading understanding method and device, equipment and storage medium

    CN116975221A