Bionic prototype memory attention network method for completing citrus knowledge graph with few samples

By constructing a multi-level memory module and a memory reinforcement loss function, a method for completing a citrus knowledge graph is proposed. This method solves the problems of relation representation and overfitting in citrus knowledge graphs in scenarios with few samples, and achieves efficient completion and dynamic adaptation of the knowledge graph, thereby enhancing the intelligent application capabilities of the citrus industry.

CN121745255BActive Publication Date: 2026-05-01YUNNAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
YUNNAN UNIV
Filing Date
2026-02-27
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing citrus knowledge graphs have weak relation representation capabilities in scenarios with few samples, lack a memory mechanism to adapt to the evolution of citrus knowledge, and are at risk of overfitting under scarce samples, making it difficult for knowledge graphs to adapt to the iteration of industrial technologies.

Method used

We construct a biomimetic prototype memory attention network to complete a few-sample citrus knowledge graph. Through multi-level memory modules (instantaneous, working, and long-term memory) and memory reinforcement prototype smoothing loss, we achieve efficient representation and association mining of citrus knowledge and reduce the risk of overfitting.

Benefits of technology

It improves the completeness and timeliness of the citrus knowledge graph, enabling it to dynamically adapt to the evolution of industry knowledge, provide more reliable knowledge support, and solve the problems of weak relationship representation with few samples and overfitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121745255B_ABST
    Figure CN121745255B_ABST
Patent Text Reader

Abstract

The application discloses a few-sample citrus knowledge graph completion biomimetic prototype memory attention network method and relates to the technical field of computer artificial intelligence. Firstly, for the few-sample task relations in the citrus knowledge graph, the neighborhood of the head entity and the tail entity is defined respectively, and the semantic representation of the entity pair is generated through an entity pair feature information encoder. A memory module is constructed, and reliable relationship prototypes are generated through memory replay and update. The similarity between the semantic representation of the query triple and the generated relationship prototype vector is calculated, and the rationality of the query triple is evaluated based on the similarity. By constructing a positive and negative query set and minimizing the total loss function combined with the ranking loss and the smoothing loss, the model is trained and optimized to obtain a few-sample citrus knowledge graph completion model. The application solves the technical problems of weak few-sample relationship representation capability and lack of memory mechanism suitable for citrus knowledge evolution in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Few-sample citrus knowledge graph completion biomimetic prototype memory attention network method Technical Field

[0001] This invention belongs to the field of computer artificial intelligence technology, and in particular relates to a biomimetic prototype memory attention network method for completing a few-sample citrus knowledge graph. Background Technology

[0002] Against the backdrop of digitalization evolving towards intelligence and deeply integrating into the agricultural sector, knowledge graphs, relying on structured information capabilities, have become a core driver for the intelligent transformation of the citrus industry. In traditional citrus cultivation, information often exists in a scattered and unstructured form, leading to difficulties in knowledge reuse and hindering the implementation of intelligent applications. For example, planting guidance relies heavily on manual experience, and market analysis lacks systematic knowledge support. In recent years, while citrus knowledge graphs have demonstrated advantages in integrating information across the entire industry chain and supporting the construction of digital platforms, providing underlying knowledge guarantees for intelligent applications such as planting guidance and market analysis, the existing technological system still has significant shortcomings. Currently, knowledge graphs generally suffer from insufficient completeness, and citrus knowledge graphs are no exception. For instance, there is a lack of relationships between some new citrus varieties and their production areas, or between them and pest and disease control methods. Especially in the citrus industry, few-sample knowledge scenarios are extremely common, such as the relationship between rare pests and diseases and their symptoms; the number of corresponding triples is often insufficient, highlighting the problem of sample scarcity. Therefore, the technology of few-sample knowledge graph completion is highly compatible with the citrus industry and has significant application value. However, although the existing technology has made some progress, there are still defects when it is applied to the citrus industry: (1) Weak ability to represent relationships with few samples: Citrus knowledge is highly correlated. For example, the diagnostic relationship between "Huanglongbing-leaf symptoms" and "ulcer disease-leaf symptoms" has structural similarity. However, the existing methods mostly handle various few sample tasks in isolation and fail to fully explore such correlation information; (2) Lack of memory mechanism adapted to the evolution of citrus knowledge: Citrus knowledge is constantly updated. New disease and pest variants, new cultivation techniques, improved varieties, etc. are constantly emerging. However, the existing methods have not built an effective memory storage and update mechanism, and cannot simulate the process of human dynamic accumulation of knowledge, which makes it difficult for the knowledge graph to adapt to the iteration of industrial technology; (3) Prominent risk of overfitting under scarce samples: Citrus sub-field knowledge is extremely scarce. The existing methods have not designed a special loss constraint mechanism for the characteristics of industrial knowledge. When training such extremely few sample tasks, the model is prone to overfitting due to insufficient data, which limits the application value of the technology in citrus application scenarios.

[0003] Therefore, there is an urgent need to develop a few-sample knowledge graph completion and optimization method adapted to the characteristics of citrus, in order to break through the existing technical bottlenecks and enhance the ability of knowledge graphs to support the digital and intelligent transformation of the citrus industry. Summary of the Invention

