Sparse and late interaction fused retrieval routing and scoring method
By constructing a three-channel index for parallel recall and fusion score ranking, the problem of lack of adaptive channel selection and difficulty in balancing computational latency in existing information retrieval technologies is solved, achieving efficient and stable retrieval in multiple scenarios, and is suitable for applications such as search engines and regulatory retrieval.
Patent Information
- Application Number
- CN202511712495.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-02-17
AI Technical Summary
Existing information retrieval technologies suffer from several problems when processing structured numbering and semantic retrieval. These problems include a lack of query adaptation in channel selection, difficulty in balancing computational latency and accuracy, incomparability of scores across channels, and weak coupling between structured matching and semantic retrieval. As a result, online retrieval systems experience increased latency and unstable ranking under high load or long text queries.
A three-channel index is constructed, including a sparse channel, a late interaction channel, and a structured numbering channel. Channel weights are calculated through feature vector extraction and gating functions, and parallel recall and fusion score ranking are performed. Dynamic balancing is achieved by combining latency prediction values, realizing adaptive routing and latency-aware fusion.
It improves the recall accuracy and latency stability of the retrieval system in multiple scenarios, and solves the problems of channel mismatch, latency out-of-control and weak structured matching. It is suitable for application scenarios such as search engines and regulatory retrieval.
Smart Images

