TIP selection method and apparatus based on directed acyclic graph, device, and medium
By combining the techniques of directed acyclic graphs, the problem that the existing TIP selection methods only rely on the attributes of a single transaction is solved, which enables a more accurate evaluation of TIP nodes and improves the accuracy and stability of model training.
Patent Information
- Application Number
- CN202511417124.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-12-26
- 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, and data distribution value of candidate TIP nodes are calculated. Combined with the reputation score from the previous round, a double weighting is performed to obtain a comprehensive weight, and target TIP nodes are selected for model training and aggregation.
It enables more accurate evaluation of TIP nodes, avoids the volatility of single transaction features, improves the accuracy and stability of model training, adapts to the heterogeneity of non-independent and identically distributed data, and enhances the scalability of the system.
Smart Images

Figure CN120910312B_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:
[0017] 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 recognition efficiency of the candidate node in the graph is measured through the space-time decay factor, 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 relies on the instantaneous attributes of single transaction is solved. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.
[0019] 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.
[0020] 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 is provided.
[0021] Figure 2 A flowchart of an optional directed acyclic graph-based TIP selection method according to an embodiment of the present application is provided.
[0022] Figure 3 A block diagram of an optional directed acyclic graph-based TIP selection device according to an embodiment of the present application is provided.
[0023] Figure 4 An optional electronic device structure schematic diagram according to an embodiment of the present application is provided. DETAILED DESCRIPTION
[0024] 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.
[0025] 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.
[0026] With the development of artificial intelligence and big data, federated learning, as a distributed machine learning method to protect 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 performs unified aggregation to update the global model. 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.
[0027] 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.
[0028] 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.
[0029] 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.
[0030] 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:
[0031] 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.
[0032] 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.
[0033] 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.
[0034] 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.
[0035] Step 205, selecting a target TIP node from the various candidate TIP nodes according to the respective comprehensive weights, so as to perform local model training and aggregation through the TIP on the target TIP node.
[0036] In a 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 convert the propagation depth and reference of the model updates published by the node in the network into a value indicator by using the natural transaction reference relationship of the DAG network. 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.
[0037] 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 a new TIP node (transaction), the TIP node references the old TIP node, and the new edge is added to the DAG. 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.
[0038] The candidate TIP node is the node to which the unconfirmed transaction belongs. Each TIP includes the node ID of the node that submitted the TIP, the model update increment generated by the local training of the node, and metadata (submission time, reference relationship, etc.).
[0039] The time-decay-based weighted average method fuses historical reputation (i.e. last round reputation) and real-time indicators (average topology value and data distribution value) to dynamically build the current round reputation, then fuses the current round reputation of the node with the current model update quality to obtain a comprehensive weight, and finally selects the TIP according to the comprehensive weight.
[0040] The client can decide which TIP is worth citing and which model update is most valuable for local training according to the comprehensive weight of the node to which the TIP belongs. The update of a high-quality and high-reputation node is preferentially used to avoid the adverse effects of low-reputation or potentially malicious nodes on the model.
[0041] The application provides 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 update 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 focusing on specific data distributions to be updated autonomously.
[0042] 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 a more fair and anti-gaming value quantification method for participating nodes through the contribution evaluation mechanism inherent in the topology structure.
[0043] As an optional embodiment, the average topology value is calculated by the instant contribution of each transaction 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 historically published by the client to which the candidate TIP node belongs; obtaining the instant contribution of each transaction of the candidate TIP node and calculating the space-time decay factor of each transaction of 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; and performing an averaging operation on each weighted contribution value to obtain an average value, and determining the average value as the average topology value.
[0044] 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 in the DAG are combined to reflect the efficiency of the transaction in the DAG network.
[0045] The formula for calculating the average topology value provided by the application is as follows:
[0046] ,
[0047] where, represents the set of transactions published by the client where the candidate TIP node is located, represents the set cardinality, represents the current round of transactions of the candidate TIP node currently calculated, represents the instant contribution, represents the spatio-temporal decay factor.
[0048] Instant contribution of each transaction represents the transaction contains the model update, and the calculation formula is as follows:
[0049] ,
[0050] ,
[0051] where, represents the accuracy function, represents the current benchmark model (global model), is an aggregation operator, representing a weighted average operation, and are weight coefficients, and the sum is 1, and in general, = 0.5, = 0.5, and M is the current training round, represents the model parameter update increment generated after training.
[0052] Under the decentralized cross-validation, marginal gains are generated for the accuracy of the global model, which ensures that the basis for value assessment is real and effective model improvement.
[0053] The average topology value is calculated by the instant contribution and the spatio-temporal decay factor, and the final topology value of a transaction depends not only on its instant contribution, but also on its survival ability and recognized efficiency in the network, thereby realizing the spatio-temporal perception evaluation of contribution value.
[0054] Next, the spatio-temporal decay factor ( ) is described.
[0055] As an optional embodiment, the space-time attenuation 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 referenced in the directed acyclic graph; multiplying the 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 for controlling the attenuation rate; subtracting the target value from the product, and determining the difference obtained as the space-time attenuation factor.
[0056] In the space-time attenuation factor (f ), the depth value of the current transaction is d , the current training round is t , the preset parameter is a , and the target value is 1.
[0057] The depth value of the current transaction d indicates the maximum depth of the transaction referenced in the DAG structure, reflecting its degree of recognition in the topological space. The greater the value, the more subsequent transactions reference the TIP, and the higher the attenuation factor, indicating that the TIP has a large contribution to the network.
[0058] The current training round t represents the time dimension.
[0059] 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 the value is accepted by the network. The preset parameter a is a hyperparameter for controlling the attenuation rate, which converts this "space-time efficiency" into a weight.
[0060] In order to effectively deal with the problem of data non-independent and identical distribution (Non-IID) and encourage data diversity, the application introduces data distribution value and uses a privacy protection method to evaluate the uniqueness of client data.
[0061] As an optional embodiment, the data distribution value of the candidate TIP node is determined, including: generating a local histogram of the client to which the candidate TIP node belongs; obtaining a global histogram and calculating a difference value between the local histogram and the global histogram, wherein the global histogram is obtained by aggregating local histograms of multiple clients; and performing exponential smoothing normalization on the difference value to obtain the data distribution value.
[0062] The local histogram is generated according to the local data set of the client, forming a distribution representation of the local data.
[0063] Based on the local histograms submitted by all clients in history, a global histogram corresponding to the global data distribution is constructed.
[0064] The Wasserstein distance is used to calculate the difference between the local histogram and the global histogram, wherein the greater the Wasserstein distance indicates that the local data is more unique, and the higher the potential contribution to model generalization, and the smaller the Wasserstein distance indicates that the data distribution is more similar to the global.
[0065] The Wasserstein distance is denoted as , and the calculation formula is as follows:
[0066] ,
[0067] , wherein represents the local histogram, represents the global histogram, and inf represents the minimum value expected by selecting the Euclidean distance of the local histogram and the global histogram.
[0068] In order to convert the original distance into a numerical value that can be used for comparison, it is convenient to calculate the weight with other nodes, and the exponential form is used for smoothing normalization. The Wasserstein distance is mapped to a comparable value score to obtain the data distribution value , and the formula is as follows:
[0069] ,
[0070] , wherein the decay rate and the nonlinear response are adjustable sensitivity parameters (the default values of the present application are and ), which respectively control the decay rate of the scoring curve and the nonlinear response characteristics of the distance measurement.
[0071] 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. Participants with unique data distribution will obtain a value reward commensurate with their contribution, because 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 due to the supplement of the global model view.
[0072] As an optional embodiment, the local histogram of the client to which the candidate TIP node belongs is generated, comprising: 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; adding a preset noise to the label distribution histogram to obtain the local histogram.
[0073] The label distribution histogram of the data set generated by the client locally is obtained, and the occurrence frequency of each category label is counted to form a distribution representation of the local data.
[0074] To protect data privacy, Laplace noise is introduced into the label distribution histogram to generate a privacy-preserving histogram that satisfies - differential privacy, that is, a privatized local histogram The calculation formula is as follows:
[0075]
[0076] wherein, represents a label distribution histogram, represents Laplace noise, represents a global sensitivity, which is used to measure 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 between the components) of two histogram vectors is always 1, that is, = 1, represents a privacy budget, which is used to control the strength of privacy protection The value of ranges from (0, +∞), The smaller the value is, the stronger the privacy protection is, and the larger the noise is.
[0077] The introduction of Laplace noise can reflect the data distribution characteristics while ensuring security, and avoid leaking sensitive information.
[0078] 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: performing a first weighting calculation on the average topology value and the data distribution value to obtain a first weighted value; performing a second weighting calculation on the reputation score of the last round 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 reputation score of the candidate TIP node in the current round.
[0079] The final reputation score of each node in the tth round is dynamically composed of two parts: the reputation score of the last round adjusted by time decay, and the real-time evaluation score based on the average topology value and the data distribution value in the current round. 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 the node behavior can be captured sensitively, so as to accurately depict and respond to the reputation state of the node in time.
[0080] The formula for calculating the reputation score of the current round is as follows:
[0081] ,
[0082] wherein, denotes the reputation score of the last round, denotes the learning rate, usually [0.1, 0.3] 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, is the reputation score of the current round, satisfies the normalization constraint , generally = 0.5, = 0.5.
[0083] When the first weighted calculation of the average topology value and the data distribution value is performed, in order to achieve dynamic optimization, an adaptive weight adjustment strategy is adopted. In the early stage of training (such as 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 (such as when the accuracy of the global model changes by less than 0.1% for 5 consecutive rounds), the weight of the average topology value is correspondingly increased to ensure the quality of model convergence.
[0084] The learning rate is used to perform the second weighted calculation on the reputation score of the last round and the first weighted value, is the weight coefficient of the first weighted value, is the weight coefficient of the reputation score of the last round. The learning rate is used to adjust the weight influence of the current round performance on the overall reputation. A smaller value will make the reputation update process smoother and reduce the volatility of single evaluation, while a larger value will enhance the sensitivity of the system to recent behavior, so that the reputation can more quickly reflect the latest performance.
[0085] The actual accuracy of model update is , which is mapped to a unified range by the Softmax normalization function , denoted as , as the model update accuracy calculated by the present application, The calculation formula of is as follows:
[0086] ,
[0087] wherein N represents the total number of TIPs, exp represents the exponential function, represents the actual accuracy of the i-th time.
[0088] The model update accuracy is multiplied by the reputation score of the current round to obtain the comprehensive weight of each candidate TIP node The calculation formula is as follows:
[0089] .
[0090] The comprehensive weight is used to guide the client to select the TIP node. For example, the update on the candidate TIP node with the highest comprehensive weight can be selected for training and aggregation in the current round.
[0091] Based on the time-decay weighted average method, the historical reputation is fused with the real-time indicators to build a dynamic reputation system. The dynamic reputation system dynamically reflects the node behavior, retains the long-term contribution memory, and can also sensitively capture the latest performance of the node, so as to realize accurate characterization and timely response of the reputation. The update weight of the high-reputation node is amplified, so that even if the quality of single-round update is general, the influence can be maintained. The update weight of the low-reputation node is still adjusted by the historical reputation even if the node occasionally submits high-quality updates, so as to reduce the system impact of malicious or accidental behaviors.
[0092] 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 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 a 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.
[0093] The first model increment of the target TIP node is obtained as a reference or weighted input; the local data of the client is used for training to generate a new model increment, which is called a second model increment; and the first model increment and the second model increment are aggregated to form a third model increment of the final update in the current round, which can be referenced by other clients.
[0094] Specifically, the first model increment and the second model increment can be aggregated by weighted average operation, and the formula is as follows:
[0095] ,
[0096] Among them, is the first model increment, and the corresponding weight is The , is the second model increment, and the corresponding weight is The , is the third model increment. and can be adjusted according to actual conditions (such as adjustment according to instant contribution).
[0097] The third model increment after polymerization is packaged into a new transaction, including the client ID, the third model increment, the timestamp and other metadata, and the new transaction references the TIP of the target TIP node selected in this round as the predecessor transaction.
[0098] 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 maintains the directed acyclicity.
[0099] In the embodiments provided in the present application, the EG-DAG breaks through the limitation of traditional federated learning that forces a single global model to converge, allowing clients to autonomously select model updates and conduct local specialized training according to contribution quality, and can adapt to the heterogeneity of non-independent and identically distributed data. The present 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 strength of the model update in the DAG, combined with the time-space decay factor. The data distribution value is used to evaluate the uniqueness of the client data. It is used to guide the selection of clients and model updates, improving the scalability of the system, while ensuring that high-quality updates are preferentially propagated through guided selection, ensuring that clients holding rare data can be recognized for their higher value due to their contribution to the global model.
[0100] The application provides a TIP selection method based on a directed acyclic graph, comprising: determining 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; calculating an average topology value by an 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 by a 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, thereby avoiding the volatility of a single transaction feature; second, the space-time decay factor is used to measure the recognition efficiency of the candidate node in the graph, thereby avoiding excessive dependence on out-of-date information; and 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 and select the TIP. The problem that the existing TIP selection method only depends on the instantaneous attribute of a single transaction is solved.
[0101] 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:
[0102] 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 an unconfirmed transaction belongs.
[0103] The calculation module 302 is 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.
[0104] The weighting module 303 is configured to obtain a last round reputation score of the candidate TIP node, and perform 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.
[0105] The multiplication module 304 is configured to obtain the model update accuracy of the candidate TIP node, multiply the model update accuracy with the reputation score of the current round, and obtain the comprehensive weight of each candidate TIP node.
[0106] The processing module 305 is configured to select a target TIP node from the candidate TIP nodes according to the comprehensive weights, so as to perform local model training and aggregation through the TIP on the target TIP node.
[0107] 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 calculation 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.
[0108] Optionally, the calculation module 302 comprises:
[0109] The first obtaining sub-module is configured to obtain a set cardinality of the candidate TIP node, wherein the set cardinality is the cardinality of all transactions published by a client to which the candidate TIP node belongs;
[0110] The second obtaining sub-module is configured to obtain the 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;
[0111] 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.
[0112] The averaging sub-module is configured to perform an averaging operation on the weighted contribution values to obtain an average value, and determine the average value as the average topology value.
[0113] 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 the maximum depth of the current transaction in a directed acyclic graph; multiply a 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 a decay rate; subtract the product from a target value to obtain a difference, and determine the difference as the space-time decay factor.
[0114] Optionally, the calculation module 302 further comprises:
[0115] The generating sub-module is configured to generate a local histogram of the client to which the candidate TIP node belongs.
[0116] The third obtaining sub-module is 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 the local histograms of the plurality of clients;
[0117] The normalization sub-module is configured to perform smooth normalization on the difference value in an exponential form to obtain a data distribution value.
[0118] 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 the occurrence frequency of each class label in the local data set, and generate a label distribution histogram; and add a preset noise to the label distribution histogram to obtain the local histogram.
[0119] 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 the reputation score of the last round 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 determine the second weighted value as the reputation score of the candidate TIP node in the current round.
[0120] 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 by 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 the 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.
[0121] 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 the hardware environment as shown in Figure 1 .
[0122] According to another aspect of the embodiments of the present application, the present application provides an electronic device, as shown in Figure 4 , including a memory 401, a processor 402, a communication interface 403, and a communication bus 404, the memory 401 stores a computer program that can run 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 executes the computer program to realize the steps of the above method.
[0123] The memory, the processor in the electronic device above communicate through a communication bus and a 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.
[0124] 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.
[0125] The processor above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; 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.
[0126] 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.
[0127] 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.
[0128] In the specific implementation, the embodiments of the present application can refer to the above various embodiments and have corresponding technical effects.
[0129] 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.
[0130] 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.
[0131] 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 solutions. Those of ordinary skill 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.
[0132] 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.
[0133] 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.
[0134] 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.
[0135] 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.
[0136] The functions, if realized in the form of software functional units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is 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.
[0137] 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; the calculation of the average topology value by the instant contribution of the candidate TIP nodes and the space-time decay factor comprises: 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.
2. The method of claim 1, wherein, the calculation of the space-time decay factor of each transaction on the candidate TIP nodes comprises: 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 and 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.
3. The method of claim 1, wherein, the determination of the data distribution value of the candidate TIP nodes comprises: 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.
4. The method of claim 3, wherein, the generation of the local histogram of the client to which the candidate TIP nodes belong comprises: obtaining a local data set of the client to which the candidate TIP nodes belong; counting the occurrence frequency of each class label in the local data set to generate a label distribution histogram; Add preset noise to the label distribution histogram to obtain the local histogram.
5. 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.
6. 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; Aggregating the first model increment and the second model increment to obtain a third model increment; Packaging the third model increment to form a new transaction, wherein the previous transaction of the new transaction is the TIP on the target TIP node; Submitting the new transaction to the directed acyclic graph to update the directed acyclic graph.
7. A TIP selection apparatus based on a directed acyclic graph, characterized by It includes: The scanning module 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 an unconfirmed transaction belongs; The computing module is configured to calculate an average topology value by an instant contribution of each candidate TIP node and a space-time decay factor, and determine a data distribution value of each candidate TIP node, wherein the space-time decay factor represents the recognition efficiency of each candidate TIP node in the directed acyclic graph; The weighting module is configured to obtain a last round reputation score of each candidate TIP node, and perform 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 of each candidate TIP node; The multiplication module is configured to obtain a model update accuracy of each 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 configured to select a target TIP node from each candidate TIP node according to each comprehensive weight, and perform local model training and aggregation by a TIP on the target TIP node; The computing module is further configured to obtain a set cardinality of each candidate TIP node, wherein the set cardinality is a cardinality of all transactions historically published by a client to which each candidate TIP node belongs; obtain an instant contribution of each transaction on each candidate TIP node, and calculate a space-time decay factor of each transaction on each candidate TIP node; multiply the instant contribution of each transaction and the space-time decay factor to obtain a weighted contribution value of each transaction; and perform an average operation on each weighted contribution value to obtain an average value, and determine the average value as the average topology value.
8. An electronic device comprising a memory, a processor, a communication interface and a communication bus, the memory storing a computer program executable on the processor, the memory, the processor communicating through the communication bus and the communication interface, characterized in that, The processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 6.
9. A computer readable medium having a non-transitory program code executable by a processor, the program code comprising instructions for: The program code causes the processor to perform the method of any one of claims 1 to 6.
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