project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5

Vanna Engine

Vanna Engine is the first on-chain ML-driven risk engine that aims to provide dynamic risk metrics for risk management in cross-chain DeFi.

Vanna Engine

Created At

ETHOnline 2023

Winner of

trophy

🥈 Hyperlane — 2nd Best Interchain App

Project Description

Problem Statement: Unlike TradFi, Risk management is almost non-existent in DeFi nowadays. Without risk management, many DeFi protocols are unable to properly measure, gauge, and evaluate risk in lending, borrowing, trading, and staking. For example, liquidity providers in AMMs bleed money through impermanent loss due to token volatility. Lending protocols accumulate bad debt as a result of cascading liquidations from volatile price movements. Token prices can sometimes plummet to 0 which can be a systemic risk in DeFi. This is a problem not unique to any chain, and is pervasive across a wide variety of DeFi protocols on many chains.

Solution: We built Vanna Risk Engine, a machine-learning model driven risk engine that aims to provide risk metric data that can be used by DeFi protocols across many different chains. Vanna Engine uses an ensemble of machine learning models to compute a risk metric for tokens that can be used to gauge the current risk associated with the price movements of the token. Namely, we use a clustering model that classifies tokens by their realized volatility in a couple key time lags, and use the classification and the token’s realized volatility to compute the final risk metric which represents the absolute value of the of the token’s price movement in the next 25 minutes measured in standard deviations of the token’s return distribution.

We also want to make the Vanna Engine an interchain dApp. In order to do that, we make the risk metric data computed by the Vanna Risk Engine available to multiple chains, by deploying cross-chain smart contracts, relayers, and validators that enable cross-chain queries to allow contracts on other-chains to query the view functions of the smart contracts. This exposes the risk metrics to those contracts, which will enable use-cases like: lending protocols on other chains adjusting LTV ratios using our risk metrics, or AMMs adjusting their fee levels using our risk metrics, or vaults adjusting idiosyncratic token exposure using our risk metrics. In order for the Vanna Risk engine to maintain computational verifiability in an interchain context, we host our models on an IPFS cluster and also compute zkML proofs that we store on IPFS.

How it's Made

Problem Statement: Unlike TradFi, Risk management is almost non-existent in DeFi nowadays. Without risk management, many DeFi protocols are unable to properly measure, gauge, and evaluate risk in lending, borrowing, trading, and staking. For example, liquidity providers in AMMs bleed money through impermanent loss due to token volatility. Lending protocols accumulate bad debt as a result of cascading liquidations from volatile price movements. Token prices can sometimes plummet to 0 which can be a systemic risk in DeFi. This is a problem not unique to any chain, and is pervasive across a wide variety of DeFi protocols on many chains.

Solution: We built Vanna Engine, a machine-learning model driven risk engine that aims to provide risk metric data that can be used by DeFi protocols across many different chains. Vanna Engine uses an ensemble of machine learning models to compute a risk metric for tokens that can be used to gauge the current risk associated with the price movements of the token. Namely, we use a clustering model that classifies tokens by their realized volatility in a couple key time lags, and use the classification and the token’s realized volatility to compute the final risk metric which represents the absolute value of the of the token’s price movement in the next 25 minutes measured in standard deviations of the token’s return distribution.

We also want to make the Vanna Engine an interchain dApp. In order to do that, we make the risk metric data computed by the Vanna Risk Engine available to multiple chains, by deploying cross-chain smart contracts, relayers, and validators that enable cross-chain queries to allow contracts on other-chains to query the view functions of the smart contracts. This exposes the risk metrics to those contracts, which will enable use-cases like: lending protocols on other chains adjusting LTV ratios using our risk metrics, or AMMs adjusting their fee levels using our risk metrics, or vaults adjusting idiosyncratic token exposure using our risk metrics. In order for the Vanna Risk engine to maintain computational verifiability in an interchain context, we host our models on an IPFS cluster and also compute zkML proofs that we store on IPFS.

How we built it There are a couple key technologies we leveraged to build the Vanna Risk Engine. Hyperlane - We utilize Hyperlane and Kurtosis to deploy cross-chain smart contracts, as well as bespoke Hyperlane relayers and validators that facilitate the delivering and securing of the messages to the mailboxes of each chain, that allow for efficient interchain messaging. Specifically, we’ve deployed for Vanna <> BSCTestnet, ArbitrumGoerli, and OptimismGoerli to start. This allows the contracts on the other chains to query the view functions of our smart contracts on the Vanna Blockchain. This is particularly powerful because it allows other blockchains to take advantage of the native on-chain inference that the Vanna blockchain offers; the permissionless feature of Hyperlane also allows these features to be enabled on new, custom chains like Vanna. IPFS - We utilize IPFS (private IPFS cluster via swarm key) to host the machine learning models in order to transparency, as anyone can go and verify the models we’re using. We also compute zkML proofs from inference of the regression model that generates the risk metrics and store them on IPFS in order to guarantee computational verifiability. This is an extensive and permissionless framework, as we make our swarm key public and anyone can upload machine learning models to the cluster and run inference; if we want to update our models in the future, we can simply upload new models and pass the new IPFS CID into the inference call in our smart contracts. The Graph - We utilize the graph to query on-chain price data for tokens to compute the rolling standard deviation (volatility) that we use to power the inference for the models. Specifically, we utilize the Uniswap V3 substream to get accurate token historical price data. Vanna Blockchain ML - The Vanna Risk Engine is powered by the Vanna blockchain, a blockchain that is able to run native on-chain AI/ML inference. The first model is an sklearn K-means clustering classification model that clusters tokens based on realized volatility of a couple time lags(25mins, 3hrs, 12hrs). Based on the clustering model classification result we then train three different regression models that aim to predict leading volatility, i.e.the absolute value of the token price movement in the next 25 minutes measured in standard deviations of the token’s average return distribution as a factor of price. When predicting the volatility of a token, we first run the classification model, then run the volatility regression model accordingly.

background image mobile

Join the mailing list

Get the latest news and updates