Gene biological knowledge lightweight retrieval method and device based on vector database
Patent Information
- Application Number
- CN202611157523.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-27
AI Technical Summary
本发明解决了现有技术存在的计算资源消耗大、存储成本高、量化精度损失以及上下文信息缺失的问题
在双流注意力编码模型引入知识蒸馏模块,使用参数量精简的学生模型替代庞大的预训练大模型进行推理。在保留了预训练大模型强特征提取能力的同时,显著降低了模型的参数量和计算复杂度,从而大幅提高了推理速度,满足了实时检索的需求;基于重要性感知的自适应乘积量化索引,将原本高维浮点型的稠密向量转换为紧凑的索引代码进行存储,这种量化处理大幅压缩了向量的存储空间,有效降低了对内存和存储硬件资源的要求,使得系统能够低成本地应对基因生物知识库庞大的规模;根据各维度特征的信息熵动态分配量化比特位,相比传统方法对各维度采用均等比特分配,能够为包含丰富信息的高熵维度分配更多比特位,从而保留关键的区分性特征,有效减少了因量化压缩带来的精度损失,在相同存储成本下显著提升了向量检索的精度;采用图谱上下文增强的重排序机制,利用图注意力网络聚合候选实体在基因生物知识图谱中的邻居节点属性,使得检索过程不再局限于查询与候选文档的直接匹配,而是引入了生物体内的复杂关系网络作为上下文校准,有效解决了语义偏差问题,显著提高了最终检索结果的相关性和准确性。
Smart Images

