Smartchain Mobile AI Computing Implementation
Smartchain is a mobile AI computing power public chain that supports distributed computing and provides a blockchain-based distributed computing and result aggregation mechanism. The result aggregation module is used to gather computing results from various slave nodes in the blockchain and aggregate them according to the result aggregation function specified in the smart contract.
1. Distributed Computing and Result Aggregation Module
In the Smartchain mobile AI computing ecosystem, the main node writes a smart contract based on its computing needs. The smart contract includes two core functionalities:
Distributed Computing Function: Defines how to execute distributed computing tasks across multiple nodes.
Result Aggregation Function: Defines how to aggregate the computing results from various slave nodes.
The smart contract also contains contract description information to help slave nodes understand the main content and execution requirements of the contract.
2. Smart Contract Deployment and Task Allocation
Main Node Creates and Deploys Contract: The main node writes a smart contract according to computing requirements and deploys it to the blockchain network.
Slave Nodes Claim the Contract: All nodes on the blockchain can view the contract description information to determine whether they have sufficient computing resources. Nodes with available resources will claim the contract as slave nodes and store the contract's execution logic locally.
Blockchain Recording: The claim actions and related operations of slave nodes are recorded in the blockchain ledger, ensuring transparency and immutability of the data.
3. Slave Nodes Execute Computing Tasks
Distributed Computing: Each slave node executes computing tasks based on the distributed computing function in the smart contract and its local data set.
Upload Results: Slave nodes upload their computing results to the blockchain, and the main node retrieves all results from the blockchain.
4. Result Aggregation and Filtering Mechanism
Result Validation and Filtering: To prevent dishonest nodes or data errors from causing anomalous results, the main node uses the following mechanisms to filter the computing results:
Predefined Algorithm Filtering: The main node uses predefined anomaly detection algorithms to filter the results from slave nodes.
Historical Weight Calculation: The main node can retrieve slave node historical computation records (including participation frequency, data volume, and timestamps) from the blockchain ledger. Based on this data, the node calculates each slave node’s weight PPP using the following formula:
Where:
nnn: Number of historical computations a node has participated in.
sis_isi: Data volume involved in the i-th computation.
tit_iti: Time span between the i-th computation and the current time.
Anomaly Detection Algorithm: The main node uses the Local Outlier Factor (LOF) algorithm to detect anomalous computation results. The steps are as follows:
Calculate the local reachability density of each result.
Use weight PPP to adjust the distance measure, improving filtering accuracy.
If the local outlier factor of a computation result exceeds a preset threshold, the result is marked as anomalous and filtered out.
Through the steps above, the weights of each node can be determined, and the main node, based on the results of the anomaly detection algorithm, can verify the computation results from each slave node.
In the anomaly detection algorithm:
When dk(o) = d(o,p), the following conditions must hold:
There exists k points p' ∈ D {o}, such that d(o, p') ≤ d(o, p).
There exists k-1 points p' ∈ D {o}, such that d(o, p') < d(o, p); this means that p is the k-th closest point to o. Define Nk(p) as the k-th closest point to p, and d(o,p) as the distance between points o and p.
The local reachability density (LRD) is defined as:
The local outlier factor (LOF) for the node is defined as:
By combining the above formula, the local outlier factor of each sample in the sample set can be calculated. The higher the local outlier factor, the more likely the sample is an outlier.
Based on the above anomaly detection algorithm, Smartchain Intelligent Computing Public Chain will combine the computation results from all the slave nodes as a sample set, with each slave node's computation result treated as a sample in the set. To improve the distance calculation in the anomaly detection algorithm, the POS algorithm is used. The new distance is defined as POS distance: d′(o, p), where Pn represents the weight of the n-th slave node. For each slave node, the POS distance corresponding to its computation result is substituted into the anomaly detection algorithm to find the local anomaly factor corresponding to each slave node's computation result.
Result Aggregation: The results are aggregated by calculating the final result through POS distance to ensure that the distributed computing task is completed.
5.Improvement Advantages
Data Security and Transparency:
All node operations are recorded in the blockchain ledger, ensuring that data is immutable and secure.
Distributed computing enables data sharing while effectively preventing data leaks.
Efficient Distributed Computing:
By introducing smart contracts, the blockchain transaction process is transformed into a computing framework, supporting large-scale data distributed computing.
The result filtering mechanism effectively excludes anomalous nodes, ensuring the reliability of the computing results.
Flexible Scalability:
Predefined algorithms and weight mechanisms can be adjusted flexibly according to actual needs.
Suitable for various distributed computing scenarios such as AI model training, image processing, and real-time data analysis.
6. Application Scenarios
AI Model Training for Mobile Devices: By leveraging the idle computing power of distributed mobile devices, deep learning models can be trained efficiently.
Real-Time Image Processing: Each slave node independently processes local data, while the main node aggregates the results. This is particularly useful in applications such as autonomous driving or video surveillance.
Blockchain Smart Cities: By combining IoT devices with distributed computing power, real-time decision optimization for smart cities can be achieved.
Smartchain Mobile AI computing ecosystem, through the combination of blockchain technology and distributed computing frameworks, greatly enhances the efficiency of utilizing computing resources, empowering innovative development across various industries.
Last updated