TIP selection method and device based on directed acyclic graph, equipment and medium
By combining immediate contribution, spatiotemporal decay factor and data distribution value in a directed acyclic graph for dual weighted calculation, the target TIP node is selected, which solves the problem of ignoring historical contribution and long-term credibility in existing methods and improves the model performance and stability of federated learning.
Patent Information
- Application Number
- CN202511417124.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Existing TIP selection methods rely solely on the instantaneous attributes of a single transaction, ignoring the client's historical contributions and long-term reliability, leading to a decline in model performance in scenarios with non-independent and identically distributed data.
By scanning the directed acyclic graph, the instantaneous contribution, spatiotemporal decay factor, data distribution value, and reputation score of the candidate TIP nodes are calculated. A double-weighted calculation is performed to obtain the comprehensive weight, and the target TIP nodes are selected for model training and aggregation.
It enables a more accurate assessment of the global contribution of nodes, avoids the volatility of single transaction features, improves the accuracy and game-resistantness of model training, and adapts to dynamically changing federated learning environments.
Smart Images

Figure CN120910312A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchains, and particularly relates to a TIP selection method and device based on a directed acyclic graph, equipment and a medium. BACKGROUND
[0002] With the development of artificial intelligence and big data, federated learning, as a distributed machine learning method for protecting data privacy, is gradually widely used in cross-organizational and cross-device data collaboration scenarios. In the traditional federated learning architecture, the client uploads the locally trained model parameters or gradients to the central server, and the server updates the global model by unified aggregation. However, the traditional method has significant deficiencies when dealing with Non-IID data: since the updates of all clients are forced into the same global model, the local feature information of some clients may be diluted, reducing the overall model performance.
[0003] In order to solve the coordination problem in the decentralized scenario, the current method mainly uses a blockchain or a directed acyclic graph (DAG) structure to record the transactions (TIP) of the client model updates, and selects the TIP for aggregation. However, the existing TIP selection method only relies on the instantaneous attributes of a single transaction (such as the accuracy of a single model update), ignoring the historical contribution and long-term credibility of the client.
[0004] In view of the above problems, no effective solution has been proposed so far. SUMMARY
[0005] The present application provides a TIP selection method and device based on a directed acyclic graph, equipment and a medium to solve the technical problem of the above-mentioned "existing TIP selection method only relying on the instantaneous attributes of a single transaction".
[0006] According to an aspect of the embodiments of the present application, the present application provides a TIP selection method based on a directed acyclic graph, comprising: determining each candidate TIP node by scanning the directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which an unconfirmed transaction belongs; calculating an average topology value by the instant contribution of the candidate TIP node and a space-time decay factor, and determining a data distribution value of the candidate TIP node, wherein the space-time decay factor represents the recognition efficiency of the candidate TIP node in the directed acyclic graph; obtaining a last round reputation score of the candidate TIP node, and performing double-weighted calculation on the last round reputation score, the average topology value and the data distribution value to obtain a current round reputation score; obtaining a model update accuracy of the candidate TIP node, and multiplying the model update accuracy with the current round reputation score to obtain a comprehensive weight of each candidate TIP node; and selecting a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation through a TIP on the target TIP node.
[0007] Optionally, the average topology value is calculated by the instant contribution of the candidate TIP node and the space-time decay factor, comprising: obtaining a set cardinality of the candidate TIP node, wherein the set cardinality is the cardinality of all transactions historically published by a client to which the candidate TIP node belongs; obtaining the instant contribution of each transaction on the candidate TIP node, and calculating the space-time decay factor of each transaction on the candidate TIP node; multiplying the instant contribution of each transaction with the space-time decay factor to obtain a weighted contribution value of each transaction; performing an average operation on each weighted contribution value to obtain an average value, and determining the average value as the average topology value.
[0008] Optionally, the space-time decay factor of each transaction on the candidate TIP node is calculated, comprising: obtaining a depth value of a current transaction and a current training round, wherein the depth value is the maximum depth of the current transaction referenced in the directed acyclic graph; multiplying the ratio of the current training round to the depth value with a preset parameter to obtain a product, wherein the preset parameter is a hyperparameter for controlling the decay rate; subtracting the product from a target value to obtain a difference, and determining the difference as the space-time decay factor.
[0009] Optionally, the data distribution value of the candidate TIP node is determined, comprising: generating a local histogram of a client to which the candidate TIP node belongs; obtaining a global histogram, and calculating a difference value of the local histogram and the global histogram, wherein the global histogram is obtained by aggregating local histograms of multiple clients; performing exponential smoothing normalization on the difference value to obtain the data distribution value.
[0010] Optionally, the local histogram of the client to which the candidate TIP node belongs is generated by: obtaining a local data set of the client to which the candidate TIP node belongs; counting the occurrence frequency of each category label in the local data set to generate a label distribution histogram; and adding preset noise to the label distribution histogram to obtain the local histogram.
[0011] Optionally, the current round reputation score of the candidate TIP node is calculated by double weighting the last round reputation score, the average topology value, and the data distribution value, including: performing first weighting calculation on the average topology value and the data distribution value to obtain a first weighted value; performing second weighting calculation on the last round reputation score and the first weighted value by using a learning rate to obtain a second weighted value, wherein the learning rate is used to adjust the weight influence of the performance of the current training round on the overall reputation; and determining the second weighted value as the current round reputation score of the candidate TIP node.
[0012] Optionally, after the target TIP node is selected, the method further includes: obtaining a first model increment of the target TIP node, and obtaining a second model increment obtained by local training; aggregating the first model increment and the second model increment to obtain a third model increment; encapsulating the third model increment to form a new transaction, wherein the previous transaction of the new transaction is a TIP on the target TIP node; and submitting the new transaction to the directed acyclic graph to update the directed acyclic graph.
[0013] According to another aspect of the embodiments of the present application, the present application provides a TIP selection device based on a directed acyclic graph, including: a scanning module configured to determine each candidate TIP node by scanning a directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which a transaction is not confirmed; a calculation module configured to calculate an average topology value by an instant contribution of the candidate TIP node and a space-time decay factor, and determine a data distribution value of the candidate TIP node, wherein the space-time decay factor represents the recognition efficiency of the candidate TIP node in the directed acyclic graph; a weighting module configured to obtain a last round reputation score of the candidate TIP node, and calculate a current round reputation score by double weighting the last round reputation score, the average topology value, and the data distribution value; and a multiplication module configured to obtain a model update accuracy of the candidate TIP node, and multiply the model update accuracy and the current round reputation score to obtain a comprehensive weight of each candidate TIP node; and a processing module configured to select a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation by a TIP on the target TIP node.
[0014] According to another aspect of the embodiments of the present application, the present application provides an electronic device, comprising a memory, a processor, a communication interface and a communication bus, the memory stores a computer program executable on the processor, the memory, the processor and the communication interface communicate through the communication bus, and the processor executes the computer program to implement the steps of the above method.
[0015] According to another aspect of the embodiments of the present application, the present application further provides a computer readable medium having a non-volatile program code executable by a processor, the program code causing the processor to execute the above method.
[0016] The above technical solutions provided by the embodiments of the present application have the following advantages compared with related art: The present application provides a TIP selection method based on a directed acyclic graph, comprising: determining each candidate TIP node by scanning the directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which an unconfirmed transaction belongs; calculating the average topology value through the instant contribution of the candidate TIP node and the space-time decay factor, and determining the data distribution value of the candidate TIP node, wherein the space-time decay factor represents the recognition efficiency of the candidate TIP node in the directed acyclic graph; obtaining the last round reputation score of the candidate TIP node, and performing double-weighted calculation on the last round reputation score, the average topology value and the data distribution value to obtain the current round reputation score; obtaining the model update accuracy of the candidate TIP node, and multiplying the model update accuracy by the current round reputation score to obtain the comprehensive weight of each candidate TIP node; selecting a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation through the TIP on the target TIP node. First, the current round reputation score is obtained by double-weighted calculation of the historical reputation score, the average topology value and the data distribution value of the candidate TIP node, which avoids the volatility of single transaction feature; second, the space-time decay factor is used to measure the recognition efficiency of the candidate node in the graph, which avoids excessive dependence on outdated information; finally, the reputation score of the candidate TIP node is combined with the model update accuracy to calculate the comprehensive weight, so as to more accurately evaluate the global contribution of the node for TIP selection. The problem that the existing TIP selection method only depends on the instantaneous attribute of single transaction is solved. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings needed to be used in the embodiments or related art description. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
[0019] Figure 1 A hardware environment schematic diagram of an optional directed acyclic graph-based TIP selection method according to an embodiment of the present application; Figure 2 A flowchart of an optional directed acyclic graph-based TIP selection method according to an embodiment of the present application; Figure 3 A block diagram of an optional directed acyclic graph-based TIP selection device according to an embodiment of the present application; Figure 4 An optional electronic device structure schematic diagram according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without any creative effort fall within the protection scope of the present application.
[0021] In the subsequent description, the suffixes such as “module”, “component” or “unit” used to represent elements are only for the convenience of the description of the present application, and have no specific meaning. Therefore, “module” and “component” can be used interchangeably.
[0022] With the development of artificial intelligence and big data, federated learning, as a distributed machine learning method to protect data privacy, is gradually widely applied to cross-organizational and cross-device data collaboration scenarios. In the traditional federated learning architecture, the client uploads the locally trained model parameters or gradients to the central server, and the server performs unified aggregation to update the global model. However, the traditional method has significant deficiencies when dealing with non-independent and identically distributed (Non-IID) data: since the updates of all clients are forced into the same global model, the local feature information of some clients may be diluted, reducing the overall model performance.
[0023] To address coordination issues in decentralized scenarios, most current methods employ blockchain or directed acyclic graph structures to record client model update transactions (TIPs) and select TIPs for aggregation. However, existing TIP selection methods rely solely on the instantaneous attributes of a single transaction (such as the accuracy of a single model update), neglecting the client's historical contributions and long-term trustworthiness.
[0024] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a TIP selection method based on a directed acyclic graph is provided.
[0025] Optionally, in the embodiments of this application, the above-described TIP selection method based on directed acyclic graphs can be applied to, for example, Figure 1 The hardware environment shown consists of terminal 101 and server 102. For example... Figure 1 As shown, server 102 is connected to terminal 101 via a network and can be used to provide services to the terminal or clients installed on the terminal. Database 103 can be set up on the server or independently of the server to provide data storage services for server 102. The network mentioned above includes, but is not limited to, wide area network, metropolitan area network or local area network. Terminal 101 includes, but is not limited to, PC, mobile phone, tablet computer, etc.
[0026] The TIP selection method based on a directed acyclic graph in this embodiment can be executed by server 102, or it can be executed jointly by server 102 and terminal 101. Figure 2 As shown, it includes: Step 201: By scanning the directed acyclic graph, determine each candidate TIP node. The directed acyclic graph is constructed by the model transactions submitted by each client, and the candidate TIP nodes are the nodes to which unconfirmed transactions belong. Step 202: Calculate the average topological value and determine the data distribution value of the candidate TIP nodes by using the instantaneous contribution of the candidate TIP nodes and the spatiotemporal decay factor. The spatiotemporal decay factor characterizes the recognition efficiency of the candidate TIP nodes in the directed acyclic graph. Step 203: Obtain the reputation score of the candidate TIP node in the previous round, and perform a double weighted calculation on the reputation score of the previous round, the average topology value, and the data distribution value to obtain the reputation score of the current round. Step 204: Obtain the model update accuracy of the candidate TIP nodes, and multiply the model update accuracy by the reputation score of this round to obtain the comprehensive weight of each candidate TIP node. Step 205: Select the target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation through the TIP on the target TIP node.
[0027] In the distributed federated learning environment, accurate value assessment of participating entities is the key to maintaining the healthy operation of the system. This task faces complex challenges, including: first, the multi-dimensional nature of the indicators. The true contribution of the node should be considered from multiple dimensions such as model quality, computing efficiency, network reliability and security. Any single-dimensional evaluation is vulnerable to game behavior. Second, the challenge of dynamic evolution. The computing resources, network conditions and participation strategies of the node will change continuously with the training process and external environment. Static evaluation mechanisms are difficult to adapt to this continuous evolution. Finally, the deep influence of topological correlation. In the distributed ledger based on directed acyclic graph, the value of a transaction has a natural topological property. The importance of a contribution depends not only on its own quality, but also on its depth and breadth of reference in the entire topological structure. Based on this, the average topological value and data distribution value are proposed. The average topological value is used to utilize the natural transaction reference relationship of the DAG network to convert the propagation depth and reference situation of the node's historical model updates in the network into a value indicator. In simple terms, it combines the propagation depth and time decay of the model in the DAG to evaluate its long-term value. The data distribution value is used to evaluate the uniqueness of the client's data by comparing it with the global data distribution.
[0028] The directed acyclic graph is formed by the client continuously submitting model update transactions, and is dynamically constructed during the federated learning training process. The directed acyclic graph includes nodes and edges. The node represents the transaction (model update), and the edge represents the reference of the new transaction to the old TIP. The new transaction points to the referenced TIP, forming a directed acyclic graph (DAG). As each round of client training is completed and the transaction is submitted, the DAG adds new TIP nodes (transactions), the TIP node references the old TIP node, the new edge joins the DAG, and the original TIP is no longer the end TIP after being referenced. The DAG gradually records the historical updates and reference relationships of all nodes, which can reflect the contribution propagation and recognition.
[0029] The candidate TIP node is the node to which the unconfirmed transaction belongs. Each TIP includes the node ID that submitted the TIP, the model update increment generated by the local training of the node, and metadata (submission time, reference relationship, etc.).
[0030] Based on the time decay weighted average method, the historical reputation (i.e. last round reputation) is combined with real-time indicators (average topological value and data distribution value) to dynamically build this round's reputation. Then the node's this round reputation is combined with the current model update quality to get the comprehensive weight. Finally, the TIP selection is based on the comprehensive weight.
[0031] Clients can decide which TIPs are worth citing and which model updates are most valuable to local training according to the comprehensive weights of the nodes to which the TIPs belong. Updates from high-quality and high-reputation nodes are preferentially used to avoid the adverse effects of low-reputation or potentially malicious nodes on the model.
[0032] The present application proposes a federated learning framework based on a bootstrapped model update directed acyclic graph (EG-DAG), which does not force all clients to train a single global model, but allows clients to autonomously select other nodes for model updates according to a contribution quality indicator, and to conduct specialized training on local data. This mechanism naturally realizes the screening and propagation of model updates through the DAG structure, enabling specialized models focused on specific data distributions to be updated autonomously.
[0033] Compared with federated learning under a centralized or blockchain architecture, EG-DAG exhibits significant advantages when dealing with Non-IID data. It not only alleviates the performance loss caused by forced convergence, but also provides participating nodes with a more fair and anti-gaming value quantification method through the contribution evaluation mechanism inherent in the topology.
[0034] As an optional embodiment, the average topology value is calculated by the instant contribution of the candidate TIP node and the space-time decay factor, including: obtaining a set cardinality of the candidate TIP node, wherein the set cardinality is the cardinality of all transactions published by the client to which the candidate TIP node belongs; obtaining the instant contribution of each transaction on the candidate TIP node, and calculating the space-time decay factor of each transaction on the candidate TIP node; multiplying the instant contribution of each transaction by the space-time decay factor to obtain the weighted contribution value of each transaction; performing an averaging operation on each weighted contribution value to obtain an average value, and determining the average value as the average topology value.
[0035] The average topology value of each transaction is composed of two parts, namely the instant contribution and the space-time decay factor. For the instant contribution, the marginal improvement of the model update contained in the transaction to the accuracy of the global model; for the space-time decay factor, the maximum depth and time decay of the transaction cited in the DAG are combined to reflect the efficiency of the transaction recognized in the DAG network.
[0036] The formula for calculating the average topology value provided by the present application is as follows: , wherein, represents a transaction set published by the client to which the candidate TIP node belongs, represents a set cardinality, represents a transaction of the candidate TIP node in the current round currently calculated, Instantaneous contribution, Temporal-spatial decay factor.
[0037] Instantaneous contribution of each transaction Representative transaction The model update contained in it is calculated as follows: , , Where, Accuracy function, Represents the current baseline model (global model), Aggregation operator, represents the weighted average operation, And Weight coefficient, the sum is 1, usually, =0.5, =0.5, M is the current training round, Represents the model parameter update increment generated after training.
[0038] Under the decentralized cross-validation, the marginal gain of global model accuracy is generated, which ensures that the value assessment is based on the real and effective model improvement.
[0039] The average topology value is calculated by instantaneous contribution and temporal-spatial decay factor. The final topology value of a transaction not only depends on its instantaneous contribution, but also depends on its survival ability and recognized efficiency in the network, so as to realize the space-time perception evaluation of contribution value.
[0040] Next, the temporal-spatial decay factor ( ) is described.
[0041] As an optional embodiment, the temporal-spatial decay factor of each transaction on the candidate TIP node is calculated, including: obtaining the depth value of the current transaction and the current training round, wherein the depth value is the maximum depth of the current transaction cited in the directed acyclic graph; The ratio of the current training round to the depth value is multiplied by a preset parameter to obtain a product, wherein the preset parameter is a hyperparameter that controls the decay rate; Subtract the product from the target value, and determine the difference obtained as the temporal-spatial decay factor.
[0042] In the temporal-spatial decay factor ( ), the depth value of the current transaction is , the current training round is , the preset parameter is , and the target value is 1.
[0043] The depth value of the current transaction The maximum depth of a transaction referenced in the DAG structure, reflecting its degree of recognition in the topological space. The larger, the more subsequent transactions the TIP is referenced by, the higher the decay factor, indicating that the TIP contributes greatly to the network.
[0044] The current training round Represents the time dimension.
[0045] This ratio can be understood as the average time required for a transaction to obtain unit depth recognition, the smaller the ratio, the faster and more widely its value is accepted by the network. Default parameter As a hyperparameter to control the decay rate, this "spatiotemporal efficiency" is converted into a weight.
[0046] In order to effectively deal with the problem of data Non-IID and encourage data diversity, the application introduces data distribution value, and evaluates the uniqueness of client data in a privacy protection manner.
[0047] As an optional embodiment, determining the data distribution value of the candidate TIP node comprises: generating a local histogram of the client to which the candidate TIP node belongs; obtaining a global histogram and calculating a difference value of the local histogram and the global histogram, wherein the global histogram is obtained by aggregating local histograms of a plurality of clients; and smoothing and normalizing the difference value in an exponential form to obtain the data distribution value.
[0048] The local histogram is generated according to the local data set of the client, forming a distribution representation of the local data.
[0049] Based on the local histograms submitted by all clients in history, a global histogram corresponding to the global data distribution is constructed.
[0050] The difference between the local histogram and the global histogram is calculated using the Wasserstein distance, wherein the larger the Wasserstein distance, the more unique the local data, and the higher the potential contribution to model generalization, and the smaller the Wasserstein distance, the more similar the data distribution to the global.
[0051] The Wasserstein distance is denoted as , and the calculation formula is as follows: , Wherein, represents the local histogram, represents the global histogram, and inf represents the minimum value of the expected Euclidean distance of the local histogram and the global histogram.
[0052] To convert the raw distance into a numerical value that can be used for comparison, a smoothing normalization in exponential form is adopted to map the Wasserstein distance to a comparable value score, resulting in the data distribution value , which is calculated as follows: , where the decay rate and the non-linear response are adjustable sensitivity parameters (the default values in this application are and ), which control the decay rate of the scoring curve and the non-linear response characteristics of the distance metric, respectively.
[0053] By evaluating the uniqueness of the local data of the client, the marginal contribution of the client data to the model generalization ability can be effectively identified and quantified, and the participants who provide unique data distribution will be rewarded with value commensurate with their contribution, as they significantly improve the integrity of the global model. The evaluation index of data distribution value ensures that the client holding rare data can obtain higher value recognition for its supplement to the global model.
[0054] As an optional embodiment, the local histogram of the client to which the candidate TIP node belongs is generated, including: obtaining the local data set of the client to which the candidate TIP node belongs; counting the occurrence frequency of each class label in the local data set to generate a label distribution histogram; adding a preset noise to the label distribution histogram to obtain a local histogram.
[0055] The label distribution histogram of the data set generated by the client locally is obtained, and the occurrence frequency of each class label is counted to form a distribution representation of the local data.
[0056] To protect data privacy, Laplace noise is introduced into the label distribution histogram to generate a privacy-protected histogram that satisfies - differential privacy, that is, a privatized local histogram , which is calculated as follows: , where represents the label distribution histogram, represents the Laplace noise, represents the global sensitivity, which measures the sensitivity of the query or function output to the change of a single data. Since it only involves the change of a single data, it will only cause the value of a corresponding component in the histogram vector to change by ±1, and the remaining components remain unchanged. Therefore, the L1 distance (i.e. the sum of the absolute values of the differences of each component) between two histogram vectors is always 1, that is, =1, represents a privacy budget, used to control the strength of privacy protection , the value range of which is (0, +∞), The smaller the value is, the stronger the privacy protection is, and the larger the noise is.
[0057] The introduction of Laplace noise can reflect the data distribution characteristics while ensuring security, and avoid leaking sensitive information.
[0058] As an optional embodiment, the reputation score of the last round, the average topology value, and the data distribution value are double-weighted to obtain the reputation score of the current round, including: the average topology value and the data distribution value are first weighted to obtain a first weighted value; the last round reputation score and the first weighted value are second weighted by using a learning rate to obtain a second weighted value, wherein the learning rate is used to adjust the weight influence of the performance of the current training round on the overall reputation; and the second weighted value is determined as the reputation score of the candidate TIP node in the current round.
[0059] The final reputation score of each node in the tth round is dynamically composed of two parts: the last round reputation score adjusted by time decay, and the real-time evaluation score of the current round based on the average topology value and the data distribution value. By balancing the historical contribution and the latest performance through the time decay factor, the memory characteristics of the reputation system are retained, and the dynamic changes of node behavior can be captured sensitively, so as to accurately depict and respond to the reputation state of the node in time.
[0060] The formula for calculating the reputation score of the current round is as follows: wherein, represents the reputation score of the last round, represents the learning rate, which is usually [0.1, 0.3], which can effectively balance the stability and sensitivity of the reputation system, is the weight coefficient of the average topology value, is the weight coefficient of the data distribution value, and satisfy the normalization constraint , and in general cases = 0.5, = 0.5.
[0061] When performing the first weighted calculation of the average topological value and the data distribution value, an adaptive weight adjustment strategy is adopted to achieve dynamic optimization. In the early stage of training (e.g., the first 20% of the total training rounds), the weight of the data distribution value is increased to encourage data diversity. In the model convergence stage (e.g., the change in the global model accuracy is less than 0.1% for 5 consecutive rounds), the weight of the average topological value is increased accordingly to ensure the model convergence quality.
[0062] The learning rate is used to perform a second weighted calculation on the previous round's reputation score and the first weighted value. The weighting coefficient for the first weighted value. This represents the weighting coefficient of the reputation score from the previous round. Learning rate. Used to adjust the weight of the current round's performance on the overall reputation, a smaller amount. Values make the reputation update process smoother, reducing the volatility of individual assessments, while larger values... The value enhances the system's sensitivity to recent behavior, allowing reputation to reflect the latest performance more quickly.
[0063] The actual accuracy of the model update is Through the Softmax normalization function Will Mapped to a uniform scope, represented as The model update accuracy used in this application for calculation The calculation formula is as follows: , Where N represents the total number of tips, and exp represents the exponential function. This represents the actual accuracy rate for the i-th test.
[0064] Compare model update accuracy with this round's reputation score Multiply by each other to obtain the combined weight of each candidate TIP node. The calculation formula is as follows: .
[0065] The overall weight is used to guide the client in selecting the TIP node. For example, the update on the candidate TIP node with the highest overall weight can be selected for training and aggregation in the current round.
[0066] The time-decay-based weighted average method fuses historical reputation with real-time indicators to build a dynamic reputation system. The dynamic reputation system reflects node behavior, retains long-term contribution memory, and sensitively captures the latest performance of the node, thereby achieving accurate characterization and timely response of reputation. The update weight of a high-reputation node is amplified, so that even if the quality of a single round of update is general, the influence can be maintained. The weight of a low-reputation node is still regulated by the historical reputation even if it occasionally submits a high-quality update, thereby reducing the impact of malicious or accidental behavior on the system.
[0067] As an optional embodiment, after the target TIP node is selected, the method further includes: obtaining a first model increment of the target TIP node, and obtaining a second model increment obtained through local training; aggregating the first model increment and the second model increment to obtain a third model increment; encapsulating the third model increment to form a new transaction, wherein a previous transaction of the new transaction is a TIP on the target TIP node; and submitting the new transaction to a directed acyclic graph to update the directed acyclic graph.
[0068] The first model increment of the target TIP node is obtained as a reference or weighted input; a new model increment, referred to as a second model increment, is generated by training using data local to the client; and the first model increment and the second model increment are aggregated to form a third model increment for the final update of the current round, which can be referenced by other clients.
[0069] Specifically, the first model increment and the second model increment can be aggregated through a weighted average operation, and the formula is as follows: , wherein, is the first model increment, and the corresponding weight is of the present application, , is the second model increment, and the corresponding weight is of the present application, , is the third model increment. and can be adjusted according to actual conditions (such as adjustment according to immediate contribution).
[0070] The aggregated third model increment is encapsulated into a new transaction, including the ID of the client, the third model increment, a timestamp, and other metadata, and the new transaction references the TIP of the target TIP node selected in the current round as a previous transaction.
[0071] The new transaction is submitted to the DAG network, at which time the new transaction becomes a new TIP in the DAG, and the referenced TIP is updated to a non-terminal node (no longer a TIP). The new transaction points to the selected TIP, and the topology structure remains directed and acyclic.
[0072] In the embodiments provided in the application, the EG-DAG breaks through the limitation of traditional federated learning that forces single global model convergence, allows clients to autonomously select model updates according to contribution quality and perform local specialized training, and can adapt to the heterogeneity of non-independent and identically distributed data. The application also introduces a multi-dimensional contribution evaluation mechanism, including average topology value and data distribution value, relying on the DAG structure to achieve efficient screening and propagation of model updates. The average topology value quantifies the long-term dynamic influence of node contribution by analyzing the propagation depth and reference intensity of model updates in the DAG, combined with the time-space decay factor. The data distribution value is used to evaluate the uniqueness of the client data. The system scalability is improved by guiding the selection of clients and model updates, while the guided selection ensures that high-quality updates are propagated first, ensuring that clients with rare data can gain higher recognition for their contribution to the global model.
[0073] The application provides a TIP selection method based on a directed acyclic graph, comprising: determining each candidate TIP node by scanning the directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which an unconfirmed transaction belongs; calculating the average topology value of the candidate TIP node through the instant contribution of the candidate TIP node and the time-space decay factor, and determining the data distribution value of the candidate TIP node, wherein the time-space decay factor represents the recognition efficiency of the candidate TIP node in the directed acyclic graph; obtaining the last round reputation score of the candidate TIP node, and performing double-weighted calculation on the last round reputation score, the average topology value and the data distribution value to obtain the current round reputation score; obtaining the model update accuracy of the candidate TIP node, and multiplying the model update accuracy by the current round reputation score to obtain the comprehensive weight of each candidate TIP node; and selecting a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation through the TIP on the target TIP node. First, the current round reputation score is obtained by double-weighted calculation of the historical reputation score, the average topology value and the data distribution value of the candidate TIP node, avoiding the volatility of single transaction features; second, the time-space decay factor is used to measure the recognition efficiency of the candidate node in the graph, avoiding excessive dependence on outdated information; finally, the reputation score of the candidate TIP node is combined with the model update accuracy to calculate the comprehensive weight, so as to more accurately evaluate the global contribution of the node for TIP selection. The problem that the existing TIP selection method only depends on the instantaneous attributes of single transaction is solved.
[0074] According to another aspect of the embodiments of the application, the application provides a TIP selection device based on a directed acyclic graph, as shown in Figure 3 , comprising: The scanning module 301 is configured to determine each candidate TIP node by scanning a directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which a transaction that has not been confirmed belongs; The computing module 302 is configured to calculate an average topology value by instant contribution of the candidate TIP node and a space-time decay factor, and determine a data distribution value of the candidate TIP node, wherein the space-time decay factor represents a recognition efficiency of the candidate TIP node in the directed acyclic graph; The weighting module 303 is configured to obtain a last round reputation score of the candidate TIP node, and perform double-weighting calculation on the last round reputation score, the average topology value and the data distribution value to obtain a current round reputation score. The multiplication module 304 is configured to obtain a model update accuracy of the candidate TIP node, and multiply the model update accuracy with the current round reputation score to obtain a comprehensive weight of each candidate TIP node. The processing module 305 is configured to select a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation by a TIP on the target TIP node.
[0075] It should be noted that the scanning module 301 in this embodiment can be configured to execute step 201 in the embodiments of the present application, the computing module 302 in this embodiment can be configured to execute step 202 in the embodiments of the present application, the weighting module 303 in this embodiment can be configured to execute step 203 in the embodiments of the present application, the multiplication module 304 in this embodiment can be configured to execute step 204 in the embodiments of the present application, and the processing module 305 in this embodiment can be configured to execute step 205 in the embodiments of the present application.
[0076] Optionally, the computing module 302 includes: The first obtaining sub-module is configured to obtain a set cardinality of the candidate TIP node, wherein the set cardinality is a cardinality of all transactions historically published by a client to which the candidate TIP node belongs. The second obtaining sub-module is configured to obtain instant contribution of each transaction on the candidate TIP node, and calculate a space-time decay factor of each transaction on the candidate TIP node. The multiplication sub-module is configured to multiply the instant contribution of each transaction with the space-time decay factor to obtain a weighted contribution value of each transaction. The average obtaining sub-module is configured to perform an average operation on each weighted contribution value to obtain an average value, and determine the average value as the average topology value.
[0077] Optionally, the second obtaining sub-module is further configured to obtain a depth value of the current transaction and a current training round, wherein the depth value is a maximum depth at which the current transaction is referenced in the directed acyclic graph; multiply a ratio of the current training round to the depth value by a preset parameter to obtain a product, wherein the preset parameter is a hyperparameter that controls a decay rate; subtract the product from the target value, and determine a difference obtained as the spatiotemporal decay factor.
[0078] Optionally, the computing module 302 further includes: a generating sub-module configured to generate a local histogram of a client to which the candidate TIP node belongs; a third obtaining sub-module configured to obtain a global histogram and calculate a difference value between the local histogram and the global histogram, wherein the global histogram is obtained by aggregating local histograms of multiple clients; a normalization sub-module configured to perform smooth normalization on the difference value in an exponential form to obtain a data distribution value.
[0079] Optionally, the generating sub-module is further configured to obtain a local data set of the client to which the candidate TIP node belongs; count frequencies of various class labels in the local data set to generate a label distribution histogram; and add a preset noise to the label distribution histogram to obtain the local histogram.
[0080] Optionally, the weighting module 303 is specifically configured to perform first weighting calculation on the average topology value and the data distribution value to obtain a first weighted value; perform second weighting calculation on a previous round reputation score and the first weighted value by using a learning rate to obtain a second weighted value, wherein the learning rate is used to adjust a weight influence of a performance of a current training round on an overall reputation; and determine the second weighted value as a current round reputation score of the candidate TIP node.
[0081] Optionally, the apparatus further includes an updating module configured to, after the target TIP node is selected, obtain a first model increment of the target TIP node, and obtain a second model increment obtained through local training; aggregate the first model increment and the second model increment to obtain a third model increment; encapsulate the third model increment to form a new transaction, wherein a previous transaction of the new transaction is a TIP on the target TIP node; and submit the new transaction to the directed acyclic graph to update the directed acyclic graph.
[0082] It should be noted that the above modules and the examples and application scenarios realized by the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules as part of the apparatus can run in a hardware environment such as Figure 1 as shown in the figure.
[0083] According to another aspect of the embodiments of the present application, the present application provides an electronic device, such as Figure 4As shown, the electronic device includes a memory 401, a processor 402, a communication interface 403, and a communication bus 404, the memory 401 stores a computer program executable on the processor 402, the memory 401 and the processor 402 communicate through the communication interface 403 and the communication bus 404, and the processor 402 implements the steps of the above method when executing the computer program.
[0084] The memory and the processor in the electronic device communicate through the communication bus and the communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0085] The memory can include a Random Access Memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0086] The processor described above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0087] According to another aspect of the embodiments of the present application, a computer readable medium having non-volatile program code executable by a processor is also provided.
[0088] Optionally, the specific examples in the embodiments can refer to the examples described in the above embodiments, and the embodiments will not be described here.
[0089] In the specific implementation, the embodiments of the present application can refer to the above various embodiments and have corresponding technical effects.
[0090] It can be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing units can be implemented within one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP Devices), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described herein, or a combination thereof.
[0091] For software implementation, the techniques described herein can be implemented with a processing unit that executes software routines or functions to perform the techniques described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented within the processor or external to the processor.
[0092] Those of ordinary skill in the art can understand that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0093] Those of ordinary skill in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0094] In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other ways. For example, the apparatus embodiments described above are only schematic, and the division of the modules is only a logical function division, and there can be another division way in actual implementation, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0095] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0096] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0097] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, and the computer software products are stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various program codes that can be stored in the medium. It should be noted that in this paper, terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed, or include elements inherent to such processes, methods, articles or devices. Without more limitations, the elements defined by the statement "including a" do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0098] The above is only a specific embodiment of the present application, so that those skilled in the art can understand or implement the present application. Various modifications of these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A method for TIP selection based on directed acyclic graph, characterized in that, The method comprises the following steps: determining candidate TIP nodes by scanning a directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP nodes are nodes to which unconfirmed transactions belong; calculating an average topology value by instant contribution of the candidate TIP nodes and a space-time decay factor, and determining a data distribution value of the candidate TIP nodes, wherein the space-time decay factor represents the recognition efficiency of the candidate TIP nodes in the directed acyclic graph; obtaining a last round reputation score of the candidate TIP nodes, and performing double-weighted calculation on the last round reputation score, the average topology value and the data distribution value to obtain a current round reputation score; obtaining a model update accuracy of the candidate TIP nodes, and multiplying the model update accuracy with the current round reputation score to obtain a comprehensive weight of each candidate TIP node; selecting a target TIP node from each candidate TIP node according to the comprehensive weight, so as to perform local model training and aggregation by a TIP on the target TIP node.
2. The method of claim 1, wherein, The method of calculating the average topology value by the instant contribution of the candidate TIP nodes and the space-time decay factor comprises the following steps: obtaining a set cardinality of the candidate TIP nodes, wherein the set cardinality is the cardinality of all transactions historically published by a client to which the candidate TIP nodes belong; obtaining the instant contribution of each transaction on the candidate TIP nodes, and calculating a space-time decay factor of each transaction on the candidate TIP nodes; multiplying the instant contribution of each transaction with the space-time decay factor to obtain a weighted contribution value of each transaction; averaging each weighted contribution value to obtain an average value, and determining the average value as the average topology value.
3. The method of claim 2, wherein, The method of calculating the space-time decay factor of each transaction on the candidate TIP nodes comprises the following steps: obtaining a depth value of a current transaction and a current training round, wherein the depth value is the maximum depth of the current transaction referenced in the directed acyclic graph; multiplying the ratio of the current training round to the depth value with a preset parameter to obtain a product, wherein the preset parameter is a hyperparameter for controlling the decay rate; subtracting a target value from the product, and determining the difference as the space-time decay factor.
4. The method of claim 1, wherein, The method of determining the data distribution value of the candidate TIP nodes comprises the following steps: generating a local histogram of a client to which the candidate TIP nodes belong; obtaining a global histogram, and calculating a difference value of the local histogram and the global histogram, wherein the global histogram is obtained by aggregating local histograms of multiple clients; performing exponential smoothing normalization on the difference value to obtain the data distribution value.
5. The method of claim 4, wherein, The method of generating the local histogram of the client to which the candidate TIP nodes belong comprises the following steps: obtaining a local data set of the client to which the candidate TIP nodes belong; counting the frequency of each class label in the local data set to generate a label distribution histogram; Add preset noise in the label distribution histogram to obtain the local histogram.
6. The method of claim 1, wherein, The double-weighted calculation of the last round reputation score, the average topology value and the data distribution value obtains a current round reputation score, including: The first weighted calculation of the average topology value and the data distribution value obtains a first weighted value; The second weighted calculation of the last round reputation score and the first weighted value by using a learning rate obtains a second weighted value, wherein the learning rate is used to adjust the weight influence of the performance of the current training round on the overall reputation; The second weighted value is determined as the current round reputation score of the candidate TIP node.
7. The method of claim 1, wherein, After the target TIP node is selected, the method further includes: Obtaining a first model increment of the target TIP node, and obtaining a second model increment obtained by local training; The aggregation of the first model increment and the second model increment obtains a third model increment; The third model increment is encapsulated to form a new transaction, wherein the previous transaction of the new transaction is the TIP on the target TIP node; The new transaction is submitted to the directed acyclic graph to update the directed acyclic graph.
8. A TIP selection apparatus based on a directed acyclic graph, characterized by Including: The scanning module is used to determine each candidate TIP node by scanning a directed acyclic graph, wherein the directed acyclic graph is constructed by model transactions submitted by each client, and the candidate TIP node is a node to which an unconfirmed transaction belongs; The computing module is used to calculate an average topology value by an instant contribution of the candidate TIP node and a space-time attenuation factor, and determine a data distribution value of the candidate TIP node, wherein the space-time attenuation factor represents the recognition efficiency of the candidate TIP node in the directed acyclic graph; The weighting module is used to obtain a last round reputation score of the candidate TIP node, and double-weighted calculation of the last round reputation score, the average topology value and the data distribution value obtains a current round reputation score; The multiplication module is used to obtain a model update accuracy of the candidate TIP node, and multiply the model update accuracy and the current round reputation score to obtain a comprehensive weight of each candidate TIP node; The processing module is used to select a target TIP node from each candidate TIP node according to each comprehensive weight, so as to perform local model training and aggregation by a TIP on the target TIP node.
9. An electronic device comprising a memory, a processor, a communication interface and a communication bus, the memory having stored therein a computer program executable on the processor, the memory, the processor being in communication via the communication bus and the communication interface, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 7.
10. A computer readable medium having non-transitory program code executable by a processor, the program code comprising instructions for: The program code causes the processor to execute the method in any one of claims 1 to 7.
Citation Information
Patent Citations
Internet of Things directed acyclic graph block chain data consensus method based on improved IOTA protocol
CN117596270A
Model training method and device, storage medium and electronic equipment
CN118170772A
Transaction chain abnormal node identification method based on knowledge graph enhancement
CN120234582A
System and method for implementing consensus in distributed ledger arrangement
EP3706383A1