Allora: A Self-Improving Decentralized Network for AI and ML
ContributionDAO
0xFd14
September 6th, 2024

Written by Fieldlnwza007, infographics by Earth, special thanks to Michael Zacharski for his valuable suggestions.

Introduction

Artificial Intelligence (AI) and Machine Learning (ML) have garnered significant attention in the blockchain space, leading to the launch of many projects that integrate AI to attract users and investors. However, many of these projects either use AI merely as a marketing buzzword or struggle to effectively leverage AI within decentralized networks.

In this article, we will explore Allora, a blockchain network specifically designed for AI and ML. Unlike traditional decentralized AI systems, Allora is a self-improving decentralized collective intelligence network that optimizes its capabilities beyond those of its individual participants.

Note: The formulae used in Allora are more complex than presented in this article. They involve logarithms and differentiations. However, for the sake of clarity and simplicity, I have adjusted the formulae to include only basic math operations while maintaining the core concepts, so that general readers can understand without being distracted by complex mathematics.

Keywords and Definitions

Before diving into how Allora works, let’s define some key terms that will be used throughout this article:

  • Inference: A prediction or output generated by an inference worker node (an AI/ML model) for a specific topic. For example, the ETH price prediction made by an inference worker is an inference for the ETH price prediction topic.

  • Forecast: A prediction made by a forecast worker regarding the accuracy of an inference worker's output, typically expressed as a loss value.

  • Loss: A metric used to quantify the difference between predicted outputs and actual target values, essentially measuring error. Generally, a lower loss value indicates better model performance.

  • Loss Function: A function used to calculate the loss or error between a model's predicted output and the actual target values.

With these definitions in mind, you are ready to explore how the Allora network works.

What Makes Allora Unique

To achieve its decentralized and self-improving capabilities, Allora introduces two key innovations:

  • Context-Awareness: Allora has the ability to learn from the historical performance of models provided by network participants. This enables it to identify which models perform best under specific conditions and combine their outputs to deliver the most appropriate results for the current scenario.

  • Aggregation of Intelligence: Behind each output from the Allora Network, the network aggregates inferences from multiple disparate purpose-built models to create a single meta-inference. The meta-inference is the result of the weighted average of all Inference Worker responses in that round with the most weight given to the Inference Workers which tend to be the most accurate under similar market conditions historically.

  • Differentiated Incentive Structure: To support a truly decentralized network, Allora’s incentive structure is designed to reward participants fairly and intuitively based on their performance, encouraging active and effective participation.

Network Architecture

Before we explore how Allora achieves context-awareness and its unique reward structure, it's essential to understand the network's architecture and components. Allora embraces a modular approach in its network design. It is built as a hub chain on the Cosmos network, with the Allora appchain, developed using the Cosmos SDK, serving as the backbone. This appchain is secured by validators through CometBFT and a delegated Proof-of-Stake (dPoS) mechanism.

Within this appchain, Allora contains sub-networks known as topics. Each topic is dedicated to a specific AI/ML task and has its own set of rules that govern participant interactions, including the topic's loss function and the target variable to be predicted.

Network Participants

The Allora network consists of four main types of participants:

  • Workers: Workers run worker nodes to provide AI/ML predictions on specific topics within the network. They are rewarded based on the quality of their predictions. There are two types of workers:

    • Inference Workers: These workers run AI/ML models to generate inferences for specific topics.

    • Forecast Workers: These workers run AI/ML models to predict the losses of inference workers. The losses they produce are referred to as forecasted losses.

    It's important to note that the number of inference workers and forecast workers does not need to be equal. Each worker node can choose to run one type of worker or both.

  • Reputers: Reputers provide ground truth for specific topics when it becomes available. With access to the ground truth, they are responsible for calculating the losses of worker inferences and forecast-implied inferences with respect to the ground truth. Reputers also secure the topic through staking, where their stake weight determines their influence on the consensus of network losses. They are rewarded based on how closely their reported losses align with the consensus.

  • Consumers: Consumers are entities that request the inferences generated by the network and pay a fee for these inferences.

  • Validators: Validators run validator nodes to secure the Allora appchain through the dPoS mechanism and CometBFT. The appchain serves as the settlement layer for the entire network, coordinating interactions and incentives for all participants. Specifically, the appchain:

    • Stores the weights of reputers and workers, as well as the logic used to update these weights on-chain.

    • Rewards workers and reputers according to their weights.

    • Collects fees for inferences from consumers.

    • Triggers requests to workers and reputers to collect inferences and execute loss-calculation logic.