[0004] The purpose of this invention is to provide a biomimetic prototype memory attention network method for completing a citrus knowledge graph with few samples, so as to achieve efficient representation and association mining of few-sample relationships in citrus industry knowledge, construct a biomimetic memory update mechanism that adapts to the dynamic evolution of industry knowledge, and reduce the risk of model overfitting in ultra-few-sample scenarios through targeted loss constraints, thereby accurately completing the missing triplet information in the citrus knowledge graph and improving the completeness and timeliness of the citrus knowledge graph.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by this invention is a biomimetic prototype memory attention network method for completing a few-sample citrus knowledge graph, comprising the following steps:

[0006] S1: Targeting few-shot task relationships in the citrus knowledge graph An entity pair Define the neighborhoods of the head and tail entities respectively, and generate semantic representations of the entity pairs. ;

[0007] S2: Construct a memory module that includes immediate memory, working memory, and long-term memory, and generate memory-enhancing prototype vectors through memory playback and updates. ;

[0008] S3: Calculate the query representation With memory-enhanced prototype vectors The similarity between the three elements is used to assess the credibility of the query representation triples.

[0009] S4: Construct a support set and positive and negative query sets, build a ranking loss and a prototype smoothing loss, and minimize the total loss through meta-training to obtain a few-sample citrus knowledge graph completion model.

[0010] Furthermore, the specific steps of S1 are as follows:

[0011] S1.1: The few-sample task relationship Decomposed into forward representation and backward representation ,in Represent the embedding dimension and generate a query vector through a linear transformation. and key vector Represents the relational transformation matrix;

[0012] S1.2: Using the bilinear product function , previously indicated and backward representation The splicing method simulates the head entity. Tail-end entity Paired interactions between;

[0013] S1.3: For head entities Neighbors By integrating information about neighboring entities and their relationships using a feedforward neural network, semantic representations of neighbors are learned. The semantic representation of neighbors Mapped to a value vector through a linear transformation , Represents head entity Neighborhood relations representation Represents the neighboring entity;

[0014] S1.4: Calculate the correlation score between neighbor relations and task relations using bilinear dot product. Attention weights are obtained by normalizing them using the softmax function. ;

[0015] S1.5: Utilizing attention weights Value vectors of neighbors Generate head entity Weighted neighbors Then the head entity Weighted neighbors With pre-trained entity embeddings Merge to obtain the head entity Enhanced representation ;

[0016] S1.6: For the tail entity Enhanced representation of the generated tail entity ;

[0017] S1.7: Enhanced representation of the head entity Tail-end entity enhancement representation Vector concatenation is performed, followed by a nonlinear transformation using a position-forward feedforward neural network to obtain entity pairs. semantic representation .

[0018] Furthermore, the specific steps of S2 are as follows:

[0019] S2.1: Based on support set Semantic representation of each triple Utilizing attention mechanisms to compute support sets Semantic representation of each triple Relative to each triple in the query set Attention weight For support sets each of the three groups The semantic representation is weighted and summed to obtain the task relation for a small number of samples. Weighted prototype vector ;

[0020] S2.2: Construct a multi-level memory module that includes a transient memory module, a working memory module, and a long-term memory module, and dynamically update the multi-level memory module. The transient memory module adopts a first-in-first-out cache queue structure to temporarily store the latest prototype vector generated by the current task; the transient memory module is updated immediately after each new task.

[0021] The working memory module adopts a clustering central library structure, which is used to cluster prototype vectors transferred from transient memory to store representative prototypes, and uses a frequency matrix to count the frequency at which prototypes are recalled.

[0022] The working memory module is used to periodically cluster and integrate prototypes in the transient memory;

[0023] The long-term memory module adopts a priority queue structure to store frequently used prototypes migrated from working memory, and performs priority management and obsolete prototype elimination based on recall frequency and storage time.

[0024] S2.3: Utilize an attention mechanism to extract prototype features relevant to the current query task from immediate memory, working memory, and long-term memory respectively. Calculate the aggregation weight of each prototype feature, generate a memory representation of each prototype feature based on the aggregation weight, and fuse the memory representations of each prototype feature to generate a memory-enhanced prototype vector. .

[0025] Furthermore, the implementation methods of the immediate memory module, working memory module, and long-term memory module in S2.2 are as follows:

[0026] The instantaneous memory module is based on a dynamic cache pool, uses a first-in-first-out cache queue as the storage structure, sets the cache capacity through hyperparameters, and establishes a real-time receiving, temporary storage, and full-capacity migration mechanism.

[0027] The working memory module is implemented based on K-Means clustering and frequency matrix, and uses a cluster center library as the storage structure. The K-Means clustering algorithm clusters the batch prototypes of transient memory transfer, and the number of clusters K is determined by the validation set optimization.

[0028] The long-term memory module is implemented based on a priority queue and a decay mechanism. It uses a priority queue as the storage structure and establishes a priority calculation mechanism based on recall frequency and storage time.

[0029] Furthermore, the specific steps of S2.3 are as follows:

[0030] S2.3.1: From instantaneous memory Select the top K relevant prototype features Extract representative prototype content related to the current task from the working memory module. Extracting high-frequency core prototype content relevant to the current task from long-term memory modules. ;

[0031] S2.3.2: For the candidate prototypes extracted from each memory module, calculate their aggregation weights using the attention mechanism and generate task representations for each level of memory;

[0032] S2.3.3: The transient memory representation, working memory representation, and long-term memory representation generated in S2.3.2 are fused to generate a prototype vector based on memory enhancement. .

[0033] Furthermore, the specific steps of S3 are as follows:

