> For the complete documentation index, see [llms.txt](https://8bit-1.gitbook.io/blockchain-and-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://8bit-1.gitbook.io/blockchain-and-ai/a-brave-new-world.md).

# A Brave New World

## Consensus Learning: Harnessing Blockchain for Better AI

### Introduction

Flare research's latest paper introduces a groundbreaking approach to artificial intelligence (AI), where the combination of AI with blockchain technology leads to safer and more accurate AI systems. This approach, known as consensus learning (CL), enables collaborative AI across a variety of applications, particularly in data-sensitive sectors such as healthcare and finance. By leveraging blockchain, CL enhances decision-making processes, operational efficiency, and service cost-effectiveness. Unlike traditional implementations that provide centralized machine learning (ML) through blockchain, CL creates decentralized AI models, offering numerous benefits.

### Motivations

#### The Need for Decentralization

The shift towards distributed environments, prompted by the demands of modern foundation models such as large language models and computer vision models, highlights the importance of decentralization. Centralized methods, while common, present several risks:

* **Single Point of Failure:** Relying on a single trusted party increases vulnerability to attacks and system failures.
* **Data Privacy and Security:** Centralized systems raise significant concerns regarding data privacy and security.
* **Limited Flexibility:** Centralized approaches often lack the flexibility required for personalized local models.

In contrast, decentralized methods allow users to develop personalized models tailored to specific requirements and preferences. Consensus learning emerges as a robust decentralized ML solution, offering enhanced resilience, privacy, and adaptability while mitigating centralization risks.

### Benefits of Consensus Learning

#### Increased Performance

CL methods leverage the data from each ensemble contributor, reducing bias and enhancing the models' ability to generalize on unseen data. By incentivizing collaboration through blockchain, CL leads to more accurate AI by combining diverse insights from various models. This is achieved via multiple local aggregations, where each participant assesses and integrates predictions from neighboring models.

#### Security

Consensus mechanisms ensure the integrity of CL models, protecting against malicious actors. This built-in security prevents AI systems from generating harmful predictions or inaccuracies, addressing a major concern within the AI community. By maintaining the integrity of the collaborative learning process, CL fosters trust and confidence in AI systems, promoting their responsible and ethical deployment.

#### Data Privacy

In CL, data and individual models are never shared, ensuring that data remains stored locally and confidential. This preservation of privacy encourages collaboration while maintaining competitiveness. CL enables data monetization through AI, particularly for sensitive or commercial data such as healthcare, overcoming challenges faced in centralized environments.

#### Full Decentralization

Data and computational resources are distributed across a network of participants, eliminating reliance on a central server. This decentralized approach is crucial for modern ML applications, which demand vast resources and complex models. Decentralized ML solutions preserve data privacy and ensure security.

#### Efficiency

The CL process is characterized by low latency, requiring less computation time, energy, and resources compared to other decentralized ML methods. This efficiency makes CL particularly suitable for real-time applications, where quick decision-making and efficient resource utilization are essential.

### How Consensus Learning Works

#### Individual Learning Phase

Each network participant develops their own model based on their private data and other publicly available data. Participants never share sensitive information about their data or models. After training, participants prepare initial predictions for a testing dataset, which can be disclosed through a smart contract or proposed through a Proof-of-Stake mechanism.

#### Communication Phase

Participants transmit their initial predictions within the network according to a consensus/gossip protocol. During exchanges, participants update their predictions based on assessments from other network participants and their confidence in their own predictions. The quality of received predictions is monitored to improve decision-making. Ultimately, participants reach a consensus on the optimal decision based on available information. This phase repeats for any new data inputs.

**Visual Example**

**Figure caption:**\
(a) In the first stage, participants develop their own models using their data and possibly other shared data. Initial predictions are made for the testing dataset.\
(b) In the communication phase, participants exchange and update predictions, eventually reaching consensus on a single output. This phase repeats for new data inputs.

#### Adaptation to Different ML Scenarios

While the described algorithm applies to supervised ML scenarios, CL can also adapt to self-supervised or unsupervised ML problems. In these cases, participants only have access to partly or completely unlabeled data, requiring different techniques during the individual learning phase. However, the communication phase remains similar.

### How Consensus Learning Sets Itself Apart

CL efficiently combines knowledge from multiple sources without sharing sensitive information or intellectual property. This approach protects confidential information and ensures resilience against malicious entities. CL builds on the successful ensemble learning paradigm, leveraging the collective knowledge of a crowd to surpass individual capabilities.

Several blockchain implementations of AI services exist, such as Bittensor, FLock.io, and Ritual. However, CL distinguishes itself through its unique aggregation method, using a secure gossip protocol to reach consensus on predictions. This decentralized approach enables more accurate and secure AI through collaboration while maintaining data confidentiality.

### Conclusion

Consensus learning presents a groundbreaking opportunity to implement machine learning directly on decentralized ledgers like blockchains. This novel approach improves existing AI tools, fostering innovation and secure collaboration in data-sensitive sectors such as healthcare. The resilience of CL methods against malicious factors enhances trust in AI systems, fortifying their reliability and integrity.