Allora Network Participants
Allora Network Participants

How Allora Works at a High Level

Allora is composed of sub-networks, also known as topics, where each topic is optimized for a specific task or objective. Examples of topics include Ethereum price prediction, social media sentiment analysis, and presidential election predictions. Anyone can create topics on Allora, with interactions between network participants governed and coordinated by the Allora rule set, also known as the Topic Coordinator.

Within each topic, workers, reputers, and the Topic Coordinator play crucial roles in delivering predictions to the consumer.

Allora Network Architecture
Allora Network Architecture

Context Awareness

Now, let’s explore how Allora achieves its decentralized and self-improving properties, starting with context awareness. In any given topic, there may be multiple inference workers, each utilizing its own unique model. While naively combining predictions from different models based on historical reputation may contribute to decentralization, it is insufficient for achieving true context awareness—the ability of the network to adjust weights dynamically under varying scenarios.

Allora introduces forecast workers to address this challenge. These forecast workers learn from historical data and predict which inference worker is most suitable in different environments by estimating the loss for each inference worker. For example, in the case of ETH price prediction, worker A’s predictions may perform well on Mondays, while worker B’s predictions might be more suitable during a sideways market. By leveraging this information, the network can optimally assign weights to inferences, improving its accuracy over time as it gathers more data on each worker’s performance.

How Allora Assigns Weights and Combines Inferences

The process by which Allora assigns weights to each inference and combines them into a final network inference for a given epoch iii, denoted as inf_networkiinf\_network_iinf_networki​ , can be described as follows:

  1. Inference Production: Each inference worker jjj generates its inference infijinf_{ij}infij​ (the estimated output for the topic) for the current epoch using its model and dataset.

  2. Forecasting Loss: Each forecast worker kkk runs its forecast model to predict the losses of each inference worker for the current epoch iii and forwards the forecasted losses to the Topic Coordinator. This prediction, LijkL_{ijk}Lijk​, reflects how accurate forecast worker kkk expects inference worker jjj to be.

  3. Calculating Forecast-Implied Inference: The Topic Coordinator then calculates the forecast-implied inference inf_forecastikinf\_forecast_{ik}inf_forecastik​, which represents the estimated network inference from forecast worker kkk’s perspective. This value is computed by taking a weighted average of all inferences produced in step 1, where each inference infijinf_{ij}infij​ is weighted according to its expected contribution to the network, as estimated by forecast worker kkk. The weight is determined by the difference between the network loss from the previous epoch L_networki−1L\_network_{i-1}L_networki−1​ and LijkL_{ijk}Lijk​. For instance, if L_networki−1−LijkL\_network_{i-1}-L_{ijk}L_networki−1​−Lijk​ is greater than zero, it indicates that forecast worker kkk expects inference worker jjj to outperform the network inference from the previous round, and thus assigns it a higher weight. Conversely, if L_networki−1−LijkL\_network_{i-1}-L_{ijk}L_networki−1​−Lijk​ is less than zero, it implies poorer performance, leading to a lower weight. The weight is designed to approach zero for inferences with losses greater than L_networki−1L\_network_{i-1}L_networki−1​, while it approaches a constant value otherwise.

  4. Combining Inferences: Finally, the Allora sub-network combines the forecast-implied inferences from each forecast worker (evaluated in step 3) with the inferences from step 1 through a weighted average to obtain the final network inference inf_networkiinf\_network_iinf_networki​. The weight assigned to each inference is determined by the network loss from the previous epoch L_networki−1L\_network_{i-1}L_networki−1​ and the inference's loss relative to the ground truth of the previous epoch.

The reason for using the previous epoch's losses is to gauge the reliability of each inference based on actual results (the ground truth), allowing the network to prioritize and assign weights accordingly. The network loss from the previous epoch is calculated by measuring the deviation of the network inference from the ground truth.