[0034] S3.1: Calculate the query With memory-enhanced prototype vectors Similarity between them;

[0035] S3.2: Evaluate the query based on the similarity. Semantic fit with the memory prototype.

[0036] Furthermore, query in S3.1 With memory-enhanced prototype vectors The formula for calculating the similarity between them is: in: For query semantic representation, To enhance the memory of prototype vectors, For query, To support the collection, This indicates element-wise product.

[0037] Furthermore, the specific steps of S4 are as follows:

[0038] S4.1: Constructing a support set from the citrus knowledge graph dataset positive query set Negative query set The negative query set By replacing the positive query set The tail entity is generated for each entity pair in the negative query set. The calculation formula is: in: For negative query sets, For the head entity, This is an incorrect tail entity. For the correct tail entity, It is a positive query set;

[0039] S4.2: Construct and minimize the ranking loss function This makes the positive query set The similarity score is higher than that of the negative query set. Similarity score, ranking loss function The calculation formula is: in: For ranking loss function, Let the hinge loss function be... This is the margin hyperparameter. To query positive entity pairs With support set Similarity score between them To query negative entity pairs With support set Similarity score between them To query positive entity pairs, To query negative entity pairs;

[0040] S4.3: Constructing a prototype smoothing loss for memory reinforcement ;

[0041] S4.4: Combine the ranking loss and smoothing loss to obtain the total loss function, and minimize the total loss function through batch sampling meta-training to obtain the few-sample citrus knowledge graph completion model.

[0042] The beneficial effects of this invention are:

[0043] 1) This invention breaks through the limitations of existing methods in processing tasks in isolation by constructing a multi-component memory bank containing instantaneous, working, and long-term memories. It fully explores the related knowledge of citrus cultivation, market, etc., and generates richer and more stable relational prototypes, effectively solving the problem of representing small sample knowledge such as citrus cultivation, prevention and control, and market analysis.

[0044] 2) This invention addresses the continuous updating of knowledge regarding new pests and diseases and new planting techniques in different citrus producing areas. The biomimetic memory update mechanism, combined with memory playback, enables a smooth transition of information to long-term memory and reuse of old knowledge, dynamically accumulating new industry knowledge. This avoids the problem of existing methods failing to adapt the knowledge graph to technological iterations due to a lack of memory updates, thus ensuring the timeliness of the citrus knowledge graph.

[0045] 3) This invention uses memory-enhanced prototype smoothing triple loss to constrain the similarity between new and old knowledge, which can cope with the low-sample scenario of triples in the sub-domain of citrus. Experiments have verified that it is robust on complex datasets and is superior to existing methods, providing more reliable knowledge support for the intelligent application of the citrus industry. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 is a flowchart of the present invention;

[0048] Figure 2 is a schematic diagram of the memory update and recall mechanism of the present invention;

[0049] Figure 3 is a schematic diagram of the memory storage mechanism of the present invention;

[0050] Figure 4 is a schematic diagram of the memory recall mechanism of the present invention. Detailed Implementation

[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0052] The inventive point of this invention lies in addressing the characteristic of citrus knowledge with few samples (such as the strong correlation between rare pests and diseases and symptoms, and the association between new varieties and control methods) but with scarce samples. It proposes a multi-component memory storage structure containing transient memory, working memory, and long-term memory. Transient memory rapidly captures the latest citrus knowledge (such as the association between new pest and disease variants and improved varieties). Working memory integrates similar citrus knowledge through clustering (such as representative prototypes of the relationship between different citrus varieties and susceptibility to citrus canker). Long-term memory retains high-frequency core knowledge (such as key associations between mainstream varieties and common diseases), generating stable relationship prototypes that better fit the industry scenario, thus solving the problem of weak relationship representation with few samples. Secondly, considering the continuous updating of citrus industry knowledge (such as the iteration of new cultivation techniques and the emergence of pest and disease variants), a biomimetic memory update mechanism is designed. This mechanism smoothly integrates new information about the citrus industry from immediate memory into working memory through clustering compression. Then, based on query frequency, it transfers high-value core industry knowledge from working memory (such as frequently consulted variety-disease relationships) to long-term memory. Simultaneously, it leverages memory replay to reuse old knowledge, preventing the forgetting of old knowledge caused by the iteration of new industry knowledge, and ensuring that the knowledge graph can dynamically adapt to the technological evolution of the citrus industry. Finally, for scenarios with extremely few samples in sub-sectors of the citrus industry containing only a single-digit number of triples, a memory-enhanced prototype smoothing triple loss function is constructed. This loss, by constraining the similarity between new and old knowledge in the citrus industry, prevents the model from overfitting to scarce samples and avoids catastrophic forgetting caused by learning new knowledge.

[0053] The following, in conjunction with the accompanying drawings, provides a further detailed description of the few-sample completion biomimetic prototype memory and attention network for citrus knowledge graphs constructed in this invention.

[0054] As shown in Figure 1, the method for constructing a few-sample completion biomimetic prototype memory attention network for citrus knowledge graphs according to the present invention includes the following steps:

[0055] S1: Targeting few-shot task relationships in the citrus knowledge graph An entity pair (For example =“citrus” =“ulcer disease” =“Susceptible to infection”), define the neighborhood of its head entity and tail entity respectively, and generate the semantic representation of the entity pair through the entity pair feature information encoder;

[0056] The specific steps for S1 are as follows:

