← back

Layer N x Modulus—Enabling On-chain AI with AI Functions

March 27th, 2024 by Layer N

Intro to StateNet

Layer N is announcing a partnership with Modulus Labs (opens in a new tab) to enable AI Functions: a native and seamless way for developers on Layer N to integrate AI inference and AI use cases within their applications. Layer N aims to be one of the first Ethereum L2s to enable applications with real on-chain AI use cases through this partnership, with some teams on Layer N already working on integrating AI Functions.

Layer N’s mission is to expand what’s possible to build on-chain. By working with Modulus Labs who is at the forefront of building ZKML methods to prove AI computations on-chain, Layer N will empower rollups in its network to access AI inference on demand. This means that developers can deploy their own AI models on Layer N, configure inputs and outputs, and seamlessly integrate AI into their on-chain applications.

AI Functions will unlock numerous novel use cases and enhance many existing applications. For example:

  • Replacing AMMs with more sophisticated models: Automated market making (AMM) models are generally the go-to solution for liquidity provisioning on-chain. However, these models are incredibly inefficient. Developers can now deploy more sophisticated models supplemented by AI on Layer N to improve liquidity provisioning in DeFi protocols, potentially mitigating issues such as impermanent loss and enhancing overall liquidity.

  • Yield Optimization Strategies: AI Functions enable the deployment of advanced yield optimization strategies. By analyzing market data and user behavior, developers can create AI-driven algorithms to maximize yield for users participating in various DeFi protocols.

  • Gaming and AI Crypto Agents: Beyond DeFi, AI Functions unlock new possibilities in gaming and the creation of independent AI crypto agents. Imagine decentralized games where AI-driven characters interact with players in real-time, or autonomous agents trading cryptocurrencies based on market signals.

  • AI Arbitration: In addition to crypto-economic and consensus-based security, protocols can add an additional layer of security and arbitration, one that is driven by AI-processed outcomes. Imagine a prediction market that includes AI-based arbitration of event outcomes, reducing the risk of consensus collusion or centralized outcome results.

Intro to StateNet

To make this work, the high-level architecture is as follows: any rollup in the Layer N ecosystem can deploy an AI model, allowing it to process inputs and receive outputs. Rollups can theoretically reuse the same model if necessary. The rollup and AI function module are considered separate modular pieces. This separation enables individual proofing without having to validate the entire system together.

By partnering with Modulus and utilizing their quantized model, Layer N can validate the correct execution of AI inference on-chain using zero-knowledge fraud proofs. Layer N originally published the idea of ZKFPs in May 2023, which enables the network to only need to submit validity proofs when fraud occurs, as opposed to at every single transaction. This means that applications can run inference without worrying about accruing unnecessary proving costs. Thanks to the efficiency of Modulus’ prover, the proofs can also be generated more efficiently, and much faster.

Overall, the introduction of AI Functions marks a significant milestone in making AI-driven applications more accessible to on-chain developers. By seamlessly integrating AI capabilities into Layer N, Layer N aims to empower developers to explore new frontiers in on-chain applications.

Teams are already working on integration ideas with the AI Functions. Stay tuned for more updates, and make sure to reach out if you're interested in building on top of Layer N.