Figure CN122991267A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioinformatics technology, and in particular to a lightweight retrieval method and apparatus for gene biological knowledge based on a vector database. Background Technology
[0002] With the rapid development of high-throughput sequencing technology, genomic biological data is growing exponentially, including massive amounts of gene sequence data, complex biomedical literature, and abundant protein functional domain annotation data. How to quickly and accurately retrieve the knowledge needed by users from this multimodal, large-scale data has become a hot topic in current bioinformatics research.
[0003] Traditional keyword-based retrieval methods often struggle to handle semantically complex queries and fail to uncover deep connections between gene sequences and functional semantics. In recent years, dense vector-based semantic retrieval techniques have emerged, mapping data to a low-dimensional vector space and achieving semantic matching through vector similarity calculations. However, genetic biological data is characterized by high dimensionality, sparsity, and multimodality, and directly using general vector retrieval models presents the following problems: 1) High computational resource consumption: Although existing pre-trained large models have strong feature extraction capabilities, they have a huge number of parameters and slow inference speed, making it difficult to meet the needs of real-time retrieval.
[0004] 2) High storage cost: The genetic biological knowledge base is huge, and directly storing high-dimensional floating-point vectors requires extremely high memory and storage space.
[0005] 3) Quantization accuracy loss: Existing vector quantization indexing methods (such as product quantization) usually use equal bit allocation for each dimension of the vector, ignoring the differences in the importance of different dimensional features for retrieval, resulting in a decrease in retrieval accuracy.
[0006] 4) Missing contextual information: Existing retrieval methods only focus on the direct matching between the query and candidate documents, ignoring the complex relationship network of gene entities in the biological knowledge graph, resulting in inaccurate relevance ranking of retrieval results.
[0007] Therefore, there is an urgent need for a lightweight gene and biological knowledge retrieval method that can balance retrieval efficiency, storage cost, and retrieval accuracy. Summary of the Invention
[0008] This invention provides a lightweight retrieval method and apparatus for gene biological knowledge based on a vector database. This invention solves the problems of high computational resource consumption, high storage costs, loss of quantization accuracy, and lack of contextual information in existing technologies.
[0009] In a first aspect, embodiments of the present invention provide a lightweight retrieval method for gene biological knowledge based on a vector database, the method comprising: Based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, including several structured knowledge tuples, are constructed. Using a domain-aware dual-stream attention encoding model, local syntactic features of gene sequences and global semantic features of functional domains are extracted from each structured knowledge tuple, and then fused and generated into a lightweight dense vector through knowledge distillation. Construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension of features in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the resulting quantized lightweight dense vector into a vector database. Receive the user's query string, generate a query vector, perform a hybrid index retrieval in the vector database, and obtain an initial candidate set; Based on the graph context enhancement reordering mechanism, the initial candidate set is reordered by combining the attributes of the neighbor nodes of the candidate entities in the gene biological knowledge graph, and the final search results are obtained.
[0010] The technical solution provided in this application has at least the following beneficial effects: In the two-stream attention encoding model, a knowledge distillation module is introduced, and a student model with fewer parameters is used to replace the large pre-trained model for inference. While retaining the strong feature extraction capabilities of pre-trained large models, the system significantly reduces the number of model parameters and computational complexity, thereby greatly improving inference speed and meeting the needs of real-time retrieval. Based on importance-aware adaptive product quantization indexing, the system converts the originally high-dimensional floating-point dense vectors into compact index codes for storage. This quantization process significantly compresses the vector storage space, effectively reducing the requirements for memory and storage hardware resources, enabling the system to handle the massive scale of the genetic biology knowledge base at low cost. The system dynamically allocates quantization bits based on the information entropy of each dimension's features. Compared to traditional methods that use equal bit allocation for each dimension, this approach allocates more bits to high-entropy dimensions containing rich information, thus preserving key discriminative features and effectively reducing accuracy loss due to quantization compression. This significantly improves the accuracy of vector retrieval at the same storage cost. A graph context-enhanced re-ranking mechanism is employed, utilizing a graph attention network to aggregate the neighbor node attributes of candidate entities in the genetic biology knowledge graph. This means the retrieval process is no longer limited to direct matching between queries and candidate documents, but introduces the complex relationship network within the organism as context calibration, effectively solving the semantic bias problem and significantly improving the relevance and accuracy of the final retrieval results.
[0011] In one optional implementation, a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, comprising several structured knowledge tuples, are constructed based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, including: Gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets were collected and preprocessed to obtain cleaned sets of gene sequences, biomedical literature documents, and protein functional domain labels. The gene sequences in the cleaned gene sequence set are associated and aligned with the text descriptions in the corresponding biomedical literature document set and the functional domain labels in the protein functional domain label set based on unique identifiers to obtain a structured knowledge tuple for each gene, and a gene biological multimodal knowledge base with several structured knowledge tuples is constructed. A biomedical named entity recognition model based on natural language processing algorithms is used to extract several named entities and several entity relationships from a collection of biomedical literature documents. Construct a corresponding gene biological knowledge graph based on several named entities and several entity relationships.
[0012] In one alternative implementation, the dual-stream attention coding model includes an input coding module, a sequence stream Transformer encoder, a functional domain stream Transformer encoder, a cross-attention fusion module, a knowledge distillation module, and a normalization and output generation module.
[0013] In one alternative implementation, the knowledge distillation module uses the dual-stream attention encoding model containing complete parameters as the teacher model and a simplified lightweight model as the student model. During the training phase, a pre-collected set of training samples is used to perform knowledge distillation training on the teacher model and the student model based on the joint optimization loss function, resulting in a well-trained student model.
[0014] In one alternative implementation, the formula for the joint optimization loss function is:
[0015] In the formula, To jointly optimize the loss value; This represents the knowledge distillation loss value. This is the triplet loss value; This is the weighting balance coefficient.
[0016] In one alternative implementation, a domain-aware two-stream attention encoding model is used to extract the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple, respectively. These features are then fused and knowledge distilled to generate a lightweight, dense vector, including: Each structured knowledge tuple in the genetic biological multimodal knowledge base is input into a functional domain-aware two-stream attention encoding model; Using the input encoding module, the gene sequence in the structured knowledge tuple is segmented by a sliding window to obtain the word sequence, and the functional domain labels in the same structured knowledge tuple are embedded to obtain the functional domain embedding vector sequence. The sequence stream Transformer encoder is used to extract local syntactic features of word sequences; The global semantic features of the functional domain embedding vector sequence are extracted using the functional domain flow Transformer encoder. Using local syntactic features as query vectors and global semantic features as key and value vectors, a cross-attention fusion module is used. Based on the cross-attention mechanism, functional domain features are injected into sequence features, and the hidden state of the fused features is calculated. The hidden state corresponding to the [CLS] token is taken as the fused feature vector. During the inference phase, a lightweight output feature vector that integrates the fused feature vectors is generated using the trained student model. The normalization and output generation module is used to perform feature pooling, dimensionality projection and L2 normalization on the lightweight output feature vector, transforming the lightweight output feature vector into a lightweight dense vector.
[0017] In one optional implementation, an importance-aware adaptive product quantization index is constructed. The information entropy of each dimension of the features in each lightweight dense vector is calculated. Quantization bits are dynamically allocated based on the information entropy for quantization processing. The resulting quantized lightweight dense vector is then stored in a vector database, including: Based on the set number of global clusters, perform global K-Means clustering on all lightweight dense vectors to generate a set of global cluster centers. Construct an inverted linked list for each global cluster center and assign the lightweight dense vector to the nearest inverted linked list. Based on the set number of subspaces, each lightweight dense vector is divided into a corresponding number of subvectors along the dimensional direction, and the same subvector of all lightweight dense vectors is integrated as a submatrix to obtain a set of submatrices. Based on the characteristics of each dimension in the submatrix set, calculate the information entropy of each subspace, and dynamically allocate bits for quantizing each subspace according to the information entropy; Based on the bits of each subspace, determine the corresponding number of sub-cluster centers, and use the K-Means clustering algorithm to cluster the corresponding submatrix, generating the corresponding number of sub-cluster centers, and obtaining the set of sub-cluster centers; Combine the codewords of all sub-cluster centers in each subspace of the sub-cluster center set to obtain the codebook for each subspace; Based on the trained codebook, the lightweight dense vectors in the inverted linked list are converted into compact index codes to obtain the quantized lightweight dense vectors. The quantized lightweight dense vectors, the global cluster center set, and the index information of the inverted linked list are stored in a pre-built vector database, and a vector database index is constructed.
[0018] In one optional implementation, the system receives the user's query string, generates a query vector, performs a hybrid index retrieval in a vector database, and obtains an initial candidate set, including: Receive the query string input by the user and map it to a token sequence; The token sequence is input into the trained student model of the two-stream attention encoding model to generate a query vector; Calculate the Euclidean distance between the query vector and each cluster center in the cluster center set. Access the inverted linked list of several target cluster centers whose Euclidean distance is less than the Euclidean distance threshold, and extract all candidate vector IDs contained therein to form a coarse selection set. The query vector is divided into several query sub-vectors along the dimension. For each subspace, the distance between the query sub-vector and the sub-cluster centers in the corresponding codebook is calculated, and a distance lookup table is generated. Based on the distance lookup table, the approximate distance between the query vector and the candidate vectors in the coarse selection set is obtained by summing the distances of each subspace through the lookup table according to the index code of the candidate vector; Based on approximate distances, the coarsely selected set is sorted, and the highest quality results are selected as the initial candidate set.
[0019] In one optional implementation, a re-ranking mechanism based on graph context enhancement, combined with the attributes of neighboring nodes of candidate entities in the gene biological knowledge graph, re-ranks the initial candidate set to obtain the final retrieval results, including: For each candidate entity in the initial candidate set, perform 1-hop or 2-hop neighbor sampling in the gene biological knowledge graph to obtain several neighbor nodes, and then construct a local subgraph by the candidate entity and its corresponding neighbor nodes. The lightweight dense vectors corresponding to each candidate entity and several neighboring nodes of the entity type "gene" are used as initial node features, and the textual description semantic features of other neighboring nodes of the entity type "non-gene" are used as initial node features to obtain the set of initial node feature matrices for each subgraph. The initial node feature matrix set of each subgraph is input into the graph attention network to generate the corresponding candidate node enhanced feature vector rich in context information; The similarity between the query vector and the enhanced feature vector of each candidate node is calculated using cosine similarity or dot product. Based on the similarity, the initial candidate set is reordered, and the top few candidate entities in the reordered candidate set are selected as the final retrieval results.
[0020] Secondly, embodiments of the present invention provide a lightweight retrieval device for gene biological knowledge based on a vector database, used to implement a lightweight retrieval method for gene biological knowledge. The device includes: The multimodal knowledge base construction unit is used to construct a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, which includes several structured knowledge tuples, based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets. The functional domain-aware coding unit is used to extract the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple using a functional domain-aware two-stream attention coding model, and then fuse and generate a lightweight dense vector through knowledge distillation. The adaptive quantization index unit is used to construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension feature in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the resulting quantized lightweight dense vector into the vector database. The hybrid retrieval unit is used to receive the user's query string, generate a query vector, perform hybrid index retrieval in the vector database, and obtain an initial candidate set. The graph-enhanced ranking unit is used for a re-ranking mechanism based on graph context enhancement. It combines the attributes of the neighboring nodes of candidate entities in the gene biological knowledge graph to re-rank the initial candidate set and obtain the final retrieval results.
[0021] A third aspect of this invention provides an electronic device, which includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by at least one processor, such that the at least one processor can perform the method proposed in the first aspect of the present invention.
[0022] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in the first aspect of the present invention. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the electronic device structure of the hardware operating environment involved in the embodiments of the present invention; Figure 2 This is a flowchart illustrating the steps of a lightweight retrieval method for gene biological knowledge based on a vector database, as provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the functional units of a lightweight gene biological knowledge retrieval device based on a vector database provided in an embodiment of the present invention. Detailed Implementation
[0024] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0025] The present invention will be further described below with reference to the accompanying drawings.
[0026] Reference Figure 1 , Figure 1 This is a schematic diagram of the electronic device structure of the hardware operating environment involved in the embodiments of the present invention.
[0027] like Figure 1As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0028] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0029] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a data storage module, a network communication module, a user interface module, and an electronic program for a lightweight gene biological knowledge retrieval device based on a vector database.
[0030] exist Figure 1 In the illustrated electronic device, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be installed in the electronic device. The electronic device calls the electronic program of the lightweight gene biological knowledge retrieval device based on the vector database stored in the memory 1005 through the processor 1001, and executes the lightweight gene biological knowledge retrieval method based on the vector database provided in the embodiment of the present invention.
[0031] Reference Figure 2 The present invention provides a lightweight retrieval method for gene biological knowledge based on a vector database, the method comprising: S201: Based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, construct a gene biological multimodal knowledge base including several structured knowledge tuples and a corresponding gene biological knowledge graph. S202: Using a domain-aware dual-stream attention coding model, the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple are extracted, fused and generated into a lightweight dense vector through knowledge distillation. S203: Construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension feature in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the resulting quantized lightweight dense vector into the vector database. S204: Receive the user's query string, generate a query vector, perform a hybrid index retrieval in the vector database, and obtain an initial candidate set; S205: A re-ranking mechanism based on graph context enhancement combines the attributes of neighboring nodes of candidate entities in the gene biological knowledge graph to re-rank the initial candidate set and obtain the final retrieval results.
[0032] The technical solution provided in this application has at least the following beneficial effects: In the two-stream attention encoding model, a knowledge distillation module is introduced, and a student model with fewer parameters is used to replace the large pre-trained model for inference. While retaining the strong feature extraction capabilities of pre-trained large models, the system significantly reduces the number of model parameters and computational complexity, thereby greatly improving inference speed and meeting the needs of real-time retrieval. Based on importance-aware adaptive product quantization indexing, the system converts the originally high-dimensional floating-point dense vectors into compact index codes for storage. This quantization process significantly compresses the vector storage space, effectively reducing the requirements for memory and storage hardware resources, enabling the system to handle the massive scale of the genetic biology knowledge base at low cost. The system dynamically allocates quantization bits based on the information entropy of each dimension's features. Compared to traditional methods that use equal bit allocation for each dimension, this approach allocates more bits to high-entropy dimensions containing rich information, thus preserving key discriminative features and effectively reducing accuracy loss due to quantization compression. This significantly improves the accuracy of vector retrieval at the same storage cost. A graph context-enhanced re-ranking mechanism is employed, utilizing a graph attention network to aggregate the neighbor node attributes of candidate entities in the genetic biology knowledge graph. This means the retrieval process is no longer limited to direct matching between queries and candidate documents, but introduces the complex relationship network within the organism as context calibration, effectively solving the semantic bias problem and significantly improving the relevance and accuracy of the final retrieval results.
[0033] In one optional implementation, a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, comprising several structured knowledge tuples, are constructed based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, including: S2011: Collect gene sequence datasets from databases such as NCBI, biomedical literature datasets from PubMed, and protein functional domain annotation datasets from Pfam / InterPro, and preprocess them to obtain cleaned sets of gene sequences, biomedical literature documents, and protein functional domain labels. In this embodiment, the gene sequence dataset is denoised and stop word removed; the biomedical literature dataset is redundantly removed; and the protein functional domain annotation dataset is standardized with ID mapping. S2012: The gene sequences in the cleaned gene sequence set are associated and aligned with the text descriptions in the corresponding biomedical literature document set and the functional domain labels in the protein functional domain label set based on unique identifiers to obtain the structured knowledge tuples of each gene, and a gene biological multimodal knowledge base with several structured knowledge tuples is constructed. In this embodiment, Gene ID or UniProt Accession is used as a unique identifier to align the three datasets mentioned above. S2013: Using a biomedical named entity recognition model built on a natural language processing algorithm, extract several named entities and several entity relationships from a collection of biomedical literature documents; In this embodiment, either Bidirectional Encoder Representations from Transformers for Biomedical Text Mining (BioBERT) or Bidirectional Encoder Representations from Transformers for Scientific Text (SciBERT) are selected as pre-trained models and fine-tuned on labeled datasets such as BC5CDR to enable them to recognize entities such as "Gene", "Disease", and "Chemical". Using entities as nodes and relationships as edges, construct a gene biological knowledge graph in the form of RDF or attribute graph. For example, the node "BRCA1" is connected to the node "Breast Cancer" through the edge "mutation". S2014: Construct a corresponding gene biological knowledge graph based on several named entities and several entity relationships.
[0034] In one optional implementation, the dual-stream attention coding model includes an input coding module, a sequence stream Transformer encoder, a functional domain stream Transformer encoder, a cross-attention fusion module, a knowledge distillation module, and a normalization and output generation module. The input encoding module is used to perform sliding window segmentation on gene sequences in structured knowledge tuples to obtain word sequences, and to embed functional domain labels in the same structured knowledge tuple to obtain functional domain embedding vector sequences. A sequence stream Transformer encoder is used to extract local syntactic features from word sequences; Functional domain flow Transformer encoder, used to extract global semantic features from functional domain embedding vector sequences; The cross-attention fusion module is used to use local syntactic features as query vectors and global semantic features as key and value vectors. Based on the cross-attention mechanism, it injects functional domain features into sequence features, calculates the hidden state of the fused features, and takes the hidden state corresponding to the [CLS] token as the fused feature vector. The knowledge distillation module is used to perform knowledge distillation training on the teacher model and student model during the training phase to obtain a well-trained student model. During the inference phase, the well-trained student model is used to generate a lightweight output feature vector that fuses the feature vectors. The normalization and output generation module is used to perform feature pooling, dimensionality projection, and L2 normalization on the lightweight output feature vector, converting the lightweight output feature vector into a lightweight dense vector.
[0035] In one alternative implementation, the knowledge distillation module uses the dual-stream attention encoding model containing complete parameters as the teacher model and a simplified lightweight model as the student model. During the training phase, a pre-collected set of training samples is used to perform knowledge distillation training on the teacher model and the student model based on the joint optimization loss function, resulting in a well-trained student model.
[0036] In one alternative implementation, the formula for the joint optimization loss function is:
[0037] In the formula, To jointly optimize the loss value; This represents the knowledge distillation loss value. This is the triplet loss value; This is the weighting balance coefficient (hyperparameter, value range [0,1]), and in this embodiment, it is set to 0.7 (focusing more on distillation knowledge). This is a temperature coefficient used to control the "smoothness" of the softmax output; in this embodiment, it is set to 4.0 (softening the softmax distribution). The output logits of the student model are the original numerical vectors (such as feature scores) of the student model before softmax activation in the last layer. The output logits of the teacher model are the original numerical vectors output by the teacher model with a larger number of parameters. This is a normalized exponential function that converts numerical values into a probability distribution. KL divergence is used to measure the distance (difference) between two probability distributions. The batch size of the training sample set; The ReLU activation function (linear rectified function) is used to ensure that the loss value is non-negative. If the value inside the parentheses is less than 0 (meaning that the distance between positive samples is already small enough to meet the requirement of the distance between negative samples), then the loss is 0. This is a distance function that measures the difference between two vectors in space; the Euclidean distance is commonly used. For the student model function, it represents a lightweight model after knowledge distillation, taking input data (such as gene sequences) and outputting feature vectors; The anchor sample for the i-th gene in the training sample set is the current baseline gene sample. For positive samples of the i-th gene in the training sample set, there are genes similar to the anchor sample (e.g., homologous genes, genes with the same function). The negative sample of the i-th gene in the training sample set is a gene that is not similar to the anchor sample (e.g., a gene with no functional relationship). The interval boundary is a positive number set by the user, such as 0.5 or 1.0.
[0038] In one alternative implementation, a domain-aware two-stream attention encoding model is used to extract the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple, respectively. These features are then fused and knowledge distilled to generate a lightweight, dense vector, including: S2021: Input each structured knowledge tuple in the gene biological multimodal knowledge base into a functional domain-aware dual-stream attention coding model; S2022: Using the input encoding module, the gene sequence in the structured knowledge tuple is segmented by a sliding window to obtain the word sequence, and the functional domain labels in the same structured knowledge tuple are embedded to obtain the functional domain embedding vector sequence. In this embodiment, for example, “ATCGAT” is segmented into [“ATCGAT”, “TCGAT…”...], and then the token is mapped to a vector sequence through the Embedding layer; S2023: Use the sequence stream Transformer encoder to extract local syntactic features of word sequences; S2024: Use the functional domain flow Transformer encoder to extract global semantic features from the functional domain embedding vector sequence; S2025: Using local syntactic features as query vectors and global semantic features as key and value vectors, a cross-attention fusion module is used. Based on the cross-attention mechanism, functional domain features are injected into sequence features, and the hidden state of the fused features is calculated. The hidden state corresponding to the [CLS] token is taken as the fused feature vector. S2026: During the inference phase, a lightweight output feature vector that fuses the feature vectors is generated using the trained student model. S2027: Using the normalization and output generation module, feature pooling, dimensionality projection and L2 normalization are performed on the lightweight output feature vector to convert the lightweight output feature vector into a lightweight dense vector.
[0039] In one optional implementation, an importance-aware adaptive product quantization index is constructed. The information entropy of each dimension of the features in each lightweight dense vector is calculated. Quantization bits are dynamically allocated based on the information entropy for quantization processing. The resulting quantized lightweight dense vector is then stored in a vector database, including: S2031: Based on the set number of global clusters, perform global K-Means clustering on all lightweight dense vectors, generate a set of global cluster centers, construct an inverted linked list for each global cluster center, and assign the lightweight dense vectors to the nearest inverted linked list; S2032: Based on the set number of subspaces, each lightweight dense vector is divided into a corresponding number of subvectors along the dimensional direction, and the same subvector of all lightweight dense vectors is integrated as a submatrix to obtain a set of submatrices. In this embodiment, the number of subspaces is set to 128. The 768-dimensional vector is divided into 128 sub-vectors, each with a dimension of 6. The first to sixth dimensions of all vectors are extracted and combined to form the first sub-matrix. This process is repeated to obtain a set of 128 sub-matrices. S2033: Calculate the information entropy of each subspace based on the characteristics of each dimension in the submatrix set, and dynamically allocate bits for quantizing each subspace based on the information entropy; In this embodiment, a base number of bits (e.g., 4 bits) and a total bit budget (e.g., 768 × 4 = 3072 bits) are set. For subspaces with high entropy (dispersed feature distribution and large amount of information), allocate 8 bits or more; For subspaces with low entropy (concentrated features and small amount of information), allocate 2 or 4 bits; S2034: Based on the bits of each subspace, determine the corresponding number of sub-cluster centers, and use the K-Means clustering algorithm to cluster the corresponding submatrix, generating the corresponding number of sub-cluster centers, and obtaining the set of sub-cluster centers; S2035: Combine the codewords of all sub-cluster centers in each subspace of the sub-cluster center set to obtain the codebook for each subspace; S2036: Based on the trained codebook, convert the lightweight dense vector in the inverted linked list into compact index code. For example, if the first subspace is allocated 8 bits and the index is 5, then the first 8 bits are encoded as 00000101, resulting in the quantized lightweight dense vector. S2037: Store the quantized lightweight dense vectors, the global cluster center set, and the index information of the inverted linked list into a pre-built vector database, and build a vector database index.
[0040] In one optional implementation, the system receives the user's query string, generates a query vector, performs a hybrid index retrieval in a vector database, and obtains an initial candidate set, including: S2041: Receive the query string input by the user and map it to a token sequence; S2042: Input the token sequence into the trained student model of the dual-stream attention coding model to generate a query vector; S2043: Calculate the Euclidean distance between the query vector and each cluster center in the cluster center set, access the inverted linked list of several target cluster centers whose Euclidean distance is less than the Euclidean distance threshold, extract all candidate vector IDs contained therein, and form a coarse selection set; S2044: Divide the query vector into 128 query sub-vectors along the dimension. For each subspace, calculate the distance between the query sub-vector and the sub-cluster centers in the corresponding codebook, and generate a distance lookup table. S2045: Based on the distance lookup table, according to the index code of the candidate vector, the distance of each subspace is accumulated by looking up the table to obtain the approximate distance between the query vector and the candidate vectors in the coarse selection set; S2046: Sort the coarse selection set according to the approximate distance, and select the highest quality results as the initial candidate set.
[0041] In one optional implementation, a re-ranking mechanism based on graph context enhancement, combined with the attributes of neighboring nodes of candidate entities in the gene biological knowledge graph, re-ranks the initial candidate set to obtain the final retrieval results, including: S2051: For each candidate entity in the initial candidate set (such as "BRCA2"), perform 1-hop or 2-hop neighbor sampling in the gene biological knowledge graph to obtain several neighbor nodes, and form a local subgraph by combining the candidate entity and its corresponding neighbor nodes. In this embodiment, it is assumed that the extracted neighbors include: protein "RAD51" (interaction), disease "BreastCancer" (association), and biological process "DNA Repair" (participation); S2052: Take the lightweight dense vectors corresponding to each candidate entity and several neighboring nodes of the entity type gene as the initial node features, and take the text description semantic features of other neighboring nodes of the entity type non-gene as the initial node features to obtain the set of initial node feature matrices for each subgraph. In this embodiment, for the two gene nodes “BRCA2” and “RAD51”, the pre-computed lightweight dense vector is directly used as the initial node feature. For non-gene nodes such as “Breast Cancer” and “DNA Repair”, the BERT model is used to encode their text descriptions to obtain text description semantic features, which are then used as the initial node features. S2053: Input the initial node feature matrix set of each subgraph into the graph attention network to generate the corresponding candidate node enhanced feature vector rich in context information; In this embodiment, the graph attention network aggregates neighbor node information through a multi-head attention mechanism. For example, the feature of “Breast Cancer” will enhance the semantic expression of “BRCA2” at the disease level. After propagation through two layers of graph attention network, the enhanced feature vector of the candidate node (“BRCA2”) is output. This vector integrates the contextual information of the graph structure. S2054: Calculate the similarity between the query vector and the enhanced feature vector of each candidate node using cosine similarity or dot product, and reorder the initial candidate set according to the similarity, and select the top few candidate entities in the reordered candidate set as the final retrieval results.
[0042] This invention also provides a lightweight gene biological knowledge retrieval device 300 based on a vector database, referring to... Figure 3 The device may include the following units: The multimodal knowledge base construction unit 301 is used to construct a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, which includes several structured knowledge tuples, based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets. The functional domain-aware coding unit 302 is used to extract the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple using a functional domain-aware dual-stream attention coding model, and then fuse and generate a lightweight dense vector through knowledge distillation. The adaptive quantization index unit 303 is used to construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension feature in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the obtained quantized lightweight dense vector into the vector database. The hybrid retrieval unit 304 is used to receive the user's query string, generate a query vector, perform hybrid index retrieval in the vector database, and obtain an initial candidate set. The graph-enhanced ranking unit 305 is used for a re-ranking mechanism based on graph context enhancement. It combines the neighbor node attributes of candidate entities in the gene biological knowledge graph to re-rank the initial candidate set and obtain the final retrieval results.
[0043] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the lightweight gene biological knowledge retrieval method based on a vector database of the present invention.
[0044] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned terminal and other devices. The memory can include Random Access Memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.
[0045] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0046] Furthermore, to achieve the above objectives, embodiments of the present invention also propose a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the artificial intelligence-based lubricant filling control method of the embodiments of the present invention.
[0047] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable hardware devices (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0048] The embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (apparatus), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0049] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0050] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0051] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. "And / or" indicates that either one or both can be chosen. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the element.
[0052] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A lightweight retrieval method for gene biological knowledge based on a vector database, characterized in that, The method includes: Based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, including several structured knowledge tuples, are constructed. Using a domain-aware dual-stream attention encoding model, local syntactic features of gene sequences and global semantic features of functional domains are extracted from each structured knowledge tuple, and then fused and generated into a lightweight dense vector through knowledge distillation. Construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension of features in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the resulting quantized lightweight dense vector into a vector database. Receive the user's query string, generate a query vector, perform a hybrid index retrieval in the vector database, and obtain an initial candidate set; Based on the graph context enhancement reordering mechanism, the initial candidate set is reordered by combining the attributes of the neighbor nodes of the candidate entities in the gene biological knowledge graph, and the final search results are obtained.
2. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 1, characterized in that, Based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets, a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, comprising several structured knowledge tuples, are constructed, including: Gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets were collected and preprocessed to obtain cleaned sets of gene sequences, biomedical literature documents, and protein functional domain labels. The gene sequences in the cleaned gene sequence set are associated and aligned with the text descriptions in the corresponding biomedical literature document set and the functional domain labels in the protein functional domain label set based on unique identifiers to obtain a structured knowledge tuple for each gene, and a gene biological multimodal knowledge base with several structured knowledge tuples is constructed. A biomedical named entity recognition model based on natural language processing algorithms is used to extract several named entities and several entity relationships from a collection of biomedical literature documents. Construct a corresponding gene biological knowledge graph based on several named entities and several entity relationships.
3. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 2, characterized in that, The dual-stream attention coding model includes an input coding module, a sequence stream Transformer encoder, a functional domain stream Transformer encoder, a cross-attention fusion module, a knowledge distillation module, and a normalization and output generation module.
4. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 3, characterized in that, The knowledge distillation module uses the dual-stream attention encoding model containing complete parameters as the teacher model and a simplified lightweight model as the student model. During the training phase, a pre-collected set of training samples is used to perform knowledge distillation training on the teacher model and the student model based on the joint optimization loss function, resulting in a well-trained student model.
5. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 4, characterized in that, The formula for the joint optimization loss function is: In the formula, To jointly optimize the loss value; This represents the knowledge distillation loss value. This is the loss value for the triplet; This is the weighting balance coefficient.
6. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 5, characterized in that, Using a domain-aware two-stream attention encoding model, local syntactic features of the gene sequence and global semantic features of the functional domain are extracted from each structured knowledge tuple. These features are then fused and knowledge distilled to generate a lightweight, dense vector, including: Each structured knowledge tuple in the genetic biological multimodal knowledge base is input into a functional domain-aware two-stream attention encoding model; Using the input encoding module, the gene sequence in the structured knowledge tuple is segmented by a sliding window to obtain the word sequence, and the functional domain labels in the same structured knowledge tuple are embedded to obtain the functional domain embedding vector sequence. The sequence stream Transformer encoder is used to extract local syntactic features of word sequences; The global semantic features of the functional domain embedding vector sequence are extracted using the functional domain flow Transformer encoder. Using local syntactic features as query vectors and global semantic features as key and value vectors, a cross-attention fusion module is used. Based on the cross-attention mechanism, functional domain features are injected into sequence features, and the hidden state of the fused features is calculated. The hidden state corresponding to the [CLS] token is taken as the fused feature vector. During the inference phase, a lightweight output feature vector that integrates the fused feature vectors is generated using the trained student model. The normalization and output generation module is used to perform feature pooling, dimensionality projection and L2 normalization on the lightweight output feature vector, transforming the lightweight output feature vector into a lightweight dense vector.
7. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 6, characterized in that, An importance-aware adaptive product quantization index is constructed. The information entropy of each dimension of the features in each lightweight dense vector is calculated. Quantization bits are dynamically allocated based on the information entropy for quantization processing. The resulting quantized lightweight dense vectors are then stored in a vector database, including: Based on the set number of global clusters, perform global K-Means clustering on all lightweight dense vectors to generate a set of global cluster centers. Construct an inverted linked list for each global cluster center and assign the lightweight dense vector to the nearest inverted linked list. Based on the set number of subspaces, each lightweight dense vector is divided into a corresponding number of subvectors along the dimensional direction, and the same subvector of all lightweight dense vectors is integrated as a submatrix to obtain a set of submatrices. Based on the characteristics of each dimension in the submatrix set, calculate the information entropy of each subspace, and dynamically allocate bits for quantizing each subspace according to the information entropy; Based on the bits of each subspace, determine the corresponding number of sub-cluster centers, and use the K-Means clustering algorithm to cluster the corresponding submatrix, generating the corresponding number of sub-cluster centers, and obtaining the set of sub-cluster centers; Combine the codewords of all sub-cluster centers in each subspace of the sub-cluster center set to obtain the codebook for each subspace; Based on the trained codebook, the lightweight dense vectors in the inverted linked list are converted into compact index codes to obtain the quantized lightweight dense vectors. The quantized lightweight dense vectors, the global cluster center set, and the index information of the inverted linked list are stored in a pre-built vector database, and a vector database index is constructed.
8. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 7, characterized in that, Receive the user's query string, generate a query vector, perform a hybrid index retrieval in the vector database, and obtain an initial candidate set, including: Receive the query string input by the user and map it to a token sequence; The token sequence is input into the trained student model of the two-stream attention encoding model to generate a query vector; Calculate the Euclidean distance between the query vector and each cluster center in the cluster center set. Access the inverted linked list of several target cluster centers whose Euclidean distance is less than the Euclidean distance threshold, and extract all candidate vector IDs contained therein to form a coarse selection set. The query vector is divided into several query sub-vectors along the dimension. For each subspace, the distance between the query sub-vector and the sub-cluster centers in the corresponding codebook is calculated, and a distance lookup table is generated. Based on the distance lookup table, the approximate distance between the query vector and the candidate vectors in the coarse selection set is obtained by summing the distances of each subspace through the lookup table according to the index code of the candidate vector; Based on approximate distances, the coarsely selected set is sorted, and the highest quality results are selected as the initial candidate set.
9. The lightweight retrieval method for gene biological knowledge based on vector database according to claim 8, characterized in that, Based on a graph context-enhanced re-ranking mechanism, and combining the attributes of neighboring nodes of candidate entities in the gene biological knowledge graph, the initial candidate set is re-ranked to obtain the final retrieval results, including: For each candidate entity in the initial candidate set, perform 1-hop or 2-hop neighbor sampling in the gene biological knowledge graph to obtain several neighbor nodes, and then construct a local subgraph by combining the candidate entity and its corresponding neighbor nodes. The lightweight dense vectors corresponding to each candidate entity and several neighboring nodes of the entity type "gene" are used as initial node features, and the textual description semantic features of other neighboring nodes of the entity type "non-gene" are used as initial node features to obtain the set of initial node feature matrices for each subgraph. The initial node feature matrix set of each subgraph is input into the graph attention network to generate the corresponding candidate node enhanced feature vector rich in context information; The similarity between the query vector and the enhanced feature vector of each candidate node is calculated using cosine similarity or dot product. Based on the similarity, the initial candidate set is reordered, and the top few candidate entities in the reordered candidate set are selected as the final retrieval results.
10. A lightweight gene biological knowledge retrieval device based on a vector database, used to implement the lightweight gene biological knowledge retrieval method as described in any one of claims 1-9, characterized in that, The device includes: The multimodal knowledge base construction unit is used to construct a gene biological multimodal knowledge base and a corresponding gene biological knowledge graph, which includes several structured knowledge tuples, based on gene sequence datasets, biomedical literature datasets, and protein functional domain annotation datasets. The functional domain-aware coding unit is used to extract the local syntactic features of the gene sequence and the global semantic features of the functional domain in each structured knowledge tuple using a functional domain-aware two-stream attention coding model, and then fuse and generate a lightweight dense vector through knowledge distillation. The adaptive quantization index unit is used to construct an importance-aware adaptive product quantization index, calculate the information entropy of each dimension feature in each lightweight dense vector, dynamically allocate quantization bits according to the information entropy for quantization processing, and store the resulting quantized lightweight dense vector into the vector database. The hybrid retrieval unit is used to receive the user's query string, generate a query vector, perform hybrid index retrieval in the vector database, and obtain an initial candidate set. The graph-enhanced ranking unit is used for a re-ranking mechanism based on graph context enhancement. It combines the attributes of the neighboring nodes of candidate entities in the gene biological knowledge graph to re-rank the initial candidate set and obtain the final retrieval results.