Reinforcement Learning for Execution under Dynamic Fees in a Closed-Loop DEX Simulator
This paper introduces a closed-loop DEX simulator to demonstrate that a small Deep Q-Network (DQN) agent significantly reduces implementation shortfall compared to tuned benchmarks specifically in dynamic-fee environments, providing model-conditioned counterfactual evidence for execution control in automated market makers.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a trader trying to sell a huge pile of digital cookies on a decentralized exchange (a DEX). In the old days, the "fee" to sell your cookies was a flat rate, like a fixed price tag on a candy bar. But recently, these exchanges have started using dynamic fees. Think of this like a surge-pricing algorithm for a taxi: if the road gets crowded or the weather gets bad, the price to ride goes up instantly.
The big question researchers wanted to answer was: Can a smart computer agent learn to navigate these changing fees better than a human following a simple rule?
The Problem: The "Ghost" in the Machine
Usually, scientists study trading by looking at old records (historical data). But there's a catch: in the past, fees didn't change much, and we don't know exactly why traders made the choices they did. It's like trying to learn how to play chess by watching a movie where the pieces never move. You can't learn how the game responds to your moves if the game never actually changes its mind based on what you do.
To fix this, the authors built a video game simulator. It's a "closed-loop" world where:
- You (the agent) try to sell your cookies.
- The Market reacts to your sale, changing the price and the fee.
- Other Players (noise traders and arbitrageurs) also move around, reacting to the market.
Crucially, in this game, the fee rule is designed to be "smart." It changes based on the state of the market, just like a real dynamic fee system would. This allows the computer agent to actually learn how the market fights back.
The Contest: The Ladder of Strategies
The authors didn't just pit their AI against a random guesser. They built a "ladder" of opponents, each smarter than the last:
- The Schedule: Just selling cookies at a steady pace, like a robot following a timer.
- The One-Step Lookahead: A smart human who looks at the next second, calculates the best move, and then stops thinking.
- The Planners: Agents that try to simulate a few steps into the future to see what happens.
- The DQN (Deep Q-Network): The "hero" of the story. This is a small, model-free AI that learns by trial and error, trying to figure out the long-term best strategy without being told the rules of the universe.
The Big Reveal
The authors ran the simulation 1,000 times with different random market scenarios (seeds) to see who won.
The Result: The small DQN AI beat the smart "one-step lookahead" human.
- How much better? It saved about 13.3 basis points (a tiny fraction of a percent, but huge in trading) on the cost of the trade.
- Where did the win come from? The AI learned to time its trades perfectly to hit "low fee" windows. It waited for the market to calm down and the fees to drop before selling.
- The Catch: This advantage only existed in the dynamic-fee environment. When the researchers turned off the dynamic fees and made them constant (flat), the AI and the simple human performed exactly the same. The AI didn't just get lucky; it specifically learned to exploit the changing fees.
What the AI Did (and Didn't Do)
The AI didn't become a magic money printer. It didn't predict the future, and it didn't find a "perfect" solution.
- It didn't beat the "Planners" in a clear way: Surprisingly, the agents that tried to plan 2 or 3 steps ahead did not perform significantly better or worse than the simple one-step human. The market was too noisy for them to see clearly, so they ended up statistically tied with the baseline. The DQN was the only learner that managed to beat the baseline with statistical certainty.
- It didn't work in a vacuum: If the AI was trained to act before the market moved, it did great. But if the researchers forced it to act after the market moved (a different "ordering"), its performance dropped. However, if they retrained the AI for that specific new rule, it bounced back and won again. This proves the AI was learning the specific rhythm of the game, not just memorizing a trick.
What This Paper is NOT Saying
It is very important to know what this paper rules out:
- It is not a history lesson: The results are based entirely on a simulation. The authors explicitly state this is not evidence about how real traders behaved in the past.
- It is not a profit guarantee: The paper does not claim that deploying this AI on a real exchange will make you rich. It's a proof of concept about control, not a business plan.
- It is not a "solved" problem: The AI didn't find the absolute best possible strategy (the "hindsight" perfect strategy was still better than the AI). The AI just found a way to be better than the standard smart rules we use today.
The Bottom Line
In this specific, simulated world, a small, learning AI can learn to dance with dynamic fees better than a smart human following a simple rule. It learned to wait for the right moment when fees were low, saving about 13.3 basis points on the trade. But this skill is specific to markets where fees change; if the fees are flat, the AI is just as good as the simple rules we already have.
The paper suggests that in the complex, shifting world of decentralized finance, learning to adapt might be the only way to stay ahead of the fees.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.