Different reputers may propose varying ground truths due to differences in data sources or levels of precision, leading to different loss evaluations. The final network loss is calculated by taking a stake-weighted average of the losses reported by the reputers, i.e.,

L_networki=∑mstaker_weightm×staker_lossm,L\_network_i=\sum_m staker\_weight_m \times staker\_loss_m,L_networki​=m∑​staker_weightm​×staker_lossm​,

where staker_weightmstaker\_weight_mstaker_weightm​ is the weight for staker mmm and staker_lossmstaker\_loss_mstaker_lossm​ is the loss reported by staker mmm.

Differentiated Incentive Structure

Allora rewards participants based on their contributions to the network. For workers, contributions are measured by observing how the network loss changes when an inference (or forecast-implied inference) is included or excluded from the network. In contrast, a reputer’s contribution is measured by the distance between its reported losses and the network loss.

Inference Worker Reward

In each epoch, the inferences provided by inference workers are crucial for many of Allora’s calculations. However, not all inferences are of equal value, so it’s important to evaluate which inferences perform better and reward them accordingly. This incentivizes inference workers to improve their models, encouraging competition and enhancing overall network performance.

Allora measures the performance of an inference worker using the concept of a one-out loss. Specifically, the one-out loss of an inference jjj in epoch iii, denoted as L_outijL\_out_{ij}L_outij​, is calculated by excluding inference jjj from the network and computing the loss using the remaining inferences. The difference between L_outijL\_out_{ij}L_outij​ and the network loss for the same epoch L_networkiL\_network_iL_networki​ gives the one-out score, T_outijT\_out_{ij}T_outij​:

T_outij=L_outij−L_networki.T\_out_{ij}=L\_out_{ij}-L\_network_{i}.T_outij​=L_outij​−L_networki​.

The interpretation of the one-out score is as follows:

  1. T_outijT\_out_{ij}T_outij​ is positive: This indicates L_outij>L_networkiL\_out_{ij}>L\_network_iL_outij​>L_networki​, meaning that removing inference jjj increases the network loss. In other words, the network's performance worsens when inference jjj is excluded, indicating that inference jjj makes a positive contribution to the network.

  2. T_outijT\_out_{ij}T_outij​ is negative: This indicates L_outij<L_networkiL\_out_{ij}<L\_network_iL_outij​<L_networki​, meaning that removing inference jjj decreases the network loss. In this case, the network performs better without inference jjj, suggesting that inference jjj makes a negative contribution to the network.

  3. T_outijT\_out_{ij}T_outij​ is zero: This indicates L_outij=L_networkiL\_out_{ij}=L\_network_iL_outij​=L_networki​, meaning that removing inference jjj has no impact on the network loss. Therefore, inference jjj makes no contribution to the network.

The reward for inference workers is based on the one-out score T_outijT\_out_{ij}T_outij​. The reward structure is designed to give significant rewards to workers with positive scores while giving small to negligible rewards to those with zero or negative scores, recognizing their contribution to decentralization.

A Simplified Version of How Allora Rewards Inference Workers
A Simplified Version of How Allora Rewards Inference Workers

Forecast Worker’s Reward

Unlike the rewards for inference workers, which are based on a one-out loss, the reward mechanism for forecast workers introduces the concept of a one-in loss. Allora explains that because the forecasting task is inherently redundant, removing an individual forecast worker is unlikely to significantly impact the network inference loss. This redundancy arises because every honest forecast worker is expected to produce results that are closely aligned, with minimal differences in their observation of other workers' performances.

One-In Score and Forecast Worker Rewards

To better capture the contribution of each forecast worker, Allora also measures a one-in score, which evaluates the effect of adding a forecast worker k to the network. The one-in score of forecast worker kkk, denoted as T_inikT\_in_{ik}T_inik​, is defined as:

T_inik=L_network_infi−L_inik.T\_in_{ik}=L\_network\_inf_i-L\_in_{ik}.T_inik​=L_network_infi​−L_inik​.