[0057] S1.1: Considering the semantic bidirectionality of relations in the citrus industry (e.g., the semantics of "susceptible" and "being susceptible" are different), the few-sample task relations will be... Decomposed into forward representation (e.g., the forward semantics of "susceptibility to infection" in "citrus → ulcer disease") and backward representation (e.g., the backward semantic meaning of "susceptible to infection" in "ulcer disease ← citrus"), where, Indicates the embedding dimension. This represents the relational transformation matrix.

[0058] Then, a query vector is generated through linear transformation. and key vector The query vector As shown in equation (1), the query vector Used to map forward relations to query semantics; in: For query vector, For task relationship The forward representation, The first learnable parameter matrix, .

[0059] key vector As shown in equation (2), the key vector Used to map proximity relationships to key semantics; in: For key vectors, It is a head entity Proximity relationships (e.g., "citrus - good storage"), This is the second learnable parameter matrix. .

[0060] S1.2: Using the bilinear product function , previously indicated and backward representation The splicing method simulates the head entity. Tail-end entity Paired interactions between;

[0061] The bilinear product function is shown in equation (3): in: It is a bilinear product (function). For head entities (such as the pre-trained vector of "citrus"). For tail entities (such as the pre-trained vector of "ulcer disease");

[0062] Bilinear product function By capturing the higher-order associations between the two, we can characterize the interactive semantics of entity pairs (such as the association strength of "variety characteristics - disease susceptibility").

[0063] S1.3: For head entities Neighbors (e.g., the relationship in "citrus - shelf life") = "Storage resistant", physical =“Storage period” Represents head entity Neighborhood relations representation (This method represents neighbor entity representations) and integrates information about neighbor entities and neighbor relationships using a feedforward neural network to learn semantic representations of neighbors. As shown in equation (4): in: To learn the semantic representations of neighbors, To correct the linear unit, For head entity Relationships among neighbors For head entity Entities in the neighborhood The first learnable parameter matrix shared by all neighbors. , The second learnable parameter matrix is ​​shared by all neighbors. .

[0064] Semantic representation of neighbors Mapped to a value vector through a linear transformation As shown in equation (5): in: For value vectors, For the third learnable parameter matrix, value vector Used to store supporting information about the relationship between neighbors and tasks (such as the auxiliary judgment information of "susceptible to storage" for "susceptible to ulcer disease").

[0065] S1.4: To measure the semantic relevance between neighbor relationships and task relationships (e.g., the semantic relevance between "storable" and "susceptible to ulcers"), a relevance score is calculated using a bilinear dot product. As shown in equation (6), in: The relevance score. For query vector, This is the first learnable weight vector. , This is the transpose of the key vector;

[0066] In a specific embodiment of the present invention It is a learnable weight vector used to capture the interaction strength between relationships (such as the interaction strength between "storage characteristics" and "disease characteristics").

[0067] Then, use soft max normalization to obtain the attention weights. As shown in equation (7): in: For attention weights, For all sets belonging to the neighbor set element Summation, It is an exponential function. Indicates neighbors Task-related attention weights (e.g., the weight of the impact of "storability" on "citrus susceptibility to canker").

[0068] S1.5: Combining attention weights Value vectors of neighbors (e.g., a weighted aggregation of all neighbors of "citrus" regarding "susceptibility to ulcer disease"), generating a head entity. The weighted neighbor representation is shown in equation (8): in: For head entity The weighted neighbors said, For the set of neighbors of the head entity, For all sets belonging to the neighbor set elements Summation, The value vector of the neighbors;

[0069] Combined with weighted neighbor representation and pre-trained entity embeddings To generate head entity Enhanced representation As shown in equation (9): in: For head entity The enhancement indicates that For pre-trained entity embeddings, As the first learnable parameter, As the second learnable parameter, this operation fuses the entity's own embedding with the weighted information of its neighbors to obtain a more task-specific entity representation (such as the basic features of "citrus" + the enhanced features of "susceptibility to ulcer disease" from its neighbors).

[0070] For tail entities (e.g., "ulcer disease") and its surrounding areas (e.g., "ulcer disease - transmission route" or "ulcer disease - prevention and treatment agents"), perform the same process as S1.1 to S1.5 above to obtain the tail entity enhancement representation. .

[0071] S1.7: Head Entity Augmentation Representation Tail-end entity enhancement representation Entity pairs are calculated using a position-forward feedforward neural network. semantic representation As shown in equation (10): in: For entity pairs semantic representation, For the first trainable parameters, As the second learnable parameter, As the third trainable parameter, .

[0072] This operation concatenates the enhanced representations of the "head entity - tail entity" and then uses linear transformation and activation functions to obtain the final semantic representation of the entity pair (such as the complete semantic vector of "citrus - ulcer disease - susceptible to infection"), which is used for subsequent reasoning and judgment in knowledge graph completion.

[0073] In summary, in the specific implementation of this application, S1 first defines the neighborhood of entity pairs for few-sample tasks, including head entity, tail entity, and their respective neighboring relationships and entities; then, through an entity pair feature information encoder, the task relationship is first decomposed into forward and backward representations and mapped to query vectors and key vectors, and the interaction of entity pairs is simulated using a bilinear product function. Then, the "relationship-entity" information of the neighbors is integrated through a feedforward neural network and mapped to a value vector. The correlation between the neighbors and the task relationship is calculated to obtain attention weights. The weights are combined to generate enhanced representations of head entity and tail entity. Finally, the semantic representation of the entity pair is generated by combining the positional feedforward neural network, providing semantic support for subsequent knowledge graph completion.

