A robust, cost-effective approach
April 24th, 2025

Untangled’s lean, open-source-driven simulation approach can help democratize access to this critical DeFi risk management tooling.

The DeFi Risk Management Landscape

Decentralized Finance (DeFi) has evolved into an intricate web of 4,500 protocols, 16,000 assets on 100 blockchains. Unlike traditional finance, DeFi operates without centralized intermediaries, relying instead on smart contracts, economic incentives, and automated mechanisms to manage risks. Protocols must continuously assess risk parameters, monitor liquidity, predict user behavior, and guard against systemic threats— in a permissionless, fast-moving environment.

As DeFi scales, simple risk analysis tools are not adequate. The dynamic interplay of thousands of users, volatile markets, and composable protocols demands a more sophisticated approach. Agent-based modeling (ABM), a method that simulates individual actors and their interactions to reveal system-wide risks is being adopted by the a number of protocols. While ABM is powerful, its complexity and cost have limited its adoption beyond the largest of protocols.

Beyond DeFi, ABM has a wide adoption from self-driving cars to macro economic agent simulation for policy purposes. During the COVID-19 pandemic, these simulations - modeling the spread of the virus - informed critical policy decisions such as social distancing and vaccination strategies.

Why Agent-Based Modeling Is Needed

At a high level, agent-based simulation:

  • Codifies the rules that market participants must follow: This step establishes the environment in which agents operate, defining the constraints, opportunities, and mechanisms that govern their actions. For example, in a market simulation, this could include trading rules, information flows, and transaction costs that shape how participants behave.

  • Defines the profit functions that different types of users (agents) have: Each type of agent—whether a trader, investor, or market maker—has its own objectives, typically centered around maximizing profit or utility. These profit functions act as the guiding principles for the agents’ decision-making processes, reflecting their unique goals and strategies.

  • Simulates combinations of agents interacting with each other, under the assumption that they are profit-maximizing: By running simulations where agents follow their defined rules and pursue their profit-driven objectives, we can observe how their individual actions lead to complex, system-level outcomes. This is particularly valuable for capturing emergent phenomena—such as price bubbles or market crashes—that arise from the interactions of profit-seeking agents.

Traditional risk models, such as statistical regressions or one-off stress tests, struggle to capture DeFi’s nuances. They often overlook feedback loops—like how a liquidation in one protocol affects liquidity elsewhere—or assume user behaviors are uniform. In reality, DeFi is driven by diverse agents (e.g., borrowers, lenders, liquidators in a lending protocol) making real-time decisions based on profit motives and shifting conditions.

ABM fills this gap by simulating these agents individually, modeling their choices and tracking how their actions ripple through the system. This approach could also identify edge cases, estimating rare but severe tail risks, and understanding phenomena like cascading liquidations.

The Cost Challenge

Agent-based simulation is a powerful tooling in understanding complex systems by modeling the behavior of individual agents and their interactions:

  • Behavioral Realism: It mirrors how real users act, not just statistical averages.

  • Dynamic Interactions: It captures evolving relationships between users, liquidity, and prices over time.

  • Emergent Outcomes: It reveals hidden risks that arise from many small, rational decisions piling up.

  • Composability: It can simulate cross-protocol effects, vital in DeFi’s interconnected world.

Despite its benefits, ABM isn’t cheap or easy to implement. The barriers include:

  • Computational Power: Simulating thousands of agents across countless scenarios requires serious system infrastructure.

  • Expertise: Building and validating these models demands niche skills, from coding to economic analysis, which smaller teams often lack.

  • Data and Tools: Robust ABM needs rich historical data and advanced platforms, resources out of reach for many.

ABM relies on running millions of simulations to produce reliable results. This stems from the need to account for the complex behaviors of numerous agents and the dynamic nature of systems like DeFi. Top protocols spend millions annually on risk management services that include advanced tools like ABM. These costs are often prohibitive for smaller DeFi projects, potentially exposing them to greater vulnerabilities.

Untangled’s Pragmatic Approach to ABM

Untangled ABM Simulation Approach
Untangled ABM Simulation Approach

We introduce a high-fidelity ABM engine that slashes costs without sacrificing much insight. The approach is based on:

  • Open-Source toolings: We build on tools like Simtopia VERBS, a flexible framework for mimicking smart contract logic, avoiding the expense of proprietary systems.

  • Smart Heuristics: Instead of simulating every possible scenario, Untangled focuses on high-impact cases—like significant price drops triggering liquidations—reducing computational demands.

This balance of accuracy and efficiency makes ABM viable for smaller DeFi protocols. More on Untangled ABM approach in our ABM whitepaper here.

Simulating Protocol Losses in Aave

We put this approach to work on Aave V3, assessing its Value at Risk (VaR) from borrower defaults. The simulation included:

  • Realistic price movements via a Multivariate GARCH model.

  • Liquidator actions, factoring in transaction costs and DEX slippage.

  • Protocol reactions to unliquidated debt during extreme volatility.

Key Findings:

  • Fast-acting liquidators are vital—delays lead to bad debt piling up.

  • Under mild stress, most positions liquidate smoothly, but extreme conditions expose vulnerabilities.

  • The “health factor” (a measure of collateral safety) heavily influences risk levels.

These insights could help Aave’s governance to tweak settings like Loan-to-Value (LTV), Liquidation Threshold (LT), and Liquidation Bonus (LB) for better stability.

For detailed findings read Aave V3 VaR simulation whitepaper here.

Conclusion

Agent-based modeling is an essential tooling of DeFi risk management, offering a window into the complex interplay of users and markets. However, its resource-intensive nature has kept its application within the small circle of DeFi OGs. Untangled’s lean, open-source-driven simulation approach can help democratize access to this tool for the wider DeFi ecosystem.

This ABM approach is part of the Untangled Embedded Yield Layer.

Subscribe to Untangled
Receive the latest updates directly to your inbox.
Nft graphic
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.
More from Untangled

Skeleton

Skeleton

Skeleton