Figure CN121542266A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a retrieval routing and scoring method that integrates sparse and late interaction. Background Technology
[0002] Two common basic approaches in information retrieval are: 1) sparse retrieval based on term matching, such as BM25 and SPLADE-like methods that generate sparse weights using transformers; and 2) vector retrieval based on semantic representation, including dual-tower / dual-encoder and late-interaction (ColBERT-like) models. Sparse methods rely on terms and inverted indexes, offering advantages such as interpretability and latency stability, but suffer from insufficient recall in scenarios involving synonym substitution and cross-domain semantic transfer. Vector retrieval alleviates the semantic gap through continuous representation, resulting in broader recall coverage, but it is more sensitive to computational power, storage, and online latency, and computation is significantly amplified when matching long texts or multiple tokens. To improve ranking performance, the industry often uses cross-encoders or re-ranking models to perform secondary ranking on the candidate set, but this further increases tail latency.
[0003] For different query formats, existing systems often employ a hybrid approach of "multi-channel parallel recall + static weighted fusion": simultaneously enabling sparse and vector channels, or supplementing with rule / dictionary channels (such as exact matching of numbers, tables, and clauses), and then using fixed weights or simply learned global coefficients for linear combination of scores. However, this approach typically lacks adaptability to query differences: short queries, queries containing structured numbers (such as "item xy" or "Appendix A.1"), or queries with highly industry-specific terminology differ significantly from long queries and descriptive queries on the most suitable recall channel, making it difficult to balance fixed weights.
[0004] In high-concurrency or resource-constrained online environments, while late-interaction models offer good accuracy, their token-level maximum similarity aggregation leads to computational complexity that is approximately linearly amplified by the input length. Furthermore, the combined effects of ANN probing, candidate expansion, and rearrangement make the P95 / P99 latency highly sensitive to query length and content distribution, making it difficult to consistently meet predetermined SLAs. Existing solutions often use simple hyperparameter limiting (such as limiting the number of candidates or probing) to control costs, but this often results in decreased accuracy and parameter tuning relies heavily on manual experience.
[0005] On the other hand, the original score distributions of different retrieval channels exhibit inconsistencies in dimensions and drift issues: sparse scores are affected by IDF / term frequency, vector scores are sensitive to vector norm, aggregation method, and temperature; structured matching, on the other hand, displays a discrete characteristic of "high score for a hit, zero for a miss." Without effective score normalization and temperature calibration, cross-channel linear fusion may result in "strong channel dominance" or "weak channel submersion," leading to unstable overall ranking.
[0006] For structured numbering and normative citation scenarios (such as legal clauses, standard entries, test numbers, chart / appendix locations, etc.), existing practices mostly rely on regular expressions / lexical rules or tries for exact / prefix matching. However, the combination with semantic channels usually remains at the stage of post-patch: either the hit items are simply inserted into the candidate set, or a fixed bonus is assigned. There is a lack of comparability with semantic scores on the same calibration plane, which easily leads to the two extreme problems of "misplaced entries" or "hit not highlighted".
[0007] In summary, the existing technology has the following main shortcomings: (1) The channel selection lacks query adaptation, and static weighting is difficult to cover heterogeneous scenarios such as short queries, direct access by number, and long-tail cross-domain queries, resulting in channel mismatch; (2) Lack of cost / latency awareness in global trade-offs. Under high load or long text query, the amplification of late interaction computation leads to the increase of long tail latency. Current flow limiting methods are crude and sacrifice accuracy. (3) Incomparable cross-channel scores and insufficient calibration, inconsistent distribution scale / temperature lead to unstable fusion and large ranking fluctuations; (4) The structured matching and semantic retrieval are weakly coupled. The structured access capabilities such as numbering / clauses and semantic relevance cannot be uniformly expressed and weighed on the same scoring surface.
[0008] The aforementioned problems make it difficult for online retrieval systems to consistently meet the P95 / P99 delay target while ensuring accuracy, and they often fail to provide high-confidence direct access and fusion effects for queries containing structured numbers and technical terms. Summary of the Invention
[0009] The purpose of this invention is to propose a retrieval routing and scoring method that integrates sparse and late interaction to solve technical problems such as the lack of query adaptation in channel selection in existing information retrieval technologies.
[0010] To achieve this objective, the present invention adopts the following technical solution: A retrieval routing and scoring method that integrates sparse and late interactions includes the following steps: S1. Construct a three-channel index, wherein the three channels include a sparse channel, a late interaction channel, and a structured numbering channel; S2. Extract a feature vector from the input query. The feature vector includes query length, number hit information, semantic density, and inverse document frequency related features. S3. Based on the feature vector, calculate the weights of the three channels using a gating function and temperature calibration; S4. Recall candidate documents in parallel across the three channels according to the channel weights, forming a candidate union; S5. Normalize or calibrate the raw scores of the three channels to obtain comparable scores within each channel. S6. Combining the channel weights with the computational cost or latency prediction value of each channel, calculate the fusion score for the documents in the candidate union, sort them by fusion score, and output the final retrieval results.
[0011] Preferably, in step S1, constructing the sparse channel index specifically includes: using a transformer encoder to process each document in the target document set. For the document Included vocabulary items Generate logit The vocabulary entries ∈ Preset vocabulary ;right Nonnegation and sparsification are performed to obtain vocabulary entries. In the document Weights in ; Calculate vocabulary items Inverse document frequency triples Write to the inverted index to form a sparse channel index; The construction of the late interaction channel index specifically includes: for each document in the target document set... , will document Encoded as a vector sequence per token , For document The number of tokens, for each token vector Perform L2 normalization, 1≤ ≤ Based on the normalized vector sequence, an approximate nearest neighbor index structure selected from IVF-PQ or HNSW is constructed; The construction of the structured numbering channel index specifically includes: identifying number strings in the document using regular expressions, and converting the number strings into a standardized numbering key of type-major number-sub-number. A prefix tree and an inverted index mapping record number key to document ID are constructed based on standardized number keys.
[0012] Preferably, in step S2, the extraction of feature vectors from the input query specifically includes the following steps: S21. Let the input query be... Extract input query length The proportion of numbers and punctuation marks; S22. Determine the input query through the structured numbering channel index of step S1. Whether the standardized number key is hit, generate a number hit Boolean value. If a hit is recorded, the value is 1; otherwise, if a miss is recorded, the value is 0. S23. Calculate IDF quality ,in, For input query The set of words / subwords; S24, Calculate Input Query semantic density index Or the reciprocal of the perplexity of the language model. For input query The number of tokens, For input query The A token vector; S25, Statistical Input Query Entity hit count in the predefined domain dictionary ; S26. Match the number to the Boolean value. IDF quality semantic density index Entity hit count in the predefined domain dictionary and input query length The proportions of numbers and punctuation marks are integrated into a feature vector. .
[0013] Preferably, in step S3, the channel weight calculation specifically includes the following steps: S31, using feature vectors As input, sparse channels are generated through linear mapping. Evening Interaction Channel Structured numbering channel Nonnormalized allocation: ;in, , This is a channel-specific feature weight vector. For bias terms; S32, Introduce temperature parameters The three-channel weights are calculated using the softmax function: ;satisfy And weight ; S33, When the number in step S2 matches a Boolean value And enter the query Standardized numbering key of a document During exact matching, correct the structured numbering channel. Nonnormalized allocation: ;in, It is a small positive number; adjust the temperature parameter. : ;in, The initial temperature. , These are preset parameters.
[0014] Preferably, in step S4, the parallel recall specifically includes the following steps: S41. Let the total size of the candidate union be... Introducing nonnegative hyperparameters , Allocate candidate quotas for each channel according to channel weight: ; S42. Based on the three-channel index of step S1, recall Top- in each channel respectively. Top- Top- The documents retrieved from each channel are merged and deduplicated to form a candidate union set. : ;in, .
[0015] Preferably, in step S5, the fraction processing specifically includes the following steps: S51. Calculation of raw scores for each channel: The original fractions of the sparse channels are as follows: Calculate, where, For this item Enter query The weights in the calculation method are the same as those in the calculation method. Consistent, For input query With Documents The set of common words / subwords; The original score of the late interaction channel is as follows: Calculate, where, To query the number of tokens, For the number of document tokens, , The token vector after L2 normalization; The original scores of the structured numbered channels are calculated hierarchically according to the matching type: ; in, , ; For input query With standardized numbering keys prefix matching length, For input query With standardized numbering keys Edit distance, For accurate matching, For prefix matching, For fuzzy matching, For other matches; S52. Standardize the above raw scores using a sliding statistic or calibrate them using a learnable affine sigmoid function to obtain comparable scores for each channel. : The sliding statistic is standardized as follows: ;in, , Channels Enter query upper candidate union The mean and standard deviation of the scores; The affine Sigmoid function is: ;in, For learnable parameters, This is the Sigmoid function.
[0016] Preferably, in step S6, the fusion score calculation specifically includes the following steps: S61. Obtain the computational cost or delay prediction value of the three channels through a preset cost / delay regressor. ; S62. Introducing Budget Constants Intensity of cost and punishment Calculate the fusion score of document d :
[0017] S63, Press Descending order of candidate unions Sorting and extracting documents in the middle. Output of 1 document, among which It is a preset positive integer.
[0018] Preferably, it also includes model training step S7: S71. Collect a training sample set, the training sample set containing input queries. Example document Negative example documents ; S72, based on fusion score Based on this, pairwise loss or list-type loss based on NDCG is used to train the gate function parameters in step S3 and the calibration parameters in step S5 offline. The pairwise loss for: ; S73. Introduce a cross-encoder as the teacher model to standardize the scores output by the teacher model: ;in, This represents the mean score of the teacher model on the training sample set. The standard deviation of the teacher model scores; S74, Construction of Distillation Loss : Combine the aforementioned losses to jointly optimize the teacher model parameters.
[0019] Preferably, it also includes an online adaptive step S8: S81. Calculate the predicted delay values for the three channels using a cost / delay regressor. Obtain the overall delay prediction value : ; S82, Preset SLA delay threshold ,like > Calculate the delay exceeding the threshold. Introducing adjustment coefficient Adjust the weight of the late interaction channel: ; Synchronous Press The proportion of candidate quotas for late-interaction channels is reduced. The reduced quota will be calculated as follows: The proportion is allocated to sparse channels and structured numbered channels. After updating the quota, steps S4-S6 are executed again.
[0020] Preferably, in step S1: the nonnegation function of the sparse channel can be replaced by the ReLU function or the Softplus function; the token vector aggregation method of the late interaction channel can be replaced by softmax weighted aggregation or top-p average aggregation; The ReLU function is: ; The Softplus function is: ; The softmax weighted aggregation is: ; The top-p average aggregation is: ; in, >0, For the first Each query token corresponds to the top similarity % of the document token subset.
[0021] One of the above technical solutions has the following beneficial effects: (1) Solve the channel mismatch problem: By query adaptive routing, strengthen the sparse / structured channel for short queries and structured queries, and optimize the weight of the late interaction channel for long queries and narrative queries, adapt to the heterogeneous query needs of multiple scenarios, and improve the recall accuracy.
[0022] (2) Stable control of tail latency: By integrating latency prediction and latency perception, the traditional coarse hyperparameter rate limiting is replaced. In high concurrency or long query scenarios, a dynamic balance between accuracy and P95 / P99 latency is achieved, ensuring that the system SLA is stably met.
[0023] (3) Improve the stability of fusion ranking: After normalization and calibration, the cross-channel scores are comparable, avoiding ranking fluctuations caused by differences in score distribution, and making the search results more consistent in different query scenarios.
[0024] (4) Enhance structured query capabilities: The structured numbering channel and the semantic channel are deeply coupled. Through a unified scoring framework, the structured direct access and semantic relevance are balanced to solve the problems of "misplaced access" or "hit not highlighted" and improve the availability of professional document (legal clauses, standard entries, etc.) retrieval.
[0025] (5) Reduced reliance on manual intervention: The adaptive routing and delay-aware mechanism reduces the reliance on manual parameter tuning, has good scalability, and is suitable for various application scenarios such as search engines, legal retrieval, and knowledge Q&A. Attached Figure Description
[0026] Figure 1 This is a flowchart illustrating a retrieval routing and scoring method that integrates sparse and late-interaction approaches. Detailed Implementation
[0027] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0028] A retrieval routing and scoring method that integrates sparse and late interactions includes the following steps: S1. Construct a three-channel index, wherein the three channels include a sparse channel, a late interaction channel, and a structured numbering channel; S2. Extract a feature vector from the input query. The feature vector includes query length, number hit information, semantic density, and inverse document frequency related features. S3. Based on the feature vector, calculate the weights of the three channels using a gating function and temperature calibration; S4. Recall candidate documents in parallel across the three channels according to the channel weights, forming a candidate union; S5. Normalize or calibrate the raw scores of the three channels to obtain comparable scores within each channel. S6. Combining the channel weights with the computational cost or latency prediction value of each channel, calculate the fusion score for the documents in the candidate union, sort them by fusion score, and output the final retrieval results.
[0029] This method addresses the problems of channel mismatch, latency out-of-control, score incomparability, and weak structured matching in existing retrieval technologies through a closed-loop design of "three-channel collaboration + adaptive routing + latency-aware fusion". The specific working principle is as follows: Step S1 mainly involves building a three-channel index to lay the foundation for multi-dimensional retrieval.
[0030] Step S2 mainly involves query feature extraction: extracting core features such as query length, number hit status, semantic density, and inverse document frequency quality to form a feature vector, providing data support for subsequent adaptive routing, and enabling differentiated identification of short / long queries and structured / narrative queries.
[0031] Step S3 mainly involves adaptive routing: based on the query feature vector, a three-channel non-normalized allocation is generated through a gating function, and the channel weights are calculated using a temperature-calibrated softmax function. For queries with precisely matched structured IDs, the structured channel weights are strengthened through hard gating; for long / short queries, temperature parameters are dynamically adjusted to achieve flexible switching between "single-channel focusing" and "multi-channel fusion," avoiding channel mismatch caused by static weighting.
[0032] Steps S4 and S5 mainly involve parallel recall and score calibration: candidate quotas are allocated according to channel weights, documents are recalled in parallel through three channels and a candidate union is formed, balancing retrieval coverage and efficiency; the original scores of each channel are normalized (sliding statistic standardization) or calibrated (affine-sigmoid transformation) to eliminate the dimensional differences and distribution drift of sparse scores, vector scores and structured matching scores, and solve the problem of "strong channel dominance".
[0033] Step S6 primarily involves latency-aware fusion: The fusion score calculation incorporates predicted computational costs / latency values for each channel. By adjusting the budget constant and cost penalty intensity, the overall latency is constrained to not exceed the preset SLA while ensuring retrieval accuracy. For high-concurrency or long-query scenarios, cost penalties automatically suppress excessive computation in late-interaction channels, preventing uncontrolled latency at the tail end.
[0034] To further explain, in step S1, constructing the sparse channel index specifically includes: using a transformer encoder to process each document in the target document set. , for the document included vocabulary entries generate logits , the vocabulary entry ∈ the preset vocabulary ; for perform non - negativity and sparsity processing to obtain the vocabulary entry the weight in the document ; calculate the inverse document frequency of the vocabulary entry ; write the triple into the inverted index to form a sparse channel index; The construction of the late interaction channel index specifically includes: for each document in the target document set encode the document as a token - by - token vector sequence , is the number of tokens in the document , perform L2 normalization on each token vector 1 ≤ ≤
[0035] and build an approximate nearest neighbor index structure selected from IVF - PQ or HNSW based on the normalized vector sequence; The construction of the structured number channel index specifically includes: identify the number string in the document through regular expressions and convert the number string into a standardized number key of type - main number - sub number and build a prefix tree and an inverted table recording the mapping of number key - document ID. Specifically, step S1 provides basic support for subsequent multi - scenario retrieval by constructing indexes for sparse channels, late interaction channels, and structured number channels respectively. The working principles of the construction of each channel index are as follows: 1. The working principle of sparse channel index construction is as follows: for each document in the target document set it , use the transformer encoder to perform semantic analysis on each vocabulary entry in the document that belongs to the preset vocabulary and output log (reflecting the semantic importance of the vocabulary entry in the document); through the non - negativity and sparsity function filter the negative weights and strengthen the weight proportion of the keyword table entries to ensure the sparsity of the weight distribution and reduce redundant calculations. Calculate the inverse document frequency of the vocabulary entry in the entire target document setIts value is related to the vocabulary item. The frequency of document occurrences is negatively correlated; that is, the rarer and more distinctive the term, the better. The larger; the more terms In the document Weights in and Multiplication amplifies the weight of rare terms, increasing their contribution to retrieval. Then, the "terms" are multiplied... -document -weighted value The triples of "" are written into the inverted index, making the index structure associate documents with term items as the core. During subsequent queries, relevant documents can be quickly located through term items. Highly interpretable retrieval is achieved by relying on term matching, which is suitable for short query scenarios based on keywords.
[0036] 2. The working principle of late interaction channel index construction is as follows: For each document in the target document collection... The document is split at the token (sub-word or word) granularity to generate a token sequence. Then, an encoder (such as a Transformer-type encoder) converts each token into a high-dimensional vector to form the document. Token-by-token vector sequence ( For document (the number of tokens); for each token vector (1≤ ≤ L2 normalization is performed to eliminate the interference of vector norm differences on subsequent similarity calculations, ensuring that semantic similarity is determined solely by vector direction. Based on the normalized token vector sequence, an approximate nearest neighbor (ANN) index structure of type IVF-PQ (Inverted File-Product Quantization) or HNSW (Hierarchical Navigation Small World) is constructed. IVF-PQ reduces storage and computational overhead through "clustering and bucketing + vector quantization," while HNSW achieves fast nearest neighbor search by constructing a hierarchical graph structure. Both structures significantly reduce token vector matching latency during subsequent queries while maintaining semantic retrieval accuracy, adapting to scenarios such as long queries and cross-domain semantic transfer.
[0037] 3. The working principle of the structured numbering channel index is as follows: Regular expressions are used to identify common structured numbering strings in the document (such as "Item xy", "Appendix A.1", "GB / Txxxx-xxxx"), and these strings of different formats are uniformly converted into standardized numbering keys of "type-major number-sub-number". (For example, "Article 3.2.1" is converted to "Article-3-2-1", and "Appendix A.1" is converted to "Appendix-A-1"), while redundant symbols (such as "Article" and "Section") are removed and the hierarchical separator is standardized to ".", eliminating matching errors caused by differences in numbering formats. This is based on a standardized numbering key. On the one hand, a prefix tree (Trie) is constructed, with hierarchical segments of the number (such as "item", "3", "2", "1") as tree nodes, to achieve prefix matching and fuzzy matching of the number (such as inputting "item 3.2" to match "item 3.2.1" and "item 3.2.2"); on the other hand, an inverted index is constructed to record the one-to-one correspondence between standardized number keys and document IDs, to achieve fast document location when the number is precisely matched. The two structures work together to support efficient retrieval of structured queries.
[0038] To further explain, in step S2, the extraction of feature vectors from the input query specifically includes the following steps: S21, let the input query be... Extract input query length The proportion of numbers and punctuation marks; S22. Determine the input query through the structured numbering channel index of step S1. Whether the standardized number key is hit, generate a number hit Boolean value. If a hit is recorded, the value is 1; otherwise, if a miss is recorded, the value is 0. S23. Calculate IDF quality ,in, For input query The set of words / subwords; S24, Calculate Input Query semantic density index Or the reciprocal of the perplexity of the language model. For input query The number of tokens, For input query The A token vector; S25, Statistical Input Query Entity hit count in the predefined domain dictionary ; S26. Match the number to the Boolean value. IDF quality semantic density index Entity hit count in the predefined domain dictionary and input query length The proportions of numbers and punctuation marks are integrated into a feature vector. .
[0039] Specifically, step S2 extracts the core features of the input query from multiple dimensions and integrates them into a feature vector. Essentially, this provides a precise decision-making basis for subsequent "adaptive query routing"—by quantifying the query length, structured attributes, semantic quality, and domain relevance, it achieves a precise characterization of the query type (such as short / long queries, structured / narrative queries, domain terminology queries / general queries), laying the data foundation for dynamically allocating the three-channel weights. The specific working principles of each step are as follows: Step S21 mainly involves the basic morphological feature extraction process: for the input query First, extract the length. The two basic features are the proportion of numbers and punctuation marks: among which, query length It directly reflects the simplicity or complexity of the query: short queries (such as "Article 3.2" or "BM25 optimization") usually rely on keyword or structured information retrieval, while long queries (such as "how to solve the computational amplification problem of late interaction models in long document matching") require deep semantic matching. This feature provides a direct basis for subsequent temperature parameter adjustments (low temperature for short queries to strengthen single channels, and high temperature for long queries to enhance fusion). The proportion of numbers and punctuation marks is an indirect identifier of structured queries: if the proportion of numbers (such as "3.2" or "A.1") and special punctuation marks (such as "." or "-") in the query is high, it is likely a structured query containing numbers (such as legal clauses or appendix locations), which can assist in subsequent number matching and improve the feature vector's ability to distinguish query types.
[0040] Step S22 mainly involves the structured attribute identification process: using the structured numbering channel index (including the prefix tree and inverted index of the standardized numbering key) constructed in step S1, the input query is processed. Perform number matching verification: If the input query is... If the query contains content that is identical to or matches the standardized numbering key in the index (such as "Term-3-2" or "Appendix-A-1") (exact match / prefix match), it is considered a structured query, and a boolean value for the number hit is generated. =1; otherwise, if no standardized number key is hit, it is determined to be an unstructured query. =0; This Boolean value is the core triggering condition for subsequent "hard-gated correction", that is, when When =1, the weight of the structured numbering channel needs to be strengthened to achieve direct access to the number, avoid interference from the generalized matching of the semantic channel in the structured query, and solve the defect of the traditional solution of combining structured matching and semantic retrieval in a "post-patch" manner.
[0041] Steps S23 and S24 are mainly semantic quality quantification processes: Step S23 is IDF quality calculation: based on the input query The set of words / subwords Accumulate each word / sub-word Inverse document frequency To obtain IDF quality . The frequency of a word / subword is negatively correlated with the document frequency of that word / subword. Therefore, if the query contains a large number of low-frequency, high-discrimination words (such as industry terms like "IVF-PQ quantization" and "NDCG sorting"), A high value indicates a clear semantic focus in the query, making it more suitable for precise term matching in sparse channels; if the query contains a large number of high-frequency general terms (such as "how" or "what"), A low value indicates strong semantic generalization of the query, requiring reliance on semantic vector matching in late-interaction channels to improve recall quality.
[0042] S24 is the semantic density metric calculation: Two methods are used to quantify the semantic density of the query, reflecting the semantic concentration of the query token: Method 1: Calculate the input query Mean of the L2 norm of all token vectors ( For input query The number of tokens, For input query The (a number of token vectors). The larger the L2 norm, the richer the semantic information of the token vector. A high perplexity indicates a high overall semantic density of the query (e.g., "token-level aggregation in late-interaction models"), requiring in-depth semantic mining of late-interaction channels. Method two: Calculate the reciprocal of the language model's perplexity. Perplexity measures the "prediction difficulty" of the language model for a query. The lower the perplexity (the higher the reciprocal), the more regular and logically clear the query semantics (e.g., "GB / T19001-2016 standard clauses"), suitable for structured or sparse channels; conversely, a higher perplexity indicates semantic divergence (e.g., "find any content related to the search"), requiring multi-channel fusion retrieval.
[0043] Step S25 mainly involves determining domain relevance: statistical input query. Entity hit count in preset domain dictionaries (such as "legal provisions" and "judicial interpretations" in the legal field, and "GB / T" and "ISO" in the standard field). :like A high value (e.g., a query for "GB / T28181 Appendix A.3" matching both "GB / T" and "Appendix" domain entities) indicates that the query belongs to a specific domain scenario, requiring priority activation of the sparse channel (matching domain terms) and the structured channel (matching domain numbers); if A low value (such as the general query "how to improve search speed") indicates that the query has no clear domain attributes and needs to rely on the generalized semantic matching of the late interaction channel to cover more relevant results. This feature supplements the blind spot of semantic quality features in recognizing "domain-specific queries".
[0044] Step S26 mainly involves feature vector integration: matching the extracted IDs with Boolean values from the previous steps. (Structured properties), IDF quality (Semantic distinguishability), semantic density index (Semantic concentration), domain entity hit count E(q) (domain relevance), and input query length The proportions of numbers and punctuation marks are integrated into a feature vector. This vector quantifies the four-dimensional attributes of the query: morphology, structure, semantics, and domain. The gating function in the subsequent step S3 can be based on the feature vector. It accurately determines the query type and dynamically generates three-channel weights, avoiding the "one-size-fits-all" treatment of heterogeneous queries by traditional static weighting, and solving the channel mismatch problem from the source.
[0045] To further explain, in step S3, the channel weight calculation specifically includes the following steps: S31, using feature vectors As input, sparse channels are generated through linear mapping. Evening Interaction Channel Structured numbering channel Nonnormalized allocation: ;in, , This is a channel-specific feature weight vector. For bias terms; S32, Introduce temperature parameters The three-channel weights are calculated using the softmax function: ;satisfy And weight ; S33, When the number in step S2 matches a Boolean value And enter the query Standardized numbering key of a document During exact matching, correct the structured numbering channel. Nonnormalized allocation: ;in, It is a small positive number; adjust the temperature parameter. : ;in, The initial temperature. , These are preset parameters.
[0046] Specifically, the core of step S3 is to dynamically generate weights for three channels (sparse channel s, late interaction channel l, and structured numbering channel r) based on the query feature vector extracted in step S2 through a three-level logic of "linear mapping allocation - temperature calibration adjustment - hard gating correction". Essentially, this achieves precise matching of "query type - channel capability", providing a differentiated decision-making basis for subsequent parallel recall and fusion scoring, and solving the problem that traditional static weighting cannot adapt to heterogeneous queries. The specific working principles of each step are as follows: Step S31 is mainly the process of generating non-normalized allocations: using the feature vector obtained in step S2 As input, a nonnormalized allocation is generated for each channel through a linear mapping. ,in This is a channel-specific feature weight vector used to quantify the influence of each feature on that channel, such as a structured numbering channel. of In the middle, the number hits the Boolean quantity The weight coefficient of this feature will be significantly higher than that of other features, ensuring that when the query contains structured numbers, the allocation of this channel will be prioritized. This is a bias term used to balance the base allocation level of each channel, avoiding channel allocation imbalance caused by excessively small feature values. Essentially, this step transforms the query's "morphological-structural-semantic" features into "initial fit scores" for each channel, providing a basis for subsequent weight calculations. For example, short queries and queries with high IDF quality will result in sparse channels. of Increased latency, particularly for long queries and queries with high semantic density, will lead to longer interaction channels. of Increase.
[0047] Step S32 mainly involves temperature calibration and weight normalization: introducing temperature parameters. The softmax function transforms the non-normalized allocation into channel weights that satisfy the conditions of "weight sum equal to 1 and non-negative". The core logic lies in controlling the "focus" of weight allocation through τ: when the temperature parameter When the values are relatively small (e.g., in short query scenarios), the softmax function has a significant amplifying effect on the differences in allocation, and the weights tend to concentrate on the channel with the highest initial fit score (e.g., structured queries will cause...). Approaching 1), achieving "single-channel focusing" and avoiding redundant calculations of irrelevant channels; when temperature parameters When the query size is large (e.g., long queries, descriptive queries), the softmax function's amplification effect on differences in allocation is reduced, resulting in more even weight distribution across channels and achieving "multi-channel fusion," balancing term matching in sparse channels with semantic coverage in late-interaction channels; this step utilizes temperature parameters. The dynamic adjustment solves the contradiction of traditional fixed weighting, which is either limited by a single channel or generalized by multiple channels, and enables the weight allocation to switch flexibly according to the query type.
[0048] Step S33 mainly involves hard-gating correction and temperature parameter adjustment: 1. Hard-gating correction using structured query: When the number generated in step S2 matches the Boolean value... And enter the query 'q' and the standardized number key of a document. (From S1 structured channel index) For exact matching, directly match the structured numbered channels. The weights are hard-gated to correct the error. ( (For small positive numbers, such as 0.01): The core of this operation is to forcibly increase the weight ratio of the structured channel, ensuring that structured queries (such as "Article 3.2.1" and "Appendix A.1") preferentially achieve "direct retrieval" through this channel, avoiding the dilution of the weight of the structured channel due to the probability allocation of the softmax function, and solving the problem of "hit not being highlighted" in traditional schemes where structured matching is combined with "post-patch" style.
[0049] 2. Temperature parameter adjustment based on query length: according to the formula Dynamically adjust temperature parameters ( The initial temperature. , (Preset parameters): Short query ( Hour, Approaching 0, (Lower values, such as 0.5-1.0), weights are concentrated on the channels with the highest adaptability (such as structured channels and sparse channels); long queries ( When (large), Approaching 1, (Higher values, such as 1.5-2.0), the weights are more evenly distributed across multiple channels; the essence of this adjustment logic is to strongly correlate the query length with the "focus" of the channel weights, ensuring the retrieval efficiency of short queries and the coverage of long queries, and further optimizing the adaptive routing effect.
[0050] To further explain, in step S4, the parallel recall specifically includes the following steps: S41. Let the total size of the candidate union be... Introducing nonnegative hyperparameters , Allocate candidate quotas for each channel according to channel weight: ; S42. Based on the three-channel index of step S1, recall Top- in each channel respectively. Top- Top- The documents retrieved from each channel are merged and deduplicated to form a candidate union set. : ;in, .
[0051] Specifically, the core of step S4 is to construct a candidate union that covers multi-dimensional retrieval needs based on the channel weights generated in step S3, through the logic of "dynamic quota allocation - multi-channel parallel retrieval - candidate merging and deduplication". In essence, it maximizes the relevance and coverage of candidate documents while ensuring retrieval efficiency, avoiding the limitations of single-channel recall, and laying the foundation for subsequent accurate ranking. The working principle of each step is as follows: Step S41 mainly involves the dynamic allocation of candidate quotas: Let the total size of the candidate union be K (a preset fixed value to balance retrieval efficiency and candidate quality), and introduce a non-negative hyperparameter. (Basic quota coefficient) (Weighted correlation coefficient), according to the formula Assign candidate quotas to each channel ( , respectively corresponding to sparse channels Evening Interaction Channel Structured numbering channel Hyperparameters Its purpose is to allocate a "basic quota" to each channel, avoiding the influence of channel weight. Too small a weight (such as the weight of the structured channel in an unstructured query) will result in no candidate recall for that channel. This underscores the importance of covering the core strengths of each channel, ensuring coverage even if the structured channel has a low weight. It can still ensure the recall of a small number of potentially relevant documents, avoiding the omission of occasional structured matching needs; hyperparameters Its function is to associate channel weights with quota increments: channels with higher weights (such as the structured number channel in a structured query) Sparse channels in short keyword queries ), The larger the item, the closer it is to the quota. (by Constraints, maximum This allows for differentiated allocation, where "high-adaptability channels recall more documents and low-adaptability channels recall fewer documents." This step, through dynamic quotas, solves the problems of resource waste (recalling too many redundant documents in low-adaptability channels) or insufficient coverage (limited recall quantity in high-adaptability channels) caused by the traditional "fixed recall quantity for each channel," making the recall scale strongly tied to the channel's adaptability to the current query.
[0052] Step S42 Multi-channel parallel retrieval and candidate merging process: 1. Parallel recall based on three-channel index: Relying on the three-channel index constructed in step S1, recall operations are performed in each channel: sparse channel Based on inverted index, sorted by sparse score ( Top-down recall Documentation adapted for precise keyword matching scenarios; late-interaction channel. Based on ANN index, semantic score by late interaction ( Top-down recall Documents adapted for semantic association and cross-domain scenarios; structured numbering channels. Based on prefix trees and inverted indexes, the structured matching score is used. Top-down recall The document is adapted to structured numbering direct access scenarios; the three channels execute the recall in parallel, rather than serially, which can significantly shorten the total recall time and avoid the overall latency increase caused by the long calculation time of a single channel (such as the late interaction channel), adapting to the needs of high-concurrency online environments.
[0053] 2. Candidate merging, deduplication, and union construction: Recalling the Top-ranked candidates from the three channels... Top- Top- The documents are merged and deduplicated using document IDs to form a candidate union. The core of the merging operation is to integrate the advantages of multiple channels: highly interpretable candidates from sparse channels, semantically generalized candidates from late-interaction channels, and precise, direct-reaching candidates from structured channels, forming a three-dimensional candidate coverage of "term matching + semantic association + structured matching," avoiding blind spots in single-channel recall (such as sparse channels not being able to cover synonym replacement documents, and late-interaction channels not being able to cover structured numbered documents). The core of the deduplication operation is to remove duplicate documents, avoiding redundant processing of the same document in subsequent scoring and ranking stages, while ensuring that the candidate union size does not exceed the preset total size. Within a reasonable range, balancing computational efficiency and candidate diversity; the final candidate union is formed. This approach retains the adaptability advantages of each channel to the current query, while also covering more potentially relevant documents through multi-channel complementarity, providing a high-quality candidate basis for score labeling in step S5 and fusion ranking in step S6.
[0054] To further explain, in step S5, the fraction processing specifically includes the following steps: S51. Calculation of raw scores for each channel: The original fractions of the sparse channels are as follows: Calculate, where, For this item Enter query The weights in the calculation method are the same as those in the calculation method. Consistent, For input query With Documents The set of common words / subwords; The original score of the late interaction channel is as follows: Calculate, where, To query the number of tokens, For the number of document tokens, , The token vector after L2 normalization; The original scores of the structured numbered channels are calculated hierarchically according to the matching type: ; in, , ; For input query With standardized numbering keys prefix matching length, For input query With standardized numbering keys Edit distance, For accurate matching, For prefix matching, For fuzzy matching, For other matches; S52. Standardize the above raw scores using a sliding statistic or calibrate them using a learnable affine sigmoid function to obtain comparable scores for each channel. The sliding statistic is standardized as follows: ;in, , Channels Enter query upper candidate union The mean and standard deviation of the scores; the affine Sigmoid function is: ;in, For learnable parameters, This is the Sigmoid function.
[0055] Specifically, the core of step S3 is to solve the problem of "inconsistent dimensions and distribution drift" of scores in different retrieval channels through the logic of "accurate calculation of raw scores - normalization / calibration of cross-channel scores". This provides a comparable score basis for subsequent delay-aware fusion, while ensuring that the raw scores of each channel can truly reflect the relevance of the query and the document. The working principle of each step is as follows: Step S51 mainly involves the calculation of the raw scores for each channel: Based on the core capability differences between sparse channels, late-interaction channels, and structured numbering channels, differentiated raw score calculation methods are designed to quantify "term matching relevance," "semantic association relevance," and "structured matching relevance" respectively, ensuring the accuracy of relevance characterization for each channel's advantageous scenarios. 1. Raw fractions of sparse channels: according to the formula Calculate, where, For this item Enter query The weights in the calculation method are the same as those in the calculation method. Consistent; For input query With Documents The set of common words / sub-words; this score is quantified by multiplying and accumulating "query term weight × document term weight × inverse document frequency": the more common terms, the higher the term weight (stronger semantic importance). The larger the value (higher term differentiation), the higher the score, which accurately matches the relevance judgment of short keyword queries and retains the interpretability advantage of sparse retrieval.
[0056] 2. Raw score of the late interaction channel: according to the formula Calculate, where, To query the number of tokens, For the number of document tokens, , This is the L2-normalized token vector; the score uses an aggregation logic of "finding the best document token match for each query token": for each query token... Calculate its relationship with all document tokens The vector inner product (reflecting semantic similarity) is summed after taking the maximum value. This design retains the token-level fine-grained semantic matching capability (covering synonym replacement and cross-domain semantic transfer scenarios), and highlights key semantic associations through "max aggregation" (such as the matching of "late interaction" in the query with "ColBERT-like model" in the document), avoiding the dilution of scores by irrelevant tokens and ensuring the accuracy of semantic relevance characterization for long queries and narrative queries.
[0057] 3. The original scores for the structured numbered channels are calculated hierarchically according to the matching type: ; in, , ; For input query With standardized numbering keys prefix matching length, For input query With standardized numbering keys Edit distance; Exact match: assigns the highest fixed score when the query matches the document's normalized number key exactly. This ensures high priority for structured queries to achieve "direct hits"; prefix matching: when the query number is a prefix of the document number (e.g., "3.2" matches "3.2.1"), the score is positively correlated with the prefix matching length, balancing the relevance and priority of "partial matches"; fuzzy matching: when there is an edit distance between the query and the document number (e.g., "3.3" matches "3.2"), the score decreases exponentially as the edit distance increases. This approach covers scenarios with input errors in the numbering system and avoids mismatches of irrelevant documents. The hierarchical calculation logic accurately adapts to the diverse needs of structured queries, solves the discretization defects of the traditional "high score for a hit, zero for a miss" approach, and achieves smooth quantification of the relevance of structured matching.
[0058] Step S52 mainly involves the standardization process of moving statistics: 1. Standardization of moving statistics: according to the formula Processing, among which, , Channels Enter query upper candidate union The mean and standard deviation of the scores. This method converts the original scores of each channel into standard normal distribution scores with a mean of 0 and a standard deviation of 1 by "subtracting the mean and dividing by the standard deviation". The core advantage is "dynamic adaptation to candidate set distribution": the score distribution of the same channel may drift on different query candidate sets (e.g., sparse channels have generally higher scores for domain term queries). The sliding statistic can be calibrated in real time to ensure that the difference between "high-scoring documents" and "low-scoring documents" within a channel remains consistent after standardization, regardless of the absolute value of the original scores, and the scores across channels are on the same scale (all fluctuating around 0), avoiding fusion bias caused by distribution drift. 2. Learnable affine Sigmoid calibration: according to the formula ,in, For learnable parameters, For the sigmoid function. Affine transformation. The "scaling" and "offset" used to adjust the original score, for example, by... Amplify the discriminative power of structured channel scores, by The overall score of the late-interaction channel is lower than expected; the Sigmoid function maps the adjusted score to the [0,1] interval, ensuring that the scores across channels are all within the same numerical range, completely eliminating the difference in units; the core advantage of this method is "data-driven optimization". , Offline training (e.g., minimizing the error with the teacher model's scores) can be used to optimize the calibrated scores, making them more closely match the final ranking requirements while balancing standardization effectiveness and ranking accuracy. Both processing methods ultimately aim to convert the sparse, late-interaction, and structured scores into comparable scores. , , This provides a "fair and comparable" basis for the fusion score in step S6, avoiding fluctuations in the fusion ranking due to differences in score scales.
[0059] To further explain, in step S6, the calculation of the fusion score specifically includes the following steps: S61. Obtain the computational cost or delay prediction value of the three channels through a preset cost / delay regressor. ; S62. Introducing Budget Constants Intensity of cost and punishment Calculate the fusion score of document d :
[0060] S63, Press Descending order of candidate unions Sorting and extracting documents in the middle. Output of 1 document, among which It is a preset positive integer.
[0061] Specifically, the core of step S6 is to achieve coordinated optimization of "retrieval accuracy" and "response efficiency" within a unified scoring framework through the logic of "cost / latency awareness + multi-channel score weighted fusion". The final output is a retrieval result that takes into account both relevance and latency constraints, solving the problems of traditional fusion schemes that "emphasize accuracy over latency" or "incomparable scores across channels". The working principle of each step is as follows: Step S61 mainly involves the channel cost / delay prediction process: a structured numbered channel is obtained using a pre-set cost / delay regressor. Sparse channels in short keyword queries Enter query now The following are the predicted computational costs or latency values. The input to the regressor is the query feature vector extracted in step S2. (Including numbered Boolean values) (Structured properties), IDF quality (Semantic discriminability, etc.), and historical latency statistics for each channel (such as mean, variance, P95 / P99 latency); the regressor, trained offline (e.g., minimizing the error between predicted and actual latency, and assigning higher weights to high-quantile latency samples), can accurately characterize the relationship between query features and channel costs: for example, long queries will cause late-interaction channels to... Increased computational complexity at the token level, precise matching of structured IDs will improve the structured channel's performance. Reduce (prefix tree / inverted index for fast location); the essence of this step is to provide a quantitative basis for subsequent "cost penalty", transforming "invisible" computational overhead into "numerical indicators that can participate in fusion", and achieving an explicit trade-off between accuracy and latency.
[0062] Step S62 mainly involves the calculation of the fusion score for delay-aware processing: introducing a budget constant. (Preset overall latency / cost budget thresholds, such as 200ms, 100 units of computing power), cost penalty intensity (Control the weight of the penalty, such as 0.1-0.5), according to the formula. Calculate the fusion score of document d: Part 1 This achieves a weighted fusion of "channel weight - comparable score" to reflect the overall relevance of documents, such as channel weight. The contribution percentage of each channel (from S3) is determined, and the comparable scores are calculated. (From S5) Ensure fair aggregation of scores across channels, for example, in structured queries of structured channels. and Jointly drive the relevance score, avoiding channel mismatch in traditional static weighting; Part Two To achieve "cost-aware penalty," the relative cost under the current channel weight configuration is quantified. The weighted total cost (the higher the weight of a channel, the greater its impact on the total cost) is divided by the budget constant. This is then converted into "relative over-budget percentage," and then... Adjusting the intensity of the penalty; the calculation logic of the fusion score is essentially "relevance score minus cost penalty": if a document relies on a high-cost channel (such as a late interaction channel) to achieve high relevance, but its weighted total cost exceeds the budget by too much, the cost penalty will offset part of the relevance score, avoiding system latency out of control due to excessive pursuit of accuracy; conversely, documents with low cost and meeting the relevance standard will have a more advantageous fusion score, ensuring optimal ranking within the budget.
[0063] Step S63 mainly involves the sorting and result output process: sorted by fusion score. From largest to smallest, examine the candidate unions formed in step S4. Sort the documents in the document and extract the relevant parts. Output of one document. The preset positive integers are used, such as Top-10 and Top-20. The core of the ranking criterion is "comprehensive advantage priority": the higher the fusion score, the better the document performs in the "relevance-cost" trade-off, avoiding latency overruns caused by "highly relevant but high-cost" documents, and eliminating invalid recall of "low-cost but low-relevance" documents; truncation The design, on the one hand, meets the result display requirements of actual application scenarios by fixing the number of outputs (such as a search engine displaying 10 results per page), and on the other hand, reduces the output of redundant results by "truncating" to further reduce the cost of subsequent processing (such as user browsing and secondary filtering). This step ultimately achieves "dual excellence in accuracy and latency" in the output of search results, ensuring that the system meets the preset SLA (such as P95 latency ≤ 200ms) while maximizing user satisfaction with the search results.
[0064] Further explanation includes model training step S7: S71. Collect a training sample set, the training sample set containing input queries. Example document Negative example documents ; S72, based on fusion score Based on this, pairwise loss or list-based loss based on NDCG is used to train the gating function parameters of step S3 and the calibration parameters of step S5 offline; the pairwise loss... for: ; S73. Introduce a cross-encoder as the teacher model to standardize the scores output by the teacher model: ;in, This represents the mean score of the teacher model on the training sample set. The standard deviation of the teacher model scores; S74, Construction of Distillation Loss : Combine the aforementioned losses to jointly optimize the teacher model parameters.
[0065] Specifically, the core of step S7 is to optimize steps S3 (gating function parameters) and S5 (score calibration parameters) through a dual-track logic of "supervised training + distillation learning," ensuring the model's accuracy in "query adaptive routing" and "cross-channel score fusion." Simultaneously, it leverages the teacher model to enhance generalization ability, addressing the problems of traditional models relying on manual parameter tuning and exhibiting poor generalization. The specific working principles of each step are as follows: Step S71 mainly involves the construction of the training sample set: collecting data including input queries. Example document Negative example documents Training sample set: positive example documents : refers to the input query Documents that are semantically relevant, clicked by users, or manually labeled as "valid results" (such as "the content of Article 3.2 in the regulatory document" corresponding to the query "Article 3.2 of the regulation") are used to represent "ideal search results"; negative example documents. : refers to the input query Documents that are semantically irrelevant, not clicked by the user, or manually marked as "invalid results" (such as "other legal and regulatory documents" in the above query) are used to represent "non-target search results"; the sample set needs to cover multiple query scenarios (short / long queries, structured / narrative queries, cross-domain queries) and multi-domain data (such as regulations, standards, encyclopedias) to ensure that the trained model can adapt to heterogeneous search needs and avoid insufficient generalization ability caused by scenario bias.
[0066] Step S72 mainly involves the supervised loss training process: based on the fusion score S(q,d) calculated in step S6, "pairwise loss" or "list-type loss based on NDCG" is used to adjust the gating function parameters (such as those in the channel weight calculation) from step S3. , Temperature control parameters , , The fraction calibration parameters in step S5 (such as those in affine sigmoid calibration) Perform offline training: 1. Paired loss The training logic: The pairwise loss formula is as follows The core principle is to force a higher fusion score for positive example documents than for negative example documents: when > hour, It is a positive value. Approaching 0, paired loss A value close to 0 indicates that the current parameter configuration meets the sorting requirements; when ≤ hour, If it is a non-positive value, Increase, paired loss As the parameters increase, the model adjusts the gating and calibration parameters through backpropagation until... Significantly higher than This loss is suitable for scenarios with a large sample size and easy access to positive and negative example pairs. It can quickly optimize the "pairwise sorting capability" of parameters and ensure basic retrieval accuracy.
[0067] 2. The supplementary role of list-based loss based on NDCG: If the training samples contain "input query" If a candidate document list (instead of just positive and negative pairs) is used, a list-based loss based on NDCG (Normalized Discount Cumulative Gain) is employed: NDCG measures the "ranking position of highly relevant documents" in the candidate list, with higher values indicating that high-quality documents rank higher. The list-based loss optimizes the parameters' ability to control the "overall list ranking quality" by minimizing the difference between the "NDCG corresponding to the model's predicted fusion score" and the "ideal NDCG (human-annotated ranking)," avoiding the shortcomings of pairwise loss, which only focuses on local positive and negative examples and ignores the global ranking. Both types of loss essentially adjust parameters through "ranking quality feedback" to ensure that the gating function can output channel weights that are suitable for the query and that the score calibration can generate comparable and highly discriminative channel scores, laying a foundation for accuracy in subsequent fusion.
[0068] Step S73 mainly involves the standardization process of the teacher model scores: standardizing the raw scores output by the teacher model... According to the formula Standardization, among which, This represents the mean score of the teacher model on the training sample set. The standard deviation of the teacher model scores is used; the core of standardization is to eliminate the difference in score scale between the teacher model and the student model (in this scheme), so that the scores of the two are in the same comparable range (such as a standard distribution with a mean of 0 and a standard deviation of 1), thus providing a fair basis for subsequent distillation loss calculation.
[0069] Step S74 mainly involves the construction and joint optimization process of distillation losses: constructing distillation losses The model parameters are optimized by combining the supervised loss (l_rank or list-type loss) from step S72: the distillation loss is achieved by minimizing the student model fusion score. Standardized scores with teacher model The squared difference forces the student model to learn the teacher model's "relevance judgment logic." For example, if the teacher model believes that "late interaction channels contribute more under a certain long query," the distillation loss will guide the student model to adjust the gating parameters, making the weights of late interaction channels align with the teacher model's judgment. The joint optimization logic is "basic ranking ability (supervised loss) + high-precision generalization ability (distillation loss)": supervised loss ensures that the model adapts to the ranking requirements of the training data, while distillation loss leverages the teacher model's high semantic understanding ability to improve the model's generalization to "unseen query scenarios" (such as cross-domain terminology queries and complex descriptive queries), avoiding overfitting. Finally, through optimization algorithms such as gradient descent, the gating function parameters and score calibration parameters are iteratively updated, enabling the student model to approach the ranking accuracy of the high-latency teacher model under the premise of "low-latency online inference," achieving a "balance between efficiency and accuracy."
[0070] In summary, step S7, through the process of "sample construction - supervised training - distillation transfer", provides data-driven optimization basis for the core parameters of the entire retrieval framework, ensuring that the routing, recall, and fusion logic of steps S3-S6 can stably output high-quality retrieval results, and avoiding the accuracy fluctuations and insufficient generalization caused by the reliance on manual parameter tuning in traditional solutions.
[0071] Further explanation includes the online adaptive step S8: S81. Calculate the predicted delay values for the three channels using a cost / delay regressor. Obtain the overall delay prediction value : ; S82, Preset SLA delay threshold ,like > Calculate the delay exceeding the threshold. Introducing adjustment coefficient Adjust the weight of the late interaction channel: ; Synchronous Press The proportion of candidate quotas for late-interaction channels is reduced. The reduced quota will be calculated as follows: The proportion is allocated to sparse channels and structured numbered channels. After updating the quota, steps S4-S6 are executed again.
[0072] Specifically, the core of step S8 is to ensure that the system meets the SLA latency requirements while maximizing retrieval accuracy during online inference through a lightweight logic of "real-time latency prediction - dynamic parameter adjustment - process re-execution," thus avoiding the rigidity defects of traditional static rate limiting. The specific principle is as follows: Step S81 mainly involves the overall time delay prediction process: based on the channel weights in step S3. Combined with the predicted delay values of each channel output by the cost / delay regressor According to the formula Calculate the overall latency prediction value. This value can accurately reflect the latency trend under the current channel configuration. If the late interaction channel has a high weight and the query is long, its high latency will directly push up the overall value, thereby providing an early warning of the risk of SLA overrun and avoiding the discovery of latency out of control only after the retrieval is completed.
[0073] Step S82 mainly involves the dynamic adjustment process for latency exceeding limits: preset SLA latency threshold. ,like > Then, a two-step adjustment will be initiated: 1. Reduce the weight of late-interaction channels: calculate the overspending. According to the formula 1. Reduce the weight of late-interaction channels. Since late-interaction channels are a major source of high latency, reducing their weight can quickly reduce overall latency, and the more severe the overrun, the greater the reduction, allowing for more precise adjustments. 2. Candidate quota compensation: Reduce the quota for late-interaction channels according to the weight reduction ratio. and the reduced quota will be allocated according to It is allocated to sparse, structured channels. This approach reduces high-cost computations and compensates for them with low-cost channel quotas, thus avoiding accuracy degradation caused by insufficient recall.
[0074] Finally, re-execute steps S4-S6 to ensure the adjustments are implemented and that the output meets both latency requirements and retains sufficient relevance.
[0075] To further explain, in step S1: the nonnegation function of the sparse channel can be replaced by the ReLU function or the Softplus function; the token vector aggregation method of the late interaction channel can be replaced by softmax weighted aggregation or top-p average aggregation; The ReLU function is: ; The Softplus function is: ; The softmax weighted aggregation is: ; The top-p average aggregation is: ; in, >0, For the first Each query token corresponds to the top similarity % of the document token subset.
[0076] Specifically, the replacement design of the sparse channel nonnegativity function and the late interaction channel token vector aggregation method in step S1 is, at its core, to provide a flexible implementation solution that adapts to different system resources and scenario requirements without changing the "three-channel index core capability," ensuring the compatibility and scalability of the technical solution. The specific working principle is as follows: 1. The replacement principle of the nonnegativity function for sparse channels: The core requirement of sparse channels is to generate "non-negative, sparse" vocabulary item weights. The original solution uses... ReLU and Softplus functions, as alternatives, also meet the nonnegativity requirement and are suitable for different technical scenarios: The ReLU function is directly retained. Non-negative values in the logit value output by the converter encoder are set to 0, while negative values are set to 0. Its advantages include extremely simple computational logic, eliminating the need for exponential and logarithmic operations, low computational power consumption and low latency during online inference, and suitability for resource-constrained systems (such as edge devices and high-concurrency, low-latency scenarios); its disadvantage is that... Gradient vanishing is common when the gradient approaches zero, but since sparse channel weights only need to "distinguish whether terms contribute" rather than being finely quantified, this defect has little impact on retrieval accuracy.
[0077] The Softplus function smooths out curves. The mapping is to non-negative values, compared to the original scheme. Their mathematical forms are completely identical, differing only in their expression; compared to ReLU, Softplus... Even when the value is negative, there is still a small output (not abruptly to 0), the gradient is smoother, which is suitable for offline training (such as when optimizing transformer encoder parameters), can reduce the gradient vanishing problem, improve model training stability, and is suitable for scenarios with high training accuracy requirements.
[0078] Both alternative functions can generate non-negative weights that meet the requirements of sparse channels, differing only in "computational efficiency" and "training smoothness," without changing the core retrieval logic of "term matching + inverted index" in sparse channels.
[0079] 2. Alternative Principles for Late Interaction Channel Token Vector Aggregation: The core requirement of the late interaction channel is to "quantify the token-level semantic association between queries and documents." The original solution uses max-sim aggregation (taking the optimal document token similarity for each query token). Softmax weighted aggregation and top-p average aggregation are alternative options that can adapt to different semantic matching requirements. The specific principles are as follows: 1. Softmax weighted aggregation for each query token First, use the softmax function (which introduces a temperature coefficient). ) and all document tokens Similarity ( , The similarity is converted into weights (the higher the document similarity, the greater the weight of the token), and then the similarity is summed with these weights. Compared to max-sim which only focuses on the "best match", this method can comprehensively consider the contribution of the "second-best match", and the semantic characterization is more comprehensive. It is suitable for long queries and semantic diffusion scenarios (such as narrative queries). Adjustable weight concentration The larger the value, the closer it is to max-sim. Smaller weights result in more even distribution, adapting to different semantic granularity requirements.
[0080] 2. Top-p average aggregation for each query token Filter out the ones with the highest similarity % of document token subset The average similarity score within the subset is calculated. This method avoids the randomness of max-sim's "single-point dependency" (such as the optimal match being a noisy token) and reduces computational cost compared to softmax weighted aggregation (only requiring processing of the initial...). %token), which balances semantic coverage and efficiency; Dynamically adjustable (e.g., short query) Focus on 10% of key matches for long queries. (Take 30% to expand coverage), adapting to different query length scenarios.
[0081] Both alternative aggregation methods are based on "token-level semantic similarity" calculation, with the only difference being the "similarity integration logic". They do not change the core retrieval logic of "semantic vector + ANN index" in the late interaction channel, and can be adapted to diverse scenario requirements through parameter optimization.
[0082] To address the shortcomings of existing information retrieval technologies, this method adaptively selects and weights different retrieval channels based on dynamic features such as query length, number hit information, semantic density, and inverse document frequency, enabling differentiated processing for diverse query scenarios. In complex scenarios such as direct access by number, short queries, and long-tail domains, the advantages of sparse, late-interaction, and structured channels are fully utilized, resulting in improved hit rates and ranking quality metrics (such as NDCG) compared to traditional sparse models (such as BM25), vector models (such as ColBERT), and statically weighted hybrid schemes.
[0083] To more intuitively illustrate the differences in performance across different scenarios, the table below presents a trend comparison of typical query types:
[0084] By introducing explicit modeling of computational cost and latency into route training and fusion scoring, the system can effectively control P95 / P99 latency while ensuring accuracy, improving stability under high concurrency environments and reducing response fluctuations caused by differences in query complexity. This latency-aware mechanism enables the retrieval service to maintain high ranking quality while meeting SLA requirements.
[0085] Cross-channel scores, after normalization and temperature calibration, are comparable, resulting in more robust fusion results. This avoids the dominance or overwhelming effect of individual channels due to differences in distribution scale on the overall ranking. Search results remain balanced across different channels, making the system perform more consistently across various query scenarios.
[0086] The unified integration of structured numbering channels and semantic retrieval channels enables direct access to structured queries such as "Article xy", "Appendix", and "Table", and works in conjunction with semantic relevance results to significantly improve the usability and user satisfaction of professional document and legal clause retrieval.
[0087] In summary, this method can achieve synergistic optimization of retrieval accuracy and latency under the same computing power budget, reduce the system's dependence on manual parameter tuning and static rate limiting, and has good scalability and interpretability. It is applicable to various application scenarios such as search engines, legal and regulatory retrieval, standard clause queries, and knowledge Q&A, and has significant technical and economic value.
[0088] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0089] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for sparse and late interaction fusion for retrieval, routing and scoring, characterized in that, Includes the following steps: S1. Construct a three-channel index, wherein the three channels include a sparse channel, a late interaction channel, and a structured numbering channel; S2. Extract a feature vector from the input query. The feature vector includes query length, number hit information, semantic density, and inverse document frequency related features. S3. Based on the feature vector, calculate the weights of the three channels using a gating function and temperature calibration; S4. Recall candidate documents in parallel across the three channels according to the channel weights, forming a candidate union; S5. Normalize or calibrate the raw scores of the three channels to obtain comparable scores within each channel. S6. Combining the channel weights with the computational cost or latency prediction value of each channel, calculate the fusion score for the documents in the candidate union, sort them by fusion score, and output the final retrieval results.
2. The retrieval routing and scoring method based on sparse and late interaction fusion according to claim 1, characterized in that, In step S1, constructing the sparse channel index specifically includes: using a transformer encoder to process each document in the target document set. For the document Included vocabulary items Generate logit The vocabulary entries ∈ Preset vocabulary ;right Nonnegation and sparsification are performed to obtain vocabulary entries. In the document Weights in ; Calculate vocabulary items Inverse document frequency triples Write to the inverted index to form a sparse channel index; The constructing the late interaction channel index specifically comprises: constructing an approximate nearest neighbor index structure selected from IVF-PQ or HNSW based on the normalized vector sequence. , encoding the document into a sequence of token vectors , , performing L2 normalization on each token vector based on the number of tokens of the document , 1≤ ≤ , constructing an approximate nearest neighbor index structure selected from IVF-PQ or HNSW based on the normalized vector sequence. The constructing structured numbering channel index specifically comprises: identifying numbering strings in the document through a regular expression, and converting the numbering strings into standardized numbering keys of type-main numbering-sub numbering , constructing a prefix tree based on the standardized numbering keys and an inverted table recording the numbering key-document ID mapping.
3. The method of claim 1, wherein, In step S2, the extraction of feature vectors from the input query specifically includes the following steps: S21, set input query as , extract length , number and punctuation proportion of input query ; S22, judging the input query by the structured number channel index of step S1 whether the standardized number key is hit, generating a number hit boolean , if hit is 1, otherwise 0; S23, compute IDF quality wherein, is a set of words / subwords for the input query ; S24, computing semantic density indicator for input query S25, count input query Number of entity hits in preset domain dictionary ; S26. Match the number to the Boolean value. IDF quality semantic density index Entity hit count in the predefined domain dictionary and input query length The proportions of numbers and punctuation marks are integrated into a feature vector. .
4. The sparse and late interaction integrated retrieval, routing and scoring method of claim 1, wherein, In step S3, the channel weight calculation specifically includes the following steps: S31, feature vector Sparse channels generated by linear mapping for input Late interaction channel Structured numbering channel Non-normalized allocation amount: ; wherein, , is a channel-specific feature weight vector, is a bias term; S32, introduce temperature parameter Calculate three-channel weights by a softmax function: ; satisfy and weights ; S33, when the number hit Boolean in step S2 and the input query matches the normalized number key of a document correct the structured number channel when there is an exact match non-normalized allocation: ; wherein is a small positive number; Adjusting temperature parameters : ; wherein, is an initial temperature, , is a preset parameter.
5. The sparse and late interaction integrated retrieval, routing and scoring method of claim 1, wherein, In step S4, the parallel recall specifically includes the following steps: S41. Let the total size of the candidate union be... Introducing nonnegative hyperparameters , Allocate candidate quotas for each channel according to channel weight: ; S42. Based on the three-channel index of step S1, recall Top- in each channel respectively. Top- Top- The documents retrieved from each channel are merged and deduplicated to form a candidate union set. : ; in, .
6. The retrieval routing and scoring method based on sparse and late interaction fusion according to claim 1, characterized in that, In step S5, the fraction processing specifically includes the following steps: S51. Calculation of raw scores for each channel: The original fractions of the sparse channels are as follows: Calculate, where, For this item Enter query The weights in the calculation method are the same as those in the calculation method. Consistent, For input query With Documents The set of common words / subwords; The original score of the late interaction channel is as follows: Calculate, where, To query the number of tokens, For the number of document tokens, , The token vector after L2 normalization; The original scores of the structured numbered channels are calculated hierarchically according to the matching type: ; in, , ; For input query With standardized numbering keys prefix matching length, For input query With standardized numbering keys Edit distance, For accurate matching, For prefix matching, For fuzzy matching, For other matches; S52. Standardize the above raw scores using a sliding statistic or calibrate them using a learnable affine sigmoid function to obtain comparable scores for each channel. : The sliding statistic is standardized as follows: ; in, , Channels Enter query upper candidate union The mean and standard deviation of the scores; The affine Sigmoid function is: ; in, For learnable parameters, This is the Sigmoid function.
7. The retrieval routing and scoring method based on sparse and late interaction fusion according to claim 1, characterized in that, In step S6, the fusion score calculation specifically includes the following steps: S61. Obtain the computational cost or delay prediction value of the three channels through a preset cost / delay regressor. ; S62. Introducing Budget Constants Intensity of cost and punishment Calculate the fusion score of document d : S63, Press Descending order of candidate unions Sorting and extracting documents within the file. Output of 1 document, among which It is a preset positive integer.
8. The retrieval routing and scoring method based on sparse and late interaction fusion according to claim 1, characterized in that, It also includes model training step S7: S71. Collect a training sample set, the training sample set containing input queries. Example document Negative example documents ; S72, based on fusion score Based on this, pairwise loss or list-type loss based on NDCG is used to train the gate function parameters in step S3 and the calibration parameters in step S5 offline. The pairwise loss for: ; S73. Introduce a cross-encoder as the teacher model to standardize the scores output by the teacher model: ; in, This represents the mean score of the teacher model on the training sample set. The standard deviation of the teacher model scores; S74, Construction of Distillation Loss : ; We combine the aforementioned losses to optimize the teacher model parameters.
9. The retrieval routing and scoring method based on sparse and late interaction fusion according to claim 1, characterized in that, It also includes the online adaptive step S8: S81. Calculate the predicted delay values for the three channels using a cost / delay regressor. Obtain the overall delay prediction value : ; S82, Preset SLA delay threshold ,like > Calculate the delay exceeding the threshold. Introducing adjustment coefficient Adjust the weight of the late interaction channel: ; Synchronous Press The proportion of candidate quotas for late-interaction channels is reduced. The reduced quota will be calculated as follows: The proportion is allocated to sparse channels and structured numbered channels. After updating the quota, steps S4-S6 are executed again.
10. A retrieval routing and scoring method that fuses sparse and late interactions according to any one of claims 1-9, characterized in that, In step S1: The nonnegativity function of the sparse channel can be replaced by the ReLU function or the Softplus function; The token vector aggregation method of the late interaction channel can be replaced by softmax weighted aggregation or top-p average aggregation; The ReLU function is: ; The Softplus function is: ; The softmax weighted aggregation is: ; The top-p average aggregation is: ; in, >0, For the first Each query token corresponds to the top similarity % of the document token subset.