Deep dense document recall method based on multi-view vector fusion
By constructing a deep dense document recall method with multi-view vector fusion, the problem that DPR model is difficult to capture multi-level semantic connections in a single semantic perspective is solved, and efficient semantic matching and recall of complex query scenarios is achieved.
Patent Information
- Application Number
- CN202510638723.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, when dealing with problems with complex structures or semantic implicitness, DPR models are difficult to capture multi-level and multi-angle semantic connections when dealing with problems with complex structures or semantic implicit semantics, because they only use a single semantic perspective to model, it is difficult to capture multi-level and multi-angle semantic connections, resulting in obvious bottlenecks in the recall effect.
A deep dense document recall method based on multi-view vector fusion is adopted to construct multi-dimensional semantic representations of keyword perspectives, semantic expansion perspectives and intention perspectives, and to fusion the scores of each perspective through dynamic weights, combining attention mechanisms and Triplet loss optimization, efficient fusion of multi-view semantic information is achieved.
Effectively fusion of precise matching of terms, contextual correlation and task objective consistency improves the accuracy and robustness of semantic matching for complex query scenarios, solves the problem of poor generalization of traditional methods for different query types, and significantly improves the recall effect of the model.
Smart Images

Figure CN120409494A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of natural language processing and information retrieval, and specifically provides a deep dense document recall method based on multi-perspective vector fusion. Background Art
[0002] In the current mainstream RAG (Retrieval-Augmented Generation) system, the document recall module usually adopts the DPR (Dense Passage Retrieval) model. DPR uses a two-tower structure, inputs the question and the document into independent BERT encoders respectively to generate vector representations, and calculates the similarity between the vectors to achieve document retrieval. However, when dealing with problems with complex structures or implicit semantics, the DPR model is difficult to capture multi-level and multi-angle semantic connections because it only models from a single semantic perspective, resulting in an obvious bottleneck in the recall effect.
[0003] To solve the above problems, researchers have proposed some improvement methods, such as introducing cross encoders, using attention mechanisms or increasing context modeling. However, these methods often lead to a significant decrease in computational efficiency or are only effective in specific scenarios.
[0004] Therefore, there is an urgent need for an improvement method that can enhance the ability to model complex semantic relationships while maintaining high recall capabilities. Summary of the Invention
[0005] Aiming at the deficiencies of the prior art, the present invention provides a deep dense document recall method based on multi-perspective vector fusion, which solves the problem that the prior art only models from a single semantic perspective and is difficult to capture multi-level and multi-angle semantic connections, resulting in an obvious bottleneck in the recall effect.
[0006] To achieve the above objectives, the present invention is realized through the following technical solutions: A deep dense document recall method based on multi-perspective vector fusion, comprising the following steps:
[0007] S1. Preprocess the user query and candidate documents to generate standardized text;
[0008] S2. Construct multi-perspective semantic vector representations of the query and the document respectively, and the multi-perspectives at least include the keyword perspective, the semantic extension perspective, and the intention perspective;
[0009] S3. Calculate the similarity scores between the query and the document for each semantic perspective, and fuse the scores of each perspective through dynamic weights;
[0010] S4. Sort the documents according to the fusion scores and return the top Top-K results.
[0011] Preferably, the construction of the multi-perspective semantic vector in step S2 includes:
[0012] S201. Keyword perspective: Extract core terms from the query and the document through a keyword extraction algorithm, and input them into an independent encoder to generate vector representations.
[0013] S202. Semantic expansion perspective: Use a large language model to generate an extended description of the query and encode it into an extended semantic vector.
[0014] S203. Intention perspective: Identify the query intention type through a pre-trained classifier and map it to an intention vector.
[0015] Preferably, the keyword extraction algorithm is TF-IDF or named entity recognition, and the independent encoder is a BERT model.
[0016] Preferably, the dynamic weight fusion in step S3 includes:
[0017] S301. Calculate the weight parameters of each perspective through an attention mechanism, and the weight distribution formula is:
[0018]
[0019] where is a learnable parameter vector, is the vector representation of the query from perspective s, s ∈ {keyword perspective, semantic expansion perspective, intention perspective};
[0020] v T q s : The dot product operation between the parameter vector v and the query vector q s generates an unnormalized attention score, and T represents the vector transpose operator;
[0021] exp(·): The exponential function is used to map the attention score to the positive real number space;
[0022] q s′ : The intermediate variable for traversing all perspectives during the summation process;
[0023] The denominator ∑ s′ exp(v T q s′ ): Sum the exponential scores of all items in the perspective set to achieve weight normalization.
[0024] S302. Weightedly sum the similarity scores of each perspective, and the fusion formula is:
[0025]
[0026] where is the document d iVector representation under perspective s.
[0027] Q is the input object for multi-perspective semantic fusion, including the original query, extended query, and intent vector;
[0028] w s is the dynamic weight for multi-perspective semantic fusion.
[0029] Preferably, in step S3, the similarity calculation uses cosine similarity or dot product calculation.
[0030] Preferably, the sorting process in step S4 uses the heap sort algorithm with a time complexity of O(mlogK), where m is the number of candidate documents and K is the number of returned results.
[0031] Preferably, it further includes a training optimization step:
[0032] Construct triplet training data containing positive and negative samples;
[0033] Calculate TripletLoss for each perspective, and the formula is:
[0034]
[0035] where, q s is the vector of the query under perspective s, and are the vectors of the positive and negative samples under perspective s respectively, and γ is a preset boundary threshold and γ > 0;
[0036] Fuse the losses of each perspective with weights, and the total loss function is:
[0037]
[0038] where, λ s is the learnable perspective weight parameter.
[0039] Preferably, the training optimization step further includes a cross-perspective gradient sharing mechanism to enforce the consistency of the gradient directions of different perspectives during backpropagation.
[0040] Preferably, the construction of the intent perspective includes:
[0041] S2031. Use a pre-trained classifier to identify the intent category of the query;
[0042] S2032. Align the document content with the preset intent labels to generate an intent vector.
[0043] Preferably, the generation of the semantic extension perspective includes:
[0044] S2021. Generate an extended description sentence of the query through a large language model;
[0045] S2022. Extract the context window of the document and encode it into an extended semantic vector.
[0046] The present invention provides a deep dense document retrieval method based on multi-perspective vector fusion, having the following beneficial effects:
[0047] 1. By constructing multi-dimensional semantic representations from keywords, semantic expansion, and intention perspectives, the present invention effectively fuses multiple semantic information such as term exact matching, context relevance, and task objective consistency. The dynamic weight allocation mechanism adaptively adjusts the contribution of each perspective according to the query content, overcoming the defect of insufficient semantic coverage of a single perspective. It is particularly suitable for complex query scenarios containing technical terms or implicit intentions and can more accurately match highly relevant documents.
[0048] 2. Based on the dynamic fusion strategy of the attention mechanism, the model of the present invention can automatically adjust the weight ratios of keywords, extended descriptions, and intention perspectives according to the semantic characteristics of the query. This design solves the problem of poor generalization of traditional fixed-weight fusion strategies for different query types. For example, for queries with clear terms, the keyword perspective is strengthened, while for queries with vague descriptions, the importance of the semantic expansion perspective is enhanced, achieving flexible and efficient semantic matching.
[0049] 3. Through the multi-perspective Triplet loss joint optimization and cross-perspective gradient sharing mechanism, while maintaining the semantic independence of each perspective, the present invention enforces the consistency of the underlying feature representations. This training strategy effectively alleviates the perspective conflict problem in multi-task learning, enables the vector spaces of different perspectives to complement each other on the shared semantic baseline, and significantly improves the robustness of the model to noisy data and sparse queries. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is the method flow chart of the present invention;
[0051] Figure 2 is the overall structure flow chart of the present invention;
[0052] Figure 3 is the original structure diagram of DPR of the present invention;
[0053] Figure 4 is the schematic diagram of the multi-perspective construction module of the present invention;
[0054] Figure 5 is the schematic diagram of the multi-channel vector fusion and scoring mechanism of the present invention;
[0055] Figure 6 is the Triplet_Loss training diagram of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0056] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0057] Embodiment:
[0058] Please refer to the attached Figure 1-6 , the embodiment of the present invention provides a deep dense document recall method based on multi-view vector fusion, including the following steps:
[0059] S1. Preprocess the user query and candidate documents to generate standardized text;
[0060] The data preprocessing in step S1 provides a standardized input for subsequent semantic modeling through multi-level text cleaning and structured transformation. First, establish a text standardization process, receive the original query text and the candidate document set, and perform noise removal and semantic unit extraction on the unstructured text. The preprocessing process includes the following key technical links:
[0061] Stop word filtering is used to remove high-frequency words without real meaning and reduce semantic interference. Exemplarily, the stop word list contains common meaningless words such as "of", "how", "right", etc., and fast matching deletion is achieved through a hash table. For the query text "How to solve the compatibility problem of new energy vehicle charging piles", the core semantic unit "Solve the compatibility problem of new energy vehicle charging piles" is retained after filtering. This operation can reduce the noise signal in the subsequent encoding process and improve the accuracy of semantic representation.
[0062] Sub-word segmentation processing solves the decomposition problem of out-of-vocabulary words and rare terms. Preferably, a pre-trained BERT tokenizer based on the WordPiece algorithm is used to split the continuous character sequence into sub-word units. For example, the term "charging pile" is split into the sub-word sequence ["charge", "electricity", "pile"]. This method can effectively process domain-specific nouns and compound words by learning the combination rules of sub-words through a statistical language model, and avoid the incorrect segmentation of out-of-vocabulary words by traditional tokenization methods.
[0063] Case normalization unifies the text character format and eliminates semantic deviation caused by case differences. Specifically, all uppercase letters in the input text are converted to lowercase form. For example, the specification number "GB / T20234" in the query is uniformly processed as "gb / t20234". This operation ensures that the encoder generates consistent vectors for different writing forms of the same vocabulary, enhancing the robustness of the model.
[0064] The preprocessing of candidate documents is strictly consistent with the query processing to ensure cross-modal semantic alignment. For each document in the document collection, the same stop-word filtering, sub-word segmentation, and case normalization operations are performed. In particular, for the tabular data and special symbols that may exist in the document (such as the technical parameter "voltage 220V"), the numbers and unit symbols are retained, and the irrelevant delimiters are removed. For example, after processing the document paragraph "According to the national standard GB / T20234, the output voltage range of the charging pile is 200V - 250V", the standardized sequence "national standard gb / t20234 charging pile output voltage range 200v - 250v" is obtained.
[0065] The timing control of the preprocessing process adopts a pipeline architecture, and the stop-word filtering → sub-word segmentation → case conversion are executed in sequence. The intermediate results are passed between each link through an in-memory cache to avoid repeated IO operations. The processed queries and document collection are stored in the form of word sequences for the multi-perspective encoding module to call. This design can balance the processing efficiency and the requirements of semantic retention, providing high-purity input for subsequent semantic modeling.
[0066] Through the above multi-level processing, step S1 converts the original text into a sequence of structured semantic units, eliminating non-semantic related interference factors. This process establishes a unified input specification for subsequent multi-perspective encoding, ensuring the alignability of semantic spaces from different perspectives. The technical consistency of the preprocessing link is directly related to the effect of the semantic modeling module and is a necessary basis for the overall method to achieve high-precision recall.
[0067] S2. Construct multi-perspective semantic vector representations of the query and the document respectively. The multi-perspectives include at least the keyword perspective, the semantic expansion perspective, and the intention perspective;
[0068] In step S2, by constructing multi-perspective semantic vector representations, the semantic association features between the query and the document are captured from different dimensions, providing a complementary semantic representation basis for subsequent fusion calculations. The multi-perspectives include at least the keyword perspective, the semantic expansion perspective, and the intention perspective. The construction process of each perspective is as follows:
[0069] The construction of the semantic vector in the keyword perspective is used to extract the precise semantic matching features of the core terms. First, a keyword extraction model is established. Exemplarily, the TF-IDF algorithm or the named entity recognition (NER) model is adopted to screen out several words with the highest importance scores from the preprocessed query text and documents.
[0070] Preferably, the word frequency weight calculation of the TF-IDF algorithm satisfies the following relational expression:
[0071]
[0072] Among them, w(t, d) represents the weight of word t in document d, tf(t, d) is the term frequency, N is the total number of documents, and df(t) is the number of documents containing word t. Subsequently, the extracted keyword sequence is input into an independent encoder to generate a vector representation. Preferably, the independent encoder is a pre-trained language model based on the Transformer architecture, and its vector generation process is defined as:
[0073]
[0074] Among them, K Q and respectively represent the keyword sets of the query and document d i E key is the keyword perspective encoder, q key represents the semantic vector of query Q from the keyword perspective, p i,key is the semantic representation of the document from the keyword perspective, which together with the q key of the query determines the relevance score at the keyword level. This design can strengthen the semantic expression of core terms and avoid interference from redundant information.
[0075] The vector construction from the semantic expansion perspective aims to enhance context association and semantic generalization capabilities. First, an extended description sentence of the query is generated by a large language model (LLM). Exemplarily, a generative pre-trained model (such as the GPT series) is used to semantically expand the original query to generate extended text containing synonymous substitutions and context supplementation. The extended sentence generation process satisfies the following conditional probability distribution:
[0076]
[0077] Among them, Θ LLM is the model parameter of the LLM. On the document side, a sliding window mechanism is adopted to extract context fragments associated with the core terms as the extended content and input it into the encoder.
[0078] Q pre : Primary Query, that is, the retrieval request text input by the user;
[0079] Q ′ : Candidate Expanded Query, which is the semantic expansion text to be generated;
[0080] Q exp : Optimal Expanded Query, obtained by maximizing the generation probability.
[0081] P(Q ′ |Q pre , Θ LLM):The conditional probability of generating a candidate extended query Q pre given the original query Q LLM and the model parameters Θ ′ .
[0082] Furthermore, the extended text is input into an independent encoder to generate an extended semantic vector:
[0083] q exp = E exp (Q exp ), p i,exp = E exp (C di );
[0084] where C di represents the set of di-context fragments of the document, Q exp is the extended query text generated by the LLM, q exp is the semantic vector generated by passing Q exp through the encoder E exp , and p i,exp is the semantic representation of the document from an extended perspective. This process can capture long-distance semantic dependencies and improve the ability to model implicit semantics.
[0085] The vector construction from the intent perspective is used to identify the deep task objectives of the query and the topic matching features of the document. First, an intent classification model is established. Exemplarily, a classifier based on a multi-layer perceptron (MLP) is used, whose input is the semantic vector of the query and the output is a preset intent category label. The forward calculation process of the classifier is defined as:
[0086] [[ID= (45)]]c Q = argmax(Softmax(W2·ReLU(W1·h Q + b1)+ b2));
[0087] where h Q is the semantic vector of the query, usually the hidden state extracted by passing the query Q through an encoder (such as BERT, LSTM), argmax is used to select the most likely category from the probability distribution to complete the classification decision, and Softmax is the probability distribution vector of the output.
[0088] c Q maps the semantic vector to the category space through a two-layer feedforward network, and the final output is the category label with the maximum probability, which is used to achieve intent recognition of the query or document classification.
[0089] W1, b1, W2, and b2 are classifier parameters. W1 / b1 and W2 / b2 correspond to two levels of the neural network respectively. W1 / b1 performs feature transformation, and W2 / b2 completes classification mapping. For the document side, its topic distribution is extracted through a topic model (such as LDA) and aligned with the intent label space. The intent vector is generated by mapping through a learnable embedding matrix:
[0090] q intent = W intent [c Q , p i,intent = W intent [c di ;
[0091] Among them, W intent is the intent embedding matrix, c di is the intent category of document di, q intent is the document intent vector. p i,intent is used to calculate the matching degree between the document and the query at the intent level. This perspective can show the consistency of the task objectives of modeling the query and the document and solve the semantic drift problem.
[0092] Multi-perspective vector concatenation and normalization ensure the fusibility of each perspective semantic space. The three perspective vectors of the query and the document are concatenated into a matrix form by dimension:
[0093]
[0094] Among them:
[0095] Q is the multi-perspective vector of the query;
[0096] q key : The key perspective vector, generated by extracting query keywords;
[0097] q exp : The extended perspective vector, generated by the query expansion model;
[0098] q intent : The intent perspective vector, generated by query intent classification.
[0099] P i is the multi-perspective vector of the document
[0100] p i,key : The document key perspective vector, generated by extracting document keywords;
[0101] p i,exp : The document extended perspective vector, generated by the document summary model;
[0102] p i,intent : The document intent perspective vector, generated by predefined document labels;
[0103] Query the semantic vector from the perspective of keywords;
[0104] Query the semantic vector from the perspective of semantic expansion;
[0105] Query the semantic vector from the perspective of intent;
[0106] [·;·;·]: The vector concatenation operation in the column direction to generate a comprehensive semantic vector with a dimension of 3d.
[0107] Document d i The semantic vector from the perspective of keywords;
[0108] Document d i The semantic vector from the perspective of semantic expansion;
[0109] Document d i The semantic vector from the perspective of intent;
[0110] Furthermore, perform L2 normalization on each perspective vector:
[0111]
[0112] where q s is the normalization of the query vector, p i,s is the normalization of the document vector, ||·||2 represents the L2 norm of the vector, and the normalized vector satisfies ||q s ||2 = ||p i,s ||2 = 1.
[0113] This operation eliminates the influence of the vector norm difference on the similarity calculation, making the similarity scores of different perspectives comparable. The independent encoding and normalization of each perspective provide a consistent calculation basis for subsequent dynamic weight fusion.
[0114] S3. Calculate the similarity score between the query and the document for each semantic perspective, and fuse the scores of each perspective through dynamic weights;
[0115] Step S3 realizes the comprehensive evaluation of the semantic matching degree between the query and the document by fusing the multi-perspective similarity scores through dynamic weights. First, establish an independent similarity calculation model for each perspective, then dynamically allocate perspective weights through the attention mechanism, and finally generate a comprehensive score through weighted fusion. The specific implementation process is as follows:
[0116] Independent similarity calculation for each perspective is used to quantify the matching degree between the query and the document in a specific semantic dimension. For the keyword perspective, semantic expansion perspective, and intent perspective, the similarity of their vector representations is calculated respectively.
[0117] Exemplarily, the cosine similarity metric is adopted, and its calculation relationship is defined as:
[0118]
[0119] Where, represents the normalized vector of the query under perspective s, is the normalized vector of document di under perspective s, s ∈ {key, exp, intent}. This metric can eliminate the influence of vector norm differences on similarity and focus on direction consistency.
[0120] The dynamic weight allocation mechanism adaptively adjusts the importance of each perspective according to the semantic characteristics of the query. First, attention weights are generated through a learnable parameter vector, and the calculation relationship is satisfied:
[0121]
[0122] Where, is the trainable parameter vector, q s is the vector of the query under perspective s. The normalization operation ensures that the weights satisfy ∑ s w s = 1. This mechanism can automatically enhance the contribution of the key perspective according to the query content. For example, it can increase the weight of the keyword perspective for a query with clear terms.
[0123] w s is the dynamic weight for multi-perspective semantic fusion.
[0124] v T q s : The dot product operation of the parameter vector v and the query vector q s generates the unnormalized attention score, and T represents the vector transpose operator;
[0125] exp(·): The exponential function is used to map the attention score to the positive real number space;
[0126] q s′ : The intermediate variable that traverses all perspectives during the summation process;
[0127] The denominator ∑ s′ exp(v T q s′ ): Summing the exponential scores of all items in the perspective set to achieve weight normalization.
[0128] The fusion score calculation integrates the multi-view scores to generate the final matching evaluation. The similarity of each view is multiplied by its corresponding weight and then summed. The calculation formula is:
[0129] Score(Q,d i )=∑ s∈{key,exp,intent} w s score s ;
[0130] s∈{key,exp,intent}: a set of multi-perspective semantic dimensions, including the keyword perspective (key), semantic extension perspective (exp), and intent perspective (intent);
[0131] w s : The dynamic distribution weight of view s is generated by the above attention mechanism, satisfying ∑ s w s =1;
[0132] Score: The cosine similarity score between the query and the document at perspective s, calculated as q s ·p i,s , where q s , p i,s is the L2 normalized view vector.
[0133] This linear weighting approach can achieve global optimal fusion while preserving the independent semantic information of each view. Preferably, the similarity score and weight parameters are jointly optimized during the model training phase to ensure that the weight distribution is consistent with the semantic matching goal.
[0134] The computational process is executed sequentially to ensure consistent results. First, the similarity scores for each view are calculated in parallel. Dynamic weights are then generated based on the query vector, and finally, a weighted sum is performed. Intermediate results are passed between steps through shared memory, avoiding repeated coding and calculation. This process design balances computational efficiency and result accuracy, making it suitable for large-scale document retrieval scenarios.
[0135] Normalization preprocessing ensures the comparability of multi-view scores. Before similarity calculation, the view vectors of query and document are L2 normalized:
[0136]
[0137] Query the original semantic vector under view angle s (generated by step S2);
[0138] Document i The original semantic vector at view angle s (generated by step S2);
[0139] ||·||2: The L2 norm of the vector, and the calculation formula is
[0140] After normalization, the vector satisfies ||q s ||2 = ||p i,s ||2 = 1.
[0141] This operation maps the vector to the unit hypersphere space, making the cosine similarity equivalent to the vector dot product, and at the same time eliminating the influence of the norm difference on the weight assignment.
[0142] The initial values of the learnable parameters are generated using a normal distribution. Preferably, the initial value of the parameter vector v follows a normal distribution with a mean of 0 and a standard deviation of σ, where σ is set to This initialization strategy can alleviate the problems of gradient explosion or disappearance in the initial stage of training and accelerate the model convergence.
[0143] Through the above implementation, step S3 can dynamically integrate multi-perspective semantic information and solve the problem of insufficient coverage of a single perspective. The collaborative optimization of the weight assignment mechanism and the similarity calculation enables the model to adapt to the semantic emphasis of different queries and improve the document recall accuracy in complex scenarios.
[0144] S4. Sort the documents according to the fusion scores and return the top Top-K results.
[0145] Step S4 converts the fusion scores into the final document recall results through an efficient sorting strategy to ensure the quick return of highly relevant documents under limited computing resources. First, a two-stage sorting process is established, combining rough sorting for quick screening and fine sorting for precise sorting, and finally generating a Top-K document list. The specific implementation process is as follows:
[0146] Pre-screening of candidate documents (rough sorting stage) is used to reduce the computational scale and improve the overall efficiency. For each set of document vectors constructed from an independent perspective, nearest neighbor search is performed separately. Exemplarily, the approximate nearest neighbor algorithm (ANN) is used to retrieve the Top-K' candidate documents under each perspective. Preferably, the value of K' is an integer multiple of the target recall number K (e.g., K' = 5K). This stage obtains the local optimal candidate sets for each perspective through parallel computing, and generates a rough sorting candidate pool after merging and deduplication.
[0147] The precise calculation of the fusion scores is based on the full-scale similarity fusion of the rough sorting candidate pool. For each candidate document d i , the dynamic weight fusion formula defined in step S3 is called:
[0148]
[0149] where, q s and p i,sare the L2-normalized query and document perspective vectors, Q is the query multi-perspective vector, and d i is the document. In this stage, only the document scores within the candidate pool need to be calculated to avoid the computational overhead caused by traversing all documents.
[0150] q s and p i,s are generated by the same encoder to ensure vector space alignment.
[0151] The heap sort algorithm is implemented for Top-K screening to efficiently obtain the highest-scoring documents. A max heap data structure is established with the heap size initialized to K. Traverse all documents in the candidate pool and perform the following operations: If the score of the current document is higher than the top element of the heap, replace the top element and adjust the heap structure. The time complexity of the heap adjustment process is O(logK), and the overall time complexity is O(mlogK), where m is the number of documents in the candidate pool. This algorithm can complete the sorting in a single traversal, significantly reducing memory occupancy.
[0152] Document index pre-computation and caching support fast similarity retrieval. In the offline stage, indexes are built for the perspective vectors {p i,s} of all documents. Exemplarily, a vector database based on inverted file index (IVF) is adopted. The index construction process includes: 1) clustering the document vectors of each perspective to generate a set of cluster centers; 2) assigning the nearest neighbor cluster number to each document; 3) establishing an inverted list from the cluster centers to the documents. During online retrieval, the vector distance calculation times are reduced through coarse screening by clustering, achieving a sublinear time complexity for nearest neighbor search.
[0153] Result deduplication and formatted output ensure the uniqueness and readability of the returned documents. For the Top-K documents generated by heap sort, cross-perspective duplicates are removed according to the document ID. Preferably, a hash table is used to record the selected document IDs, and the highest-scoring version is retained when there are repeated hits. The final output list is sorted in descending order of scores and contains metadata such as the document title, abstract, and original link, meeting the processing requirements of downstream systems.
[0154] The real-time guarantee mechanism optimizes the response latency through computing resource allocation. Independent computing threads are allocated for the ANN retrieval of each perspective in the coarse ranking stage, and parallel acceleration is achieved using multi-core CPUs or GPUs. The fusion score calculation and heap sort in the fine ranking stage are executed within a unified memory space to avoid data transfer overhead. The decoupled design of index pre-computation and online retrieval can support large-scale document recall with millisecond-level responses.
[0155] Through the above implementation, step S4 can efficiently convert the multi-view fusion score into an ordered document list. The two-stage sorting strategy achieves a balance between accuracy and efficiency, and the heap sorting algorithm and index optimization ensure the stability of the system in high-concurrency scenarios. The process design directly depends on the fusion score generated by step S3 and is the core link for the overall method to achieve real-time retrieval.
[0156] It also includes a training optimization step:
[0157] Construct triplet training data containing positive and negative samples;
[0158] Calculate TripletLoss for each view, and the formula is:
[0159]
[0160] where is the triplet loss function, q s is the vector of the query under view s, and are the vectors of the positive and negative samples under view s respectively, γ is a preset boundary threshold and γ > 0, and ||·||2 is the L2 norm of the vector;
[0161] Weight and fuse the losses of each view, and the total loss function is: z
[0162]
[0163] where λ s is a learnable view weight parameter.
[0164] The training optimization step drives the collaborative optimization of the multi-view semantic encoder and the fusion weights through the triplet loss function and the multi-view joint training mechanism. The step first constructs triplet data with clear supervision signals, and then updates the model parameters through loss calculation and gradient backpropagation. The specific implementation process is as follows:
[0165] Triplet data construction is used to provide positive and negative sample contrast learning signals. Given query Q, positive sample A + is selected from the annotated documents semantically related to Q, and negative sample A - is obtained through random sampling or adversarial generation. Exemplarily, the adversarial negative sample is constructed based on the document with the lowest retrieval score to enhance the model's ability to distinguish difficult samples. The construction of the triplet (Q, A + , A - ) needs to meet the following constraints:
[0166] sin(Q, A + ) > sin(Q, A - ) + γ;
[0167] Among them, sin(·) is the similarity function, and γ is the preset boundary threshold. This constraint ensures that the semantic relevance between the positive samples and the query is significantly higher than that of the negative samples. Q is the original query text, and A + is a positive example document or answer related to the query Q, and A - is a negative example document or answer unrelated to the query Q, usually obtained by random sampling or hard sample mining.
[0168] Single-view TripletLoss calculation is used to optimize the semantic space alignment of each view. For each view s ∈ {key, exp, intent}, the distance differences between the query vector and the positive and negative sample vectors are calculated respectively. Specifically, the loss function is defined as:
[0169]
[0170] Among them, q s is the vector of the query under view s, and are the vectors of the positive and negative samples under view s respectively, and γ is the boundary threshold. This loss function forces the positive sample vector to be close to the query vector while pushing away the negative sample vector, optimizing the discriminative ability of each view.
[0171] Multi-view loss weighted fusion balances the training signals of different views through learnable parameters. The total loss function is a linear combination of the losses of each view:
[0172]
[0173] Among them, λ s is the weight parameter of view s. Preferably, the initial weights are set to equal values (such as λ s = 1 / 3), and are automatically optimized through backpropagation during training. This design allows the model to dynamically adjust the learning intensity of each view, alleviating the problem of inconsistent convergence speeds between views.
[0174] The cross-view gradient sharing mechanism enforces the consistency of the encoder parameter update directions of different views. During backpropagation, the gradient calculation of the total loss introduces a cross-view correlation term:
[0175]
[0176] Among them, is the gradient operator, θ is the shared parameter (such as the underlying network of the encoder), and α is the shared intensity coefficient. The second term maximizes the similarity of the parameter update directions of different views through the dot product of gradients, preventing the semantic spaces between views from deviating too much.
[0177] The trainable parameter vector of the model, with dimension m, covers the parameters of modules such as the encoder and classifier.
[0178] The total loss function for joint multi-task training consists of the weighted sum of losses for each task and the interaction term.
[0179]
[0180] Tasks s and s ′ The independent loss functions (such as keyword perspective loss, intent classification loss, etc.).
[0181]
[0182] The gradient vector of the loss function of task s with respect to the parameter θ is calculated as:
[0183]
[0184] Task s ′ The gradient vector of the loss function of task s with respect to the parameter θ has the same form as above.
[0185] The gradient dot product term measures the consistency of the optimization directions of different tasks in multi-task learning. By adjusting the coefficient α, its impact on the total gradient is controlled, ultimately achieving task cooperation or decoupled optimization.
[0186] The optimizer configuration and training schedule update the parameters using an adaptive learning rate algorithm. Exemplarily, the AdamW optimizer is used, and its parameter update rule is:
[0187]
[0188] where θ is the shared parameter (such as the encoder bottom network), and are the first and second moment estimates after bias correction, η is the learning rate, and ∈ is the smoothing term. During the training process, a linear learning rate warm-up strategy is adopted, and the initial learning rate gradually increases from η init to η max to avoid unstable gradients in the initial stage.
[0189] Dynamically adjust the parameter update step size according to the gradient magnitude, with larger updates corresponding to sparse gradients.
[0190] Dynamically adjust the boundary threshold to enhance training stability. Adaptively adjust the γ value according to the model convergence state:
[0191] γ (t) = γ0·(1 + β·t);
[0192] where γ is the interval parameter, γ0 is the initial threshold, β is the adjustment coefficient, and t is the training epoch. This strategy uses a smaller threshold at the beginning of training to accelerate convergence and gradually increases it later to improve the discrimination ability.
[0193] Through the above embodiments, the training and optimization steps can effectively drive the joint optimization of multi-view semantic representations and fusion weights. The combination of the triple loss and the gradient sharing mechanism ensures that the semantic spaces of different views are both independent and consistent, providing a robust vector representation basis for the document retrieval task.
[0194] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A deep dense document recall method based on multi-view vector fusion, characterized in that It includes the following steps: S1. Preprocess the user query and candidate documents to generate standardized text; S2. Construct multi-perspective semantic vector representations of the query and documents respectively. The multi-perspectives include at least the keyword perspective, semantic expansion perspective, and intention perspective; S3. Calculate the similarity scores between the query and documents for each semantic perspective, and fuse the scores of each perspective through dynamic weights; S4. Sort the documents according to the fused scores and return the top Top-K results.
2. The depth-dense document recall method based on multi-view vector fusion according to claim 1, characterized in that, The construction of the multi-perspective semantic vectors in step S2 includes: S201. Keyword perspective: Extract core terms from the query and documents through a keyword extraction algorithm, and input them into an independent encoder to generate vector representations; S202. Semantic expansion perspective: Use a large language model to generate an extended description of the query and encode it into an extended semantic vector; S203. Intention perspective: Identify the query intention type through a pre-trained classifier and map it to an intention vector.
3. The method for deep dense document recall based on multi-view vector fusion according to claim 2, characterized in that, The keyword extraction algorithm is TF-IDF or named entity recognition, and the independent encoder is the BERT model.
4. A method for deep dense document recall based on multi-view vector fusion according to claim 1, characterized in that, The dynamic weight fusion in step S3 includes: S301. Calculate the weight parameters of each perspective through an attention mechanism, and the weight assignment formula is: Among them, is a learnable parameter vector, is the vector representation of the query under the perspective s, where s ∈ {keyword perspective, semantic expansion perspective, intention perspective}; The dot product operation between the parameter vector v and the query vector q s generates unnormalized attention scores, denotes the vector transpose operator; exp(·): The exponential function is used to map the attention scores to the positive real number space; q s′ : Intermediate variable that traverses all perspectives during the summation process; Denominator Sum the exponential scores of all terms within the view angle set to achieve weight normalization; S302. Weightedly sum the similarity scores of each perspective, and the fusion formula is: Among them, is the vector representation of document d i under perspective s; Q is the input object of multi-perspective semantic fusion, which includes the original query, extended query, and intention vector; w s is the dynamic weight for multi-view semantic fusion.
5. The method for deep dense document recall based on multi-view vector fusion according to claim 1, wherein [[ID=!5]]In step S3, the similarity calculation uses cosine similarity or dot product calculation.
6. The method for deep dense document recall based on multi-view vector fusion according to claim 1, characterized in that, The sorting process in step S4 uses the heap sort algorithm, and the time complexity is O(mlogK), where m is the number of candidate documents and K is the number of returned results.
7. A method for deep dense document recall based on multi-view vector fusion according to claim 1, characterized in that, It also includes a training and optimization step: Construct triple training data including positive and negative samples; Calculate the loss function for each perspective, and the formula is: where q s is the vector under the perspective s, and are the vectors of the positive and negative samples under the perspective s respectively, and γ is a preset boundary threshold and γ > 0; Weightedly fuse the losses of each perspective, and the total loss function is: Among them, λ s is a learnable perspective weight parameter.
8. A method for deep dense document recall based on multi-view vector fusion according to claim 7, characterized in that The training and optimization step also includes a cross-perspective gradient sharing mechanism, which enforces the consistency of the gradient directions of different perspectives during backpropagation.
9. The method for depth-dense document recall based on multi-view vector fusion according to claim 2, characterized in that, The construction of the intention perspective includes: S2031. Use a pre-trained classifier to identify the intention category of the query; S2032. Align the document content with the preset intention labels to generate an intention vector.
10. A depth-dense document recall method based on multi-view vector fusion according to claim 2, characterized in that, The generation of the semantic expansion perspective includes: S2021. Generate an extended description sentence of the query through a large language model; S2022. Extract a context window from the document and encode it into an extended semantic vector.
Citation Information
Cited By
Engineering quantity list intelligent matching method
CN120634593A
Medical consumable semantic vectorization matching method and system fusing registry number constraint
CN121166759A
Fusion registration certificate number constraint medical consumable semantic vectorization matching method and system
CN121166759B
Scientific research instrument intelligent duplicate checking method based on multi-dimensional parameter decoupling and dynamic weighting
CN121210615A
Intelligent recall method based on multi-modal large model
CN121256111A