[0074] S2: To address the memory enhancement needs of completing the citrus knowledge graph with few samples, a memory module including immediate memory, working memory, and long-term memory is constructed. Reliable relation prototypes are generated through memory playback and updating to support knowledge reasoning.

[0075] Given query set A query For example, searching for "Are tangerines susceptible to anthrax?", and supporting sets A set of triples (For example, “Papapa mandarin orange - susceptible to anthracnose”, “Ugly orange - susceptible to anthracnose”), calculate the few-sample task relationship. The specific method for initializing the prototype vector is shown in S2.1:

[0076] S2.1: Based on support set Semantic representation of each triple Utilizing attention mechanisms to compute support sets Semantic representation of each triple Relative to each triple in the query set Attention weight For support sets each of the three groups The semantic representation is weighted and summed to obtain the task relation for a small number of samples. Weighted prototype vector As shown in equation (11): ;

[0077] in: To support the semantic representation of set triples, For weighted prototype vectors, Attention weights;

[0078] Attention weight The calculation formula is shown in equation (12): in: For query set Semantic representation of triples To support the collection The semantic representation of the k-th triple. To support the semantic representation of the i-th triple in the set, For element-wise product, For attention weights.

[0079] Attention weight Attention weights are used to measure the semantic similarity between the query and the support set triples (e.g., the semantic overlap between the query "papa tangerine-anthrax" and the triple "ugly orange-anthrax"). This reflects the contribution of the support set triples to the current query;

[0080] S2.2: Construct a multi-level memory module that includes a transient memory module, a working memory module, and a long-term memory module. Dynamically update the multi-level memory module. The transient memory module adopts a first-in-first-out cache queue structure to temporarily store the latest prototype vector generated by the current task. The transient memory module is updated immediately after each new task.

[0081] The working memory module adopts a clustering center library structure to cluster prototype vectors migrated from the transient memory module to store representative prototypes, and uses a frequency matrix to count the frequency of prototype recall; the working memory module periodically clusters and integrates prototypes in the transient memory.

[0082] The long-term memory module adopts a priority queue structure to store frequently used prototypes migrated from working memory, and performs priority management and eviction of outdated prototypes based on recall frequency and storage time.

[0083] The implementation methods for the immediate memory module, working memory module, and long-term memory module are as follows:

[0084] The implementation methods of the transient memory module, working memory module and long-term memory module in S2.2 are as follows: The transient memory module is implemented based on a dynamic cache pool, using a first-in-first-out cache queue as the storage structure, setting the cache capacity through hyperparameters, and establishing a real-time receiving, temporary storage and full-capacity migration mechanism;

[0085] The working memory module is implemented based on K-Means clustering and frequency matrix, storing the cluster centers (i.e. "representative prototypes") generated by the K-Means algorithm. The K-Means clustering algorithm clusters a batch of prototypes of transient memory transfer, and the number of clusters K is determined by optimization through validation set.

[0086] The long-term memory module is implemented based on a priority queue and a decay mechanism. It uses a priority queue as the storage structure and establishes a priority calculation mechanism based on recall frequency and storage time (the higher the frequency and the newer the storage time, the higher the priority). When the long-term memory is full, the prototype with the "lowest priority" (i.e., the prototype with "low recall frequency + long storage time") is deleted to avoid capacity expansion.

[0087] As shown in Figure 2, the processing flow of the above module is as follows:

[0088] The transient memory module is responsible for temporarily storing the latest prototype information of the current task to capture short-term task features. Its inputs include the initial relational prototype of the current task and the new prototype vector generated for each query task; the outputs include the original set of unclustered prototypes, and the batch of prototype data to be clustered fed into the working memory when the capacity limit is reached.

[0089] As shown in Figures 3 and 4, the working memory module performs clustering and compression on the data input from the transient memory and stores representative prototypes. Its input comes from the batch data of the original prototypes transferred when the transient memory is full, and may also receive high-frequency prototype features from long-term memory during the memory retrieval process to assist in clustering optimization. The output is a compact representative prototype obtained after K-Means clustering, and when the transient memory is full, it outputs high-frequency recalled prototypes selected by the frequency matrix to long-term memory.

[0090] The long-term memory module stores frequently used core prototype features to prevent critical information from being forgotten. Inputs include the top-H frequently recalled prototypes when the working memory is full, sorted, and clustered prototypes from the working memory during the memory recall process, used to cross-validate prototype importance. The output is a long-term stable library of high-frequency prototype features, and during the memory recall phase, it outputs the top-K prototypes most relevant to the current task to the "prototype aggregator".

[0091] Specifically: the instantaneous memory module stores the latest information (such as the newly learned relationship "See you tomorrow - ulcer disease"), and generates an initial prototype vector each time. Immediately update the instantaneous memory. The calculation method is shown in equation (13): Where: N is the total number of prototype vectors stored in the instantaneous memory, and n is an index variable used to traverse all prototype vectors from 1 to N. For short-term memory, This is the initial prototype vector.

[0092] Ensure that the latest knowledge is stored to enable rapid adaptation to new tasks (such as quickly incorporating disease relationships of new citrus varieties).

[0093] The working memory module stores representative prototypes after clustering and periodically updates the transient memory. The initial prototype vector in Perform K-Means clustering (utilizing unsupervised clustering features to aggregate patterns) to store transient memories. Integrating new information into working memory in a compact form while retaining representative prototypes (such as clustering and storing different categories of prototypes like "citrus varieties susceptible to citrus canker" and "citrus varieties susceptible to anthracnose"), the working memory first performs cluster analysis on the new input prototype vector and its existing content when integrating new information from transient memory. If there is a cluster category in the existing content that is similar to the new prototype, the new prototype will be incorporated into that category to update the representative prototype; if there is no similar category, a new cluster category will be generated to store the new prototype.

[0094] Long-term memory stores frequently used prototype features, through a frequency matrix. Record the number of times prototypes are recalled in working memory. When the working memory capacity reaches its limit, select the prototypes with the highest recall frequency (such as "citrus-ulcer disease" or other frequently queried prototypes) and store them in long-term memory. If the long-term memory capacity exceeds its limit, remove outdated prototypes (such as prototypes of old citrus varieties that have been phased out) to ensure that the most important information is retained in long-term memory.

[0095] S2.3: Utilize an attention mechanism to extract prototype features relevant to the current query task from immediate memory, working memory, and long-term memory respectively. Calculate the aggregation weight of each prototype feature, generate a memory representation of each prototype feature based on the aggregation weight, and fuse the memory representations of each prototype feature to generate a memory-enhanced prototype vector. ;

[0096] Using information from the memory module, memories related to the current query task are generated and merged into a new prototype. Immediate memory candidate retrieval and aggregation are performed. When processing new query tasks (such as the query for "Ehime No. 38 - Brown Spot Disease"), the specific steps are as follows:

[0097] S2.3.1: From instantaneous memory Select the top K relevant prototype features Extract representative prototype content related to the current task from the working memory module. Extracting high-frequency core prototype content relevant to the current task from long-term memory modules. ;

[0098] From instantaneous memory The top K candidate prototypes are selected, and their aggregation weights are calculated using an attention mechanism to generate task-specific transient memory representations. As shown in equation (14): in: For the representation of immediate memory, To obtain from instantaneous memory The weight of the kth candidate prototype selected. For the instantaneous memory of the Kth candidate prototype.

[0099] The calculation method is shown in equation (15): in: It is a similarity function. It is the nth candidate prototype vector in the instantaneous memory. This represents the k-th relevant prototype vector in the instantaneous memory. Let be the mean vector of the probability distribution. Let be the variance vector of the probability distribution. Assuming a probability distribution, Let be the covariance matrix of this distribution.

[0100] S2.3.2: For the candidate prototypes extracted from each memory module, calculate their aggregation weights using the attention mechanism and generate task representations for each level of memory;

[0101] S2.3.3: The transient memory representation, working memory representation, and long-term memory representation generated in S2.3.2 are fused to generate a prototype vector based on memory enhancement. .

[0102] The above process integrates the latest information (instantaneous), representative information (working), and high-frequency important information (long-term), enabling the prototype to capture the key features of the current task while inheriting experience from previous tasks (such as integrating the latest data of "Ehime 38", the cluster prototype of "citrus brown spot disease", and the high-frequency prototype of "citrus brown spot disease" to generate a more reliable "Ehime 38-brown spot disease" prototype), thereby improving the model's adaptability and generalization ability in few-sample completion of citrus knowledge graphs.

[0103] In the embodiments of the present invention, S2 utilizes the dynamic updating of bionic memory and the fusion law of multi-source information to provide a memory-enhanced prototype representation for the few-sample relationship completion of the citrus knowledge graph, which solves the problem of insufficient information for knowledge reasoning in few-sample scenarios, enabling the model to efficiently utilize historical knowledge and the latest data to complete the completion task (such as accurately predicting whether the relationship between "Ehime 38" and brown spot disease is valid).

[0104] S3: Calculate the similarity between the query representation and the memory-enhanced prototype vector, evaluate the credibility of the query representation triples based on the similarity, and support the reasoning judgment of knowledge completion.

[0105] The similarity calculation formula is shown in equation (16). in: For query semantic representation, This is a prototype vector based on memory enhancement (a prototype of "citrus scab-susceptible varieties" that integrates transient, working, and long-term memory). To support the collection, This indicates element-wise product.

[0106] Similarity score Measuring queries The higher the semantic fit with the memory prototype (e.g., the element-level matching degree between "citrus semantics" and "prototype of citrus scab-susceptible varieties"), the more reasonable the triple is, indicating that the triple is more reasonable (e.g., a high score for "citrus-scab" indicates that the variety is indeed susceptible to scab). This provides a basis for judgment in knowledge graph completion and solves the reasoning problem of citrus variety-disease relationship under limited sample conditions. This process utilizes the objective characteristics of vector similarity (the overlap of elements in semantic vectors reflects semantic relevance) to achieve a quantitative assessment of the rationality of knowledge triple combinations.

[0107] S4: Construct positive and negative query sets, minimize the total loss function that combines ranking loss and smoothing loss, train and optimize the model parameters to obtain a few-sample citrus knowledge graph completion model;

[0108] S4.1: Given the query relation Construct a support set from the citrus knowledge graph dataset. With positive query set Negative query set Randomly sampled from the Citrus Knowledge Graph dataset Construct a support set from individual entity pairs and a set of entity pairs to construct the positive query set. Replace positive query set The tail entity of each entity pair in the dataset (e.g., replacing the tail entity "scab disease" in "citrus-scab disease" with "ulcer disease", and ensuring that the triple after replacement is not the correct triple in the training / validation / test set).

[0109] Negative query set The construction method is shown in equation (17): in: For negative query sets, This refers to the head entity in the Citrus Knowledge Graph dataset. This is an incorrect tail entity. For the correct tail entity, It is a positive query set;

[0110] Incorrect tail entity As shown in equation (18): in: This is an incorrect tail entity. Head entities in the Citrus Knowledge Graph dataset In relationship The set of candidate tail entities.

[0111] S4.2: Construct and minimize the ranking loss function This makes the positive query set The similarity score is higher than that of the negative query set. Similarity score, ranking loss function As shown in equation (19): in: Let the hinge loss function be... This is the margin hyperparameter. To query positive entity pairs and support set Similarity score between them To query negative entity pairs and support set Similarity score between them.

[0112] Ranking loss function By leveraging the objective cognitive principle that "positive samples should score higher than negative samples", the model is forced to learn features that can distinguish between positive and negative triples (e.g., the score for "citrus-scab disease positive query" is higher than the score for "citrus-ulcer disease negative query").

[0113] S4.3: Since there is overlap between new samples (such as the disease relationships of the new variety "seedless citrus") and old samples (such as the disease relationships of "common citrus") in the citrus knowledge graph, a prototype smoothing loss with memory reinforcement is constructed to avoid overfitting the model to the new task or forgetting the old task. ;

[0114] The specific calculation method is as follows:

[0115] Calculate and store each old task prototype diagonal covariance matrix ;

[0116] Based on covariance and standard Gaussian noise (Utilizing the randomness of noise to simulate the distribution fluctuations of the prototype, which conforms to the fuzzy nature of knowledge in natural scenes), generating smoothed feature embeddings of old task prototypes. The calculation method is shown in equation (20): in: It's the prototype of the old mission. For each old task prototype The diagonal covariance matrix, Embed smoothed features for the old task prototype. It is standard Gaussian noise.

[0117] Smoothing loss As shown in equation (21): in: It is the furthest embedding in the same class (such as the prototype furthest from the current sample in the class "susceptible to ulcer disease"). It is the nearest embedding that belongs to a different class (such as the prototype closest to the current sample in the class "anthrax-susceptible species"). It is the balance coefficient. This is the feature embedding vector for the current sample.

[0118] This loss ensures that the distribution of the new task prototype is sufficiently distinguishable from that of the old task prototype (e.g., the distribution of the new prototype "seedless citrus-canker" and the old prototype "common citrus-canker" will not overlap excessively).

[0119] S4.4: Combine the ranking loss and smoothing loss to obtain the total loss function, and minimize the total loss function through batch sampling meta-training to obtain the few-sample citrus knowledge graph completion model.

[0120] The specific implementation of this invention utilizes a batch sampling meta-training procedure to minimize the total loss and optimize model parameters, ultimately enabling the model to accurately infer new relationships while retaining the reasoning ability of old knowledge in the few-sample completion task of the citrus knowledge graph.

[0121] To verify the effectiveness of the proposed few-shot citrus knowledge graph completion model, experiments were conducted on two public datasets, NELL-One and Wiki-One, with different few-shot K settings (including 1-shot, 3-shot, and 5-shot). Performance was compared with several state-of-the-art methods: FAAN is a graph neural network-based method that enhances embeddings by encoding direct neighbors of entities; GANA is a meta-learning method that learns specific meta-information representations of single relations; CIAN models inter-entity interactions through dual attention of task awareness and entity pair awareness; and APINet utilizes an interactive attention encoder and an adaptive prototype network to handle multiple semantic relations. Detailed performance comparisons of all models on the aforementioned datasets are summarized in Table 1.

[0122] Table 1. Experimental comparison results on the NELL-One and Wiki-One datasets.

[0123]

[0124] Experiments on publicly available datasets have verified that the proposed few-sample citrus knowledge graph completion model outperforms existing methods in all core tasks, providing more reliable knowledge support for the intelligent application of the citrus industry.

[0125] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0126] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A biomimetic prototype memory and attention network method for completing a few-sample citrus knowledge graph, characterized in that... Includes the following steps: S1: Targeting few-shot task relationships in the citrus knowledge graph An entity pair Define the neighborhoods of the head and tail entities respectively, and generate semantic representations of the entity pairs. S2: Construct a memory module that includes immediate memory, working memory, and long-term memory, and generate memory-enhancing prototype vectors through memory playback and updates. The implementation methods of the transient memory module, working memory module, and long-term memory module are as follows: The transient memory module is implemented based on a dynamic cache pool, using a first-in-first-out cache queue as the storage structure. The cache capacity is set through hyperparameters, and a real-time reception, temporary storage, and full-capacity migration mechanism is established. The working memory module is implemented based on K-Means clustering and a frequency matrix, using a cluster center library as the storage structure. The K-Means clustering algorithm clusters the batch prototypes of transient memory migration, and the number of clusters K is determined through validation set optimization. The long-term memory module is implemented based on a priority queue and a decay mechanism, using a priority queue as the storage structure and establishing a priority calculation mechanism based on recall frequency and storage time. S3: Calculate the query representation. With memory-enhanced prototype vectors The similarity between the three elements is used to assess the credibility of the query representation triples. S4: Construct the support set and positive / negative query sets, build ranking loss and prototype smoothing loss, and minimize the total loss through meta-training to obtain the few-sample citrus knowledge graph completion model; the specific steps of S4 are: S4.1: Construct the support set from the citrus knowledge graph dataset. positive query set Negative query set The negative query set By replacing the positive query set The tail entity is generated for each entity pair in the negative query set. The calculation formula is: in: For negative query sets, For the head entity, This is an incorrect tail entity. For the correct tail entity, For positive query sets; S4.2: Construct and minimize the ranking loss function This makes the positive query set The similarity score is higher than that of the negative query set. Similarity score, ranking loss function The calculation formula is: in: For ranking loss function, Let the hinge loss function be... This is the margin hyperparameter. To query positive entity pairs With support set Similarity score between them To query negative entity pairs With support set Similarity score between them To query positive entity pairs, To query negative entity pairs; S4.3: Construct a memory-enhanced prototype smoothing loss. S4.4: Combine the ranking loss and smoothing loss to obtain the total loss function, and minimize the total loss function through batch sampling meta-training to obtain the few-sample citrus knowledge graph completion model.

2. The method for completing a few-sample citrus knowledge graph using a biomimetic prototype memory and attention network according to claim 1, characterized in that, The specific steps of S1 are as follows: S1.1: The few-sample task relationship... Decomposed into forward representation and backward representation ,in Represent the embedding dimension and generate a query vector through a linear transformation. and key vector Representing the relational transformation matrix; S1.2: Using the bilinear product function , previously indicated and backward representation The splicing method simulates the head entity. Tail-end entity Paired interactions between entities; S1.3: For head entities Neighbors By integrating information about neighboring entities and their relationships using a feedforward neural network, semantic representations of neighbors are learned. The semantic representation of neighbors Mapped to a value vector through a linear transformation , Represents head entity Neighborhood relations representation Representing neighbor entities; S1.4: Calculating the relevance score between neighbor relations and task relations using bilinear dot product. Attention weights are obtained by normalizing them using the softmax function. ; S1.5: Utilizing attention weights Value vectors of neighbors Generate head entity Weighted neighbors Then the head entity Weighted neighbors With pre-trained entity embeddings Merge to obtain the head entity Enhanced representation S1.6: For the tail entity Enhanced representation of the generated tail entity S1.7: Enhanced representation of the head entity Tail-end entity enhancement representation Vector concatenation is performed, followed by a nonlinear transformation using a position-forward feedforward neural network to obtain entity pairs. semantic representation 。 3. The method for completing a few-sample citrus knowledge graph using a biomimetic prototype memory and attention network according to claim 1, characterized in that, The specific steps of S2 are as follows: S2.1: Based on the support set Semantic representation of each triple Utilizing attention mechanisms to compute support sets Semantic representation of each triple Relative to each triple in the query set Attention weight For support sets each of the three groups The semantic representation is weighted and summed to obtain the task relation for a small number of samples. Weighted prototype vector S2.2: Construct a multi-level memory module comprising a transient memory module, a working memory module, and a long-term memory module, and dynamically update the multi-level memory module. The transient memory module adopts a first-in-first-out (FIFO) cache queue structure to temporarily store the latest prototype vector generated by the current task; the transient memory module is updated immediately after each new task. The working memory module adopts a clustering center library structure to cluster prototype vectors transferred from transient memory to store representative prototypes, and uses a frequency matrix to count the frequency of prototype recall; the working memory module is used to periodically cluster and integrate prototypes in transient memory. The long-term memory module adopts a priority queue structure to store frequently used prototypes transferred from working memory, and performs priority management and outdated prototype elimination based on recall frequency and storage time. S2.3: Use an attention mechanism to extract prototype features related to the current query task from transient memory, working memory, and long-term memory respectively, calculate the aggregation weight of each prototype feature, generate a memory representation of each prototype feature based on the aggregation weight, and fuse the memory representations of each prototype feature to generate a prototype vector based on memory enhancement. 。 4. The method for completing a few-sample citrus knowledge graph using a biomimetic prototype memory and attention network according to claim 3, characterized in that, The specific steps of S2.3 are as follows: S2.3.1: From instantaneous memory Select the top K relevant prototype features Extract representative prototype content related to the current task from the working memory module. Extracting high-frequency core prototype content relevant to the current task from long-term memory modules. ; S2.3.2: For the candidate prototypes extracted from each memory module, calculate their aggregation weights using an attention mechanism and generate task representations for each level of memory; S2.3.3: Fuse the transient memory representation, working memory representation, and long-term memory representation generated in S2.3.2 to generate a prototype vector based on memory enhancement. 。 5. The method for completing a few-sample citrus knowledge graph using a biomimetic prototype memory and attention network according to claim 1, characterized in that, The specific steps of S3 are as follows: S3.1: Calculate the query With memory-enhanced prototype vectors S3.2: Evaluate the query based on the similarity between the queries; Semantic fit with the memory prototype.

6. The method for completing a few-sample citrus knowledge graph using a biomimetic prototype memory and attention network according to claim 5, characterized in that, Query in S3.1 With memory-enhanced prototype vectors The formula for calculating the similarity between them is: in: For query semantic representation, To enhance the memory of prototype vectors, For query, To support the collection, This indicates element-wise product.

Citation Information

Patent Citations

  • Few-sample knowledge reasoning method based on double-prototype network

    CN116361489A

  • Method and system for complementing few-sample knowledge graph fusing relation perception information bottleneck

    CN121303295A