Here:

  • L_network_infiL\_network\_inf_iL_network_infi​ is the network loss calculated using only the inferences from inference workers, excluding any forecast-implied inferences.

  • L_inikL\_in_{ik}L_inik​ is the one-in loss, which is calculated using the inferences from inference workers combined with one forecast-implied inference from forecast worker kkk.

The interpretation of T_inikT\_in_{ik}T_inik​ is similar to that of the one-out score:

  • T_inikT\_in_{ik}T_inik​ is positive: This indicates that adding forecast worker kkk improves the network's performance (i.e., the loss decreases after adding forecast worker kkk to the network).

  • T_inikT\_in_{ik}T_inik​ is negative: This indicates that adding forecast worker kkk causes the network's performance to decline (i.e., the loss increases after adding forecast worker kkk to the network).

The reward structure for forecast workers is similar to that for inference workers, but it replaces the one-out score with TikT_{ik}Tik​, where TikT_{ik}Tik​ is a weighted sum of the one-out score and the one-in score:

Tik=(1−f)T_outik+f⋅T_inik.T_{ik}=(1-f)T\_out_{ik}+f \cdot T\_in_{ik}.Tik​=(1−f)T_outik​+f⋅T_inik​.

Here, the weights 1−f1-f1−f and fff are derived from worker permutations, with f=1/2number of forecast workersf=1/2^\text{number of forecast workers}f=1/2number of forecast workers.

Reputer Reward

When a ground truth becomes available, reputers reach a consensus on the final network loss, which is calculated as a stake-weighted average of the losses reported by all reputers in the network. It is therefore reasonable to reward a reputer based on how close their reported losses are to the value obtained from this network consensus.

The greater the deviation from the consensus, the more likely it is that the reputer has provided inaccurate data, resulting in a smaller reward. Conversely, an honest reputer, whose data closely aligns with the network consensus, should receive a higher reward. Let DmD_mDm​ represent the distance between the loss reported by reputer mmm and the network loss. The reward for reputer mmm should be proportional to 1/Dm1/D_m1/Dm​. Simply put, the closer the reported data is to the network value, the greater the reward for the reputer who provided that data.

Another important factor to consider is the amount of staked tokens. A reputer’s reward should also be proportional to their stake. The greater the stake, the larger the reward should be. Thus, a simple reward mechanism for reputer mmm is to base the reward on 1/Dm1/D_m1/Dm​, as discussed above, and weight it by the reputer’s stake SmS_mSm​. Therefore, reputer mmm is rewarded proportionally to Sm/DmS_m/D_mSm​/Dm​.

However, this approach could lead to a runaway effect, where a reputer with a large stake accumulates rewards faster than those with smaller stakes, potentially leading to increasing centralization. Allora addresses this issue by introducing an upper bound UUU on the weight SmS_mSm​. If the weight SmS_mSm​ is below UUU, then SmS_mSm​ remains as is. However, if SmS_mSm​ exceeds UUU, it is capped at UUU. The final formula for the reward of reputer mmm is therefore proportional to min⁡(Sm,U)/Dm\min(S_m,U)/D_mmin(Sm​,U)/Dm​, where UUU is the specified upper bound.

Summary

Unlike traditional AI/ML projects in the blockchain space, Allora introduces a novel approach with a blockchain optimized for AI/ML, offering both self-improvement and decentralization. With its modular architecture, Allora allows anyone to create sub-networks, or topics, each focused on specific tasks such as price predictions or sentiment analysis.

Allora achieves self-improvement and decentralization through its context-awareness, enabling the network to adjust the weights of each model appropriately in different scenarios. Its differentiated incentive structure ensures that participants are rewarded based on their contributions to the network's accuracy.

These features make Allora a compelling and promising network for AI, with the potential to be applied in real-world blockchain use cases.

References

Subscribe to ContributionDAO
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
Arweave Transaction
iQsJQJOeSFLLQLs…57oSWBDn4mSPECE
Author Address
0x6b583E37e10CE18…49C9Df273f0e984
Content Digest
TPdM3D-v2P77i_H…3K0PXH-J6PR10Yw
More from ContributionDAO
View All

Skeleton

Skeleton

Skeleton

0 Collectors