What If AI Models Lived Onchain? Exploring a Bold New Frontier with Arbitrum Stylus

Hey there, I agree that Arbitrum with Stylus is in a unique position to enable AI interactions in a much more complete way with respect to other EVMs but I’m not sure how much it makes sense to spend directly for someone to build what you described. Since Arbitrum already has a grants x.com for ai development would it just make more sense to add this “on chain model” as an extra bounty to the program?

I feel like even if the idea is in the right direction Arbitrum would benefit more from multiple project submissions instead of a single one under this on chain AI topic.

1 Like

“Your implementation plan is divided into four phases, which looks clear, but I have two questions:
1. In the first phase, you mentioned testing Stylus’ scalability for AI models. If performance or compatibility bottlenecks are discovered, how will the project be adjusted?
2. In the third phase, you plan to optimize the framework and support more complex models within just two months. Isn’t that timeframe too short? Do you have a contingency plan to handle potential delays?

The direction of on-chain AI is indeed cutting-edge, but given the current high demand for DeFi and gaming on-chain applications, does your choice of on-chain AI models have specific use cases to support it? For instance, what scenarios could your decision tree model be practically applied to?

Additionally, if community developers want to build upon this project, do you have any incentive plans, such as hosting hackathons or offering grant rewards?”

Additionally, is there room for budget optimization? For example, the costs for cloud computing and data collection could potentially be reduced by seeking community collaboration, such as partnering with existing Arbitrum projects to share resources and expenses.

1 Like

The following reflects the views of the Lampros DAO (formerly ‘Lampros Labs DAO’) governance team, composed of Chain_L (@Blueweb), @Euphoria, and Hirangi Pandya (@Nyx), based on our combined research, analysis, and ideation.

Thank you for putting forward this detailed proposal.

The integration of AI models on-chain using Stylus is a great approach.

The emphasis on open-source tools and developer education demonstrates a strong commitment to community building. Have you considered creating beginner-friendly templates, example projects, or a flow to lower the entry barrier for developers unfamiliar with AI or Rust?

Also, would you consider offering developer bounties or hosting competitions to encourage early adoption? We believe incentivizing innovative use cases could rapidly grow the pool of Stylus-based projects.

We’re interested in learning more about the approach planned for this study. Could you share the specific methodologies or key factors you plan to analyze during this phase? Understanding these details would help clarify how this phase will inform the project’s next steps.

1 Like

Thank you for the proposal. We find it innovative and believe that, if communicated effectively, it could bring benefits to the DAO. However, we have some observations:

  1. Timelines and budget: If you cannot meet the proposed timelines, will you request additional funding, or will you continue working with the same budget until completion? This should be clarified to ensure that approved proposals are successfully executed.

  2. Amounts in ARB: The amounts are listed in dollars, but it should be specified that they will be paid in ARB, as is standard for all proposals.

  3. Publication of results: Will the results be published on the forum? What is the estimated timeframe for publication upon completion? We suggest monthly updates to keep the community informed and a final evaluation a few months after completion to assess success.

  4. Timeline error: There seems to be an error in the timeline; voting periods start on Thursdays each week.

We appreciate your attention to these points to strengthen the proposal.

1 Like

Even if the amount is small, i request you to apply for it so we know that you have passed some basic level of vetting.

Ideally, I would be more comfortable voting for this proposal and the larger amounts if you have already got $10k from the AF and passed their basic screening. Otherwise, I find it hard to trust a team with $200k based on little prior information except a Twitter account that posts about stylus. Even if the idea is good, why are you the best one to implement it?

1 Like

Hi @0xredacted, creating useful infra for others wishing to build AI with stylus is a worthwhile pursuit.
I agree with your counter-responses that applying for the 10k grants for your endeavour’s shape and size is not appropriate.

  • Can you share more of your identity, prior work, and credentials? There is not much to go by right now.
  • Consider applying for the Gaia Net AI hackathon here: https://www.gaianet.ai/blog/gaia-first-autonomous-hackathon/ and build out something with Stylus that showcases and gives the DAO a taste of your skills and vision.

@AnaTech.eth @aj_eth consider activating Arbitrum to sponsor the above AI Hackathon.

I truly appreciate the initiative to build infrastructure for onboarding AI models on Arbitrum. However, I believe the real measure of success will be attracting developers to build and deploy AI models on this infrastructure. Achieving this would require robust marketing efforts to raise awareness and inspire developers to choose Arbitrum over other chains.

How do you propose we approach this? Additionally, how does this fit into the competitive landscape, especially considering that other L2s (example Mode Network) are significantly shifting their narrative toward AI agents?

Hi! Thank you for your insightful feedback, below is the detailed responses
Challenges Encountered:

  1. Performance Limitations:
  • Issue: The execution time for the model on the blockchain was longer than acceptable for a smooth user experience.
  • Impact: Slow execution can lead to delays in transaction confirmations and hinder real-time applications.
  • Cause: While Stylus and Rust offer performance benefits over traditional EVM execution, there are still inherent limitations in processing speed when performing complex computations onchain.
  1. Compatibility with Stylus:
  • Issue: Integrating certain Rust libraries essential for AI models presented compatibility challenges with Stylus.
  • Impact: Limited library support restricts the complexity of models that can be deployed and increases development time due to the need for workarounds or custom implementations.
  • Cause: Stylus is a relatively new platform, and not all Rust libraries are fully supported or optimized for onchain use.
  1. Contract Size Limitations:
  • Issue: The compiled smart contract containing the AI model approached or exceeded the maximum contract size limits imposed by the blockchain.
  • Impact: This restricts the ability to deploy more complex models or requires splitting logic across multiple contracts, which can increase complexity and costs.
  • Cause: AI models can add significant code size due to their parameters and logic, leading to large contract binaries.
  1. Data Storage and Management:
  • Issue: Efficiently storing and accessing model parameters and necessary data onchain was challenging due to storage costs.
  • Impact: Onchain storage is expensive and limited, making it impractical to store large datasets directly on the blockchain.
  • Cause: The blockchain’s design prioritizes security and decentralization over storage efficiency, resulting in high costs for storing large amounts of data.

How These Challenges Inform Our Proposal:

Understanding these challenges has been instrumental in shaping the objectives and methodology of our project:

  • Optimization Strategies: We plan to implement model compression techniques such as pruning and quantization to reduce model size and computational requirements, thereby lowering gas costs and execution time.
  • Hybrid Onchain-Offchain Approach: By performing resource-intensive computations offchain and using onchain contracts for verification and interaction, we can balance efficiency with decentralization. This includes exploring zero-knowledge proofs (zk-proofs) to ensure trustless verification of offchain computations.
  • Enhancing Stylus Compatibility:
    • Library Support: Contributing to the Stylus ecosystem by improving compatibility with essential Rust libraries used in AI development.
    • Tooling and Documentation: Developing tools and guidelines to help other developers navigate compatibility issues, accelerating the adoption of AI on Stylus.
  • Framework Development:
    • Modular Design: Creating a flexible framework that allows for easy updates and integration of new optimization techniques as they become available.
    • Community Collaboration: Engaging with the developer community to identify common challenges and collaboratively develop solutions.
  • Scalability Focus: By addressing performance and cost issues from the outset, we aim to create a scalable solution that can handle more complex models and larger datasets over time.

Yes, I’m aware of “The Real Open AI” project from the Bucharest hackathon, and I think it’s fantastic that they’re exploring similar use cases with Arbitrum Stylus. I’ve taken the time to look into their approach to understand how it compares to what we’re proposing. If our infra was live by then, they could have used our platform to build “The Real Open AI”.

Their Approach:

  • Tools and Models Used: From what I gathered, “The Real Open AI” team focused on deploying specific AI models like an MNIST classifier using Solidity. They aimed to demonstrate onchain inference and experimented with Stylus to improve efficiency.
  • Challenges Faced: They encountered limitations with code size and gas costs, especially when using Solidity. These constraints made it difficult to deploy more complex models or scale their solution effectively.

Our Proposal and Key Differences:

  1. Developing a Comprehensive Framework:
  • Scope: Instead of focusing on a single model or application, we’re building a general-purpose framework for deploying and interacting with AI models onchain using Arbitrum Stylus and Rust.
  • Goal: Provide tools, libraries, and documentation that make it easier for any developer to deploy a variety of AI models efficiently.
  1. Leveraging Rust and Stylus:
  • Performance Benefits: Rust offers performance advantages and compiles to WebAssembly, which is optimized for Stylus. This helps overcome the code size and efficiency limitations faced when using Solidity.
  • Compatibility: By using Rust, we can tap into a broader ecosystem of libraries and tools, enhancing functionality and developer experience.
  1. Optimization and Scalability:
  • Model Compression Techniques: We’re focusing on optimizing AI models for onchain deployment through methods like pruning and quantization to reduce size and computational requirements.
  • Handling Complexity: Our framework is designed to accommodate larger datasets and more complex models over time, aiming for scalability that goes beyond proof-of-concept.
  1. Integration of Zero-Knowledge Proofs (zk-Proofs):
  • Trustless Offchain Computation: We’re exploring the use of zk-proofs to perform heavy computations offchain while still providing verifiable results onchain.
  • Privacy and Efficiency: This approach can reduce gas costs and improve privacy, addressing some of the key challenges in onchain AI deployment.
  1. Community and Open-Source Focus:
  • Collaboration: We’re committed to building an open-source framework that the community can contribute to and benefit from.
  • Developer Support: By providing comprehensive documentation and support tools, we aim to foster a community around onchain AI development on Arbitrum.

While “The Real Open AI” project and our proposal share the common goal of bringing AI models onchain using Arbitrum Stylus, our approaches differ in scale and methodology. Their project demonstrated the feasibility and highlighted some challenges, primarily focusing on a specific use case with Solidity.

Our proposal builds on these insights but aims to create a more robust and scalable solution by developing a comprehensive framework using Rust and Stylus. We believe this will address the limitations they encountered and open up broader possibilities for AI applications on Arbitrum.

Our plan is to initially focus on research and feasibility during the early phases of the project. This means we’ll explore how zk-Proofs can enhance verifiable and privacy-preserving AI inference, assess their practicality, and determine the best way to integrate them.

By approaching it as an initial research stage, we can carefully evaluate the benefits and challenges without overextending our resources. Based on our findings, we’ll decide whether to proceed with a full implementation in later phases or adjust our strategy accordingly. This approach helps us manage complexity and costs while remaining flexible to incorporate zk-Proofs effectively if they prove feasible within our project’s scope.

1 Like

Yes, absolutely! We plan to engage in developer partnerships and host hackathons, especially after completing the first iteration of our initiative. Right now, our main focus is on bringing the framework to reality. Once it’s established, we’ll actively encourage developers to build applications leveraging the infrastructure we’ve created. Community engagement is entirely in our plan, and we’re excited to foster innovation within the Arbitrum ecosystem.

1 Like

Great question! We definitely plan to measure success with specific metrics. Besides releasing the open-source tools and libraries, we’ll be tracking:

  • Number of Active Developers: Aim for at least 150 developers actively using the framework within 2 months of release.
  • Projects Built on the Framework: Target at least 10 new projects or dApps leveraging our infrastructure in the same timeframe.
  • Community Engagement: Monitor participation in workshops, hackathons, and contributions to the project.
  • GitHub Metrics: Keep an eye on stars, forks, and issues raised to gauge interest and collaboration.
1 Like

Hey @0x_ultra , thanks for bringing this up! I really appreciate your perspective and completely agree that Arbitrum would benefit from a diverse range of projects exploring on-chain AI.

The idea behind our proposal is actually to enable exactly that. By building a foundational framework and providing the necessary tools, we’re aiming to lower the barriers for many developers to create their own AI-powered applications on Arbitrum. Instead of focusing on a single model or project, we’re working to create infrastructure that everyone can use, which we believe will stimulate more innovation and a variety of projects in the ecosystem.

I see our efforts as complementary to the existing grants program. By establishing this groundwork, we can enhance the effectiveness of bounties and grants by providing developers with the resources they need to build more sophisticated and efficient on-chain AI solutions.

I’m excited about the potential for collaboration here. Maybe we can integrate our framework with the grants program to encourage more submissions and make it easier for developers to participate. I’d love to hear any ideas you have on how we can maximize the benefits for the community and work together to drive innovation in this space.

Thanks again for your input! Let’s keep the conversation going.

Thanks for bringing up these important questions!

  1. If we find bottlenecks in Phase 1:

If we run into performance or compatibility issues, we’ll adapt our approach. This might mean optimizing our models, tweaking the code, or exploring alternative solutions to overcome the challenges. Our goal is to ensure the project remains valuable and feasible, so we’re prepared to adjust as needed.

  1. Regarding the tight timeframe in Phase 3:

You’re right; two months is ambitious for optimizing complex models. We have contingency plans in place. If we need more time to maintain quality, we’ll adjust the schedule. Our priority is to deliver a robust framework, even if it means extending the timeline a bit. We also have buffer times included in our time frame.

Really appreciate your insights! We’re committed to making this project a success.

1 Like

Great question! Absolutely, our on-chain AI models have specific use cases in both DeFi and gaming.

In DeFi, a decision tree model can be used for on-chain credit scoring. For example, it can analyze a user’s transaction history, asset holdings, and interaction patterns to assess creditworthiness. This allows decentralized lending platforms to make smarter lending decisions without relying on off-chain data, enhancing trust and efficiency in lending protocols.

In gaming, decision trees can drive dynamic in-game events or NPC behaviors. For instance, in a blockchain-based game, the model could determine outcomes based on player choices, such as unlocking special quests or adapting enemy strategies. This adds a layer of complexity and personalization that enhances the gaming experience.

By deploying these models on-chain, we ensure transparency and trust in the decision-making process, which is crucial for decentralized applications.

Absolutely! We plan to actively encourage and support community developers who want to build on our project. Hosting hackathons is definitely on our agenda to foster innovation and collaboration. We’re also looking into collaborating with grants teams in the ecosystem or offering rewards for standout projects that utilize our framework. Our aim is to create a vibrant ecosystem around on-chain AI, and empowering developers is a big part of that. We’re excited to see the amazing things the community will create!

1 Like

That’s a great point! While we hadn’t initially thought about optimizing the budget through community collaborations, we’re definitely open to it. We’d love to connect with others in the Arbitrum ecosystem who can help share resources like cloud computing and data collection. If we can establish these partnerships, we can certainly reduce costs. If you can help with this or know anyone who might be interested, we’d really appreciate it!

Hello, thanks for your great input on the proposal.

Absolutely! We totally get that not everyone is familiar with AI or Rust. We’re planning to create beginner-friendly templates and example projects to help developers get started quickly. Our goal is to lower the entry barrier and make it easy for anyone to dive in, even if they’re new to these technologies. We’ll provide step-by-step guides and resources to support developers of all skill levels.

Great idea! Yes, we’re definitely considering offering developer bounties and hosting competitions to encourage early adoption. Considering partnering with the multiple grants teams in the ecosystem. We believe that incentivizing innovative use cases is a fantastic way to rapidly grow the pool of Stylus-based projects. We’re excited to support and collaborate with developers who are pushing the boundaries of what’s possible.

Absolutely! below is our approach for the scalability study of Stylus for AI models.

Methodology:

  1. Deploying Various AI Models:
  • We’ll start by implementing a range of AI models, from simple ones to more complex.
  • Each model will be deployed using Rust on Stylus to evaluate how they perform on-chain.
  1. Performance Benchmarking:
  • Gas Consumption: Measure the gas costs associated with deploying and running these models.
  • Execution Time: Analyze how quickly models can process inputs and produce outputs on-chain.
  1. Scalability Testing:
  • Gradually increase the complexity and size of the models to see how Stylus handles larger workloads.
  • Test how the system performs with multiple simultaneous requests to simulate real-world usage.
  1. Resource Utilization Analysis:
  • Assess memory and storage requirements for different models.
  • Identify any limitations or bottlenecks in the Stylus environment when running AI computations.
  1. Optimization Exploration:
  • Experiment with model compression techniques like pruning and quantization to reduce resource demands.
  • Optimize Rust code for better performance on Stylus.
  1. Compatibility Checks:
  • Ensure that necessary AI libraries and dependencies work smoothly with Stylus.
  • Identify any compatibility issues and find workarounds or solutions.

Key Factors We’ll Analyze:

  • Gas Costs vs. Model Complexity: Understanding how costs scale with more complex models.
  • Performance Limits: Identifying the maximum feasible model size for practical on-chain deployment.
  • Resource Constraints: Evaluating memory and storage limitations within Stylus.
  • Usability: Assessing the ease of deploying and interacting with AI models from a developer’s perspective.

How This Phase Informs Next Steps:

  • Feasibility Assessment: The results will tell us which types of AI models are practical to run on-chain.
  • Optimization Focus: We’ll know where to concentrate our efforts to improve performance and reduce costs.
  • Strategic Planning: Based on the findings, we’ll adjust our roadmap to ensure we’re focusing on the most impactful areas.
  • Community Guidance: The insights gained will help us create better documentation and support for other developers interested in on-chain AI.