← Latest papers
💻 computer science

MIRAGE: Online LLM Simulation for Microservice Dependency Testing

MIRAGE introduces an online LLM-based simulation approach that dynamically generates microservice dependency responses at runtime by analyzing source code and traces, achieving near-perfect fidelity in status codes and response shapes while outperforming traditional static methods in complex, stateful testing scenarios.

Original authors: XinRan Zhang

Published 2026-04-08
📖 5 min read🧠 Deep dive

Original authors: XinRan Zhang

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 chef trying to perfect a new recipe for a complex dish, like a multi-layered lasagna. To test your recipe, you need to know exactly how the ingredients from your neighbor's garden (the microservices) will react. But your neighbor is away, or their garden is too expensive to visit every time you want to cook.

Traditionally, chefs would try to solve this by recording what the neighbor did last time they visited. They'd write down: "If I ask for tomatoes, they give me 3 red ones." This is called Record-Replay.

The Problem: Life is messy. What if you ask for tomatoes on a Tuesday instead of a Monday? What if you ask for 5 tomatoes instead of 3? What if the neighbor's garden is currently out of stock? The old "recorded" notes don't work because they are static. They can't handle new situations, leading to failed dishes (broken software tests).

Enter MIRAGE: The "Acting" Chef

The paper introduces MIRAGE, a new way to test software. Instead of writing down static notes, MIRAGE uses a super-smart AI (an LLM) to act as the neighbor's garden in real-time.

Here is how it works, using simple analogies:

1. The "Live Actor" vs. The "Scripted Robot"

  • Old Way (Record-Replay): Imagine a robot that only knows a script. If you ask for "tomatoes," it gives you "3 red tomatoes" because that's what it saw once. If you ask for "tomatoes" in a weird way, the robot freezes or gives you the wrong thing.
  • MIRAGE (Online LLM Simulation): Imagine a brilliant method actor. You don't give them a script. Instead, you show them the neighbor's blueprints (source code) and a diary of past visits (traces). When you ask, "Can I have 5 tomatoes?" the actor thinks, "Hmm, looking at the blueprints, we have plenty. But wait, the diary says we ran out last Tuesday. Let me check the current stock." Then, they give you the correct answer right then and there.

2. The "Memory" Trick

The biggest challenge in software testing is state.

  • Scenario: You buy a ticket (Request 1). Then you try to buy a second ticket for the same seat (Request 2).
  • Old Way: The robot forgets you bought the first ticket. It lets you buy the second one, causing a crash.
  • MIRAGE: The AI actor has a memory. It remembers, "Oh, I just sold that seat to you in the last message." It keeps track of the whole conversation, ensuring the simulation feels real and consistent.

3. The Three "Modes" of Operation

The paper tested MIRAGE in three different "costumes":

  • White-Box Mode (The Insider): The AI gets the source code (the secret recipe) of the neighbor's garden. It knows exactly how the garden works. Result: It was perfect (99% accuracy). It was like having the neighbor's head gardener on the phone.
  • Black-Box Mode (The Outsider): The AI doesn't have the source code (maybe the garden belongs to a different company). It only has the diary of past visits (traces) and the caller's notes. Result: It was still very good at guessing the right outcome (94% accuracy), though it sometimes guessed the wrong shape of the answer (like giving you a basket instead of a bag).
  • The "Scripted" Alternative: The researchers tried making the AI write a strict rulebook (Intermediate Representation) first. Result: This failed on complex tasks. It's like trying to write a rulebook for a chaotic jazz concert; the rules are too rigid, and the AI gets confused. Letting the AI "improvise" (online simulation) worked much better.

Why Does This Matter?

  1. It's Cheaper and Faster: Setting up a real "neighbor's garden" (a real database and server) for testing takes hours and costs money. MIRAGE runs in the cloud, costs pennies per test, and needs no heavy equipment.
  2. It Handles the Unexpected: Because the AI understands the logic (the code) rather than just memorizing history (the logs), it can handle questions it has never seen before.
  3. It's Reliable: In the tests, when the real software would fail, MIRAGE failed too. When the real software worked, MIRAGE worked. It mimics the "pass/fail" decision of the real world perfectly.

The Bottom Line

Think of MIRAGE as hiring a method actor to play the role of your software's dependencies during testing. Instead of forcing them to read a rigid script (which breaks when the plot changes), you give them the character's backstory and let them improvise.

The result? You get a simulation so realistic that your software tests pass and fail exactly as they would in the real world, but without the cost and hassle of setting up the real world every time. It turns software testing from a game of "matching static cards" into a dynamic, intelligent conversation.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →