Dairy product risk management and control method based on knowledge graph and attention cross recommendation model
By constructing a knowledge graph of dairy product risks and designing a KG-ACR model, the problems of data sparsity and cold start in the dairy product risk management platform were solved, enabling accurate identification and intelligent control of risks across the entire dairy product chain, and improving the accuracy and interpretability of recommended control measures.
Patent Information
- Application Number
- CN202511770194.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-02-24
AI Technical Summary
Existing dairy product risk management platforms suffer from multi-source heterogeneous, scattered, and sparse data. Traditional database models struggle to effectively organize and correlate these data, and recommendation methods are unable to delve into the complex, multi-hop semantic relationships between risk factors and control measures. Consequently, recommendation results lack interpretability and cannot address the cold start problem, leading to low management efficiency.
A knowledge graph of dairy product risks is constructed, and a KG-ACR model is designed. The graph attention mechanism and cross-compression technology are integrated. Multi-source risk knowledge is integrated through the knowledge graph construction module. The KG-ACR model is used to calculate the matching score between risk scenarios and control measures. Visualization and explanation support are provided through the recommendation output and explanation modules.
It has achieved accurate identification and intelligent management of risks across the entire dairy product chain, improved the accuracy and interpretability of recommended management measures, alleviated the problems of data sparsity and cold start, and realized fully automated intelligent risk management.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of artificial intelligence and food safety technology, and specifically relates to a method and system for risk management of dairy products based on a cross-recommendation model of knowledge graph and attention. Background Technology
[0002] Food safety is a matter of national importance and people's livelihood. Dairy products, due to their wide consumer base, long supply chain, and complex production processes, have become a focal point of the industry. With the development of the dairy industry, the supply chain continues to extend and production processes become increasingly complex. Traditional monitoring and risk management models relying on human experience are no longer sufficient to address multi-stage and multi-source risk factors, resulting in low management efficiency and an inability to achieve precise and proactive risk prevention and control. While existing dairy risk management platforms or systems can provide data recording and information query support, they still face technical bottlenecks: data is multi-source, heterogeneous, scattered, and sparse, making it difficult for traditional database models to effectively organize and correlate data; recommendation methods cannot deeply explore the complex multi-hop semantic relationships between risk factors and control measures; the rarity of severe risk events leads to sparse interactions between "risk scenarios and control measures," causing traditional collaborative filtering models to degrade in performance and struggle to handle cold start problems; and the recommendation results lack interpretability, making it difficult to clarify the basis for recommendations and affecting the adoption and implementation of measures. Summary of the Invention
[0003] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a knowledge graph-based method and system for risk management of dairy products. This method aims to construct a dairy product risk knowledge graph and design a novel KG-ACR model, deeply integrating graph attention mechanisms and cross-compression techniques to achieve comprehensive mining and correlation analysis of risk factors across the entire dairy product supply chain, and to output highly accurate and interpretable risk management measure recommendations.
[0004] This application provides a risk management method for dairy products based on a knowledge graph and attention-based cross-recommendation model, which adopts the following technical solution: The knowledge graph construction module extracts dairy product risk knowledge from multiple sources of data, including standards and specifications, sampling cases, academic literature, and production records. It defines entities, relationships, and attributes to form a structured knowledge system and constructs a dairy product risk knowledge graph by storing it in a graph database. The KG-ACR model inference module takes the knowledge graph as input and calculates the matching score between risk scenarios and candidate control measures through the collaborative operation of attention embedding propagation, multi-layer aggregation and cross compression, and recommendation module, and outputs a Top-N recommendation list. The recommendation output and explanation module visually displays the recommended risk management measures, and simultaneously provides the reasons for the recommendation and high-weight relationship paths to enhance the interpretability of the decision. Through end-to-end collaboration of the above modules, the system enables accurate identification, correlation analysis, and intelligent management and control recommendations for risks across the entire dairy product supply chain.
[0005] The knowledge graph construction module includes a knowledge extraction unit, an entity relationship definition unit, and a graph database storage unit. The structured knowledge generation system includes a multi-source data parser, a knowledge standardization processor, and a graph maintenance controller. The knowledge standardization processor cleans and unifies the format of the extracted heterogeneous risk knowledge. The multi-source data parser receives and processes multimodal data from standard specification documents, sampled case datasets, academic literature databases, and production process records, extracting risk-related information and transmitting it to the knowledge standardization processor. The entity relationship definition unit includes an entity classifier, a relationship type definer, and an attribute labeler, used to clarify the core entities, relationships, and attribute characteristics in the dairy product risk domain. Entities include risk factor entities (e.g., "microbial contamination," "feed mold"), control measure entities (e.g., "pasteurization," "enhanced cold chain monitoring"), control entities (e.g., "production management department," "food safety committee"), product entities (e.g., "sterilized milk," "yogurt"), and risk events (e.g., "acute gastroenteritis," "market removal"). Relationships include "existence," "initiation," "disposal," "implementation," and "correction." The graph database storage unit uses Neo4j. The graph database architecture provides persistent storage and efficient indexing of structured knowledge graph data, supporting rapid querying of entities and relationships and dynamic updates of the graph. The knowledge graph construction module provides structurally complete and semantically rich knowledge support for subsequent risk reasoning through multi-source knowledge fusion and standardization.
[0006] The KG-ACR model inference module includes an attention embedding propagation module, a multi-layer aggregation and cross-compression module, and a recommendation module. The intelligent inference system includes an embedding learning unit, a feature fusion unit, and a matching calculation unit. The matching calculation unit evaluates the matching degree between risk scenarios and control measures based on deep interaction features. The attention embedding propagation module receives structured data output by the knowledge graph construction module, learns the embedding representations of entities and relationships, captures high-order associations, and transmits them to the multi-layer aggregation and cross-compression module. The multi-layer aggregation and cross-compression module includes a multi-scale feature integrator, a cross-interaction modeler, and a dimensionality compression processor, used to integrate multi-scale semantic features and model the nonlinear interaction between risk factors and control measures. The recommendation module is connected to the multi-layer aggregation and cross-compression module, calculates matching scores based on interaction feature vectors, and sorts and outputs recommendation results.
[0007] The attention embedding and propagation module includes an embedding layer and an attention propagation layer. The embedding layer uses the TransR knowledge graph embedding algorithm to project entities from the "entity space" to the "relation space," accurately modeling the semantics of entities under different relations using low-dimensional vectors. The attention propagation layer captures higher-order associations between "risk factors and control measures" by recursively updating entity embeddings. Its execution steps are as follows: a. Information dissemination: Embedding the target node's neighbor information into the target node to enrich the target node's semantic expression. ; b. Knowledge-aware attention: Calculate the importance weights of each neighbor of the target entity. The weight values are in the range [0,1] and the sum is 1, realizing the weighted aggregation of neighbor information. ; c. Information Aggregation: The initial embedding of the target entity is fused (added or concatenated) with the neighbor aggregation vector obtained in step b to generate a new embedding after first-order propagation. , Multi-level semantic propagation is achieved through multi-layer stacking. , .
[0008] The multi-layer aggregation and cross-compression module includes a multi-layer aggregation unit and a cross-compression unit. The multi-layer aggregation unit concatenates the same entity embedding vectors output from different propagation layers in the attention embedding propagation module to form a feature vector that fuses local to global multi-scale semantic information. , This design introduces no additional parameters, effectively avoiding overfitting; the cross-compression unit achieves deep nonlinear interaction through cross-operation and compression operation, specifically through the following steps: a. Cross-operation: Construct cross matrices for the multi-level aggregated feature vectors of the "risk factor" entity and the "control measure" entity respectively, explicitly capturing the full interaction relationship between the two. , Then concatenate the two cross matrices into a unified cross matrix. ; b. Compression operation: Using trainable weight vectors, the high-dimensional cross matrix is projected onto a low-dimensional vector space, preserving key interaction information to form the final interaction feature vector. , .
[0009] The recommendation module includes a matching score calculator and a ranking outputter. The matching score calculator is based on the interaction feature vector output by the multi-layer aggregation and cross-compression module, according to... The matching score between the current risk scenario and each candidate control measure is calculated; the sorting output device sorts all candidate control measures in descending order according to the matching score and outputs a Top-N recommendation list, where the value of N can be flexibly configured by the user according to the actual application scenario.
[0010] The recommendation output and explanation module includes a visualization unit, a recommendation reason generation unit, and a path tracer. The visualization unit presents the recommended risk management measures to the user in an intuitive list format, supporting expanded viewing of measure details. The recommendation reason generation unit automatically generates recommendation criteria based on the attention weights and relationship path information of the KG-ACR model, clearly identifying high-weight neighbor entities and core relationships. The path tracer supports tracing and visualizing the high-weight relationship paths corresponding to the recommendation results, enhancing decision-making transparency. The recommendation output and explanation module, through interpretability design, helps users understand the recommendation logic, improving the credibility and execution efficiency of risk management decisions.
[0011] The beneficial effects of this invention are as follows: by integrating multi-source risk knowledge through the knowledge graph construction module, a solid foundation for reasoning is provided; the KG-ACR model deeply integrates graph attention mechanism and cross-compression technology, significantly improving the accuracy of control measure recommendations; by leveraging attention weights and relational path tracing, the strong interpretability of recommendation results is achieved; the rich auxiliary information introduced by the knowledge graph effectively alleviates the problems of data sparsity and cold start, eliminating the need for manual design of meta-paths and realizing fully automatic and intelligent risk control recommendations. Attached Figure Description
[0012] Figure 1 This is a schematic diagram of the module connections of the dairy product risk management method provided in this embodiment of the invention.
[0013] Figure 2 This is a partial schematic diagram of the dairy product risk knowledge graph constructed in an embodiment of the present invention.
[0014] Figure 3 This is a structural block diagram of the KG-ACR model in an embodiment of the present invention.
[0015] 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 a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention. In the present invention, unless otherwise explicitly specified and limited, the terms "extraction," "storage," "inference," and "output" should be interpreted broadly. For example, they can refer to manually assisted data processing or fully automated algorithm processing; they can refer to local database storage or cloud-distributed storage; they can refer to real-time online inference or offline batch calculation; they can refer to text list output or visual interface display. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.
[0016] Example Taking the risk management scenario of "microbial contamination" faced by a low-temperature milk production enterprise as an example, this paper details the specific implementation process of the dairy product risk management method and system based on knowledge graph of the present invention. The system module connection relationship is shown in Figure 1, and the local structure of the knowledge graph and the model structure are shown in Figures 2 and 3, respectively. In this embodiment, the system achieves precise output of control measures for the risk of "microbial contamination" through the full-process collaboration of knowledge graph construction, model reasoning and recommendation, and result display. The specific steps are as follows: 1. Knowledge Graph Construction: The knowledge graph construction module, through the collaborative operation of multi-source data parsing, knowledge standardization processing, and graph database storage, completes the structured modeling of risk knowledge related to "microbial contamination." Specific operations are as follows: Data preparation phase: Multi-source data parser collects relevant multi-dimensional data, including standard and specification texts such as the "National Food Safety Standard - Good Manufacturing Practices for Dairy Products", announcements of non-compliance by market supervision departments in the past 5 years (screening 100+ cases of "microbial contamination" in low-temperature milk), 30+ academic papers from core journals, and the company's production records in the past 2 years (sorting out 4000+ valid data).
[0017] Knowledge extraction and standardization stage: After the knowledge standardization processor completes data cleaning and noise reduction, the entity relationship definition unit clarifies the core entities (risk factors, risk events, control measures, etc.), relationships (causing, leading to, mitigating, etc.) and attribute annotations, forming structured knowledge entries.
[0018] Knowledge graph storage stage: Neo4j graph database is used to store entity, relation and attribute data, and a knowledge graph for the topic of "low temperature milk - excessive microorganisms" is constructed, which contains 89 entity nodes and 156 relation edges, supports dynamic updates and related queries, and forms a partial schematic diagram as shown in Figure 2, providing knowledge support for model reasoning.
[0019] 2. Model Training and Recommendation: The model training and inference module loads the pre-trained KG-ACR model (structure shown in Figure 3), and takes "a low-temperature dairy company has a risk of microbial contamination" as the input scenario, and executes the following process: Model input processing: Transform the risk scenarios input by users into structured queries to locate core entities such as "excessive microbial levels" and "low-temperature fresh milk" in the knowledge graph.
[0020] KG-ACR model workflow: Subgraph extraction: Extract the subgraph associated with "microbial exceedance", which contains 32 entity nodes and 48 relational edges, and exclude redundant nodes.
[0021] Attention-based embedding propagation: Entities and relations are projected into a 128-dimensional vector space using the TransR algorithm, and higher-order associations are captured through three layers of attention propagation to update node embedding vectors.
[0022] Multi-aggregation and cross compression: Concatenate multi-scale feature vectors, construct a cross matrix and project it into a low-dimensional space to retain key interaction information.
[0023] Recommendation Calculation: The matching score is calculated using the cosine similarity algorithm, and the Top-5 recommended control measures are output in order. Enhanced real-time temperature monitoring in the cold chain (matching score: 0.95) Increase the daily testing frequency for total bacterial count (match score: 0.93) Ultraviolet disinfection equipment was used (match score: 0.88) Change to a compliant cold chain logistics provider (match score: 0.85) Develop an emergency response plan for excessive microbial levels (matching score: 0.82) 3. Results Display: The recommendation output module presents the recommendation results through a visual interface, providing interpretability support: A Top-5 recommendation list is presented in tabular form, including core fields such as "Control Measure Name," "Matching Score," and "Implementation Cost," with support for viewing measure details. Recommendation reasons are generated based on model attention weights and relationship paths, clearly defining the core association logic and historical performance data. Relationship path tracing is supported, highlighting the "Risk Factor - Control Measure" association path in the knowledge graph (see Figure 2) to intuitively present the recommendation logic. Users can manually adjust recommendation priorities based on actual needs, and the system updates matching scores and recommendation order in real time.
Claims
1. A knowledge graph-based method for risk management of dairy products, characterized in that, Includes the following steps: A risk knowledge graph for dairy products is constructed, which integrates risk factor entities, control measure entities, and semantic relationships between entities involved in the entire dairy product industry chain. Based on the knowledge graph, the KG-ACR model is used to recommend risk management measures. The KG-ACR model includes an attention embedding propagation module, a multi-layer aggregation module, and a cross-compression module. The candidate control measures are ranked according to the matching scores output by the model, and a Top-N risk control measure recommendation list is generated.
2. The method as described in claim 1, characterized in that, The KG-ACR model models high-order semantic dependencies between entities using a graph attention network and utilizes cross-compression units to fuse nonlinear interaction features between risk factors and control measures, thereby enhancing the semantic relevance and interpretability of the recommendation results.
3. The method as described in claim 1, characterized in that, The attention embedding and propagation module uses the TransR method to embed entities and relations in the knowledge graph, updates the entity embedding representation through a recursive propagation mechanism, and dynamically weights and aggregates the contributions of neighboring nodes in conjunction with a knowledge-aware attention mechanism.
4. The method as described in claim 1, characterized in that, The multi-layer aggregation module performs multi-scale semantic feature fusion on entity embeddings from different propagation layers through vector concatenation, which enhances the model's expressive power and suppresses the risk of overfitting without introducing additional parameters.
5. The method as described in claim 1, characterized in that, The cross-compression module constructs a cross-feature matrix between risk factors and control measures, and uses learnable weight vectors to compress high-dimensional cross-features into low-dimensional feature vectors containing high-order interaction information.
6. The method as described in claim 1, characterized in that, The recommendation module calculates the matching score between risk scenarios and control measures based on the interaction feature vector output by the cross-compression module, and sorts the candidate measures according to the score to generate the final recommendation list.
7. A dairy product risk management system for implementing the method as described in any one of claims 1 to 6, characterized in that, include: The knowledge graph construction module is used to extract risk factor entities, control measure entities and their relationships from multi-source heterogeneous data, and to construct and store a dairy product risk knowledge graph. The model training and inference module is used to train the KG-ACR model and make intelligent recommendations for control measures based on the input risk scenarios. The recommended output module is used to display a list of recommended risk management measures and their associated explanatory information to users.
8. The system as described in claim 7, characterized in that, The knowledge graph construction module supports the storage and querying of knowledge graphs using the Neo4j graph database, and provides semantic association retrieval and visualization functions based on Cypher statements.