TLDR: TS-Insight is a visual analytics tool designed to explain and debug Thompson Sampling (TS) and its variants, which are Multi-Armed Bandit algorithms used for balancing exploration and exploitation. It provides interactive visualizations of arm beliefs, evidence accumulation, and decision-making processes, helping developers understand why an algorithm makes certain choices, verify its mechanics, and assess uncertainty, thereby fostering trust and facilitating deployment in complex decision-making scenarios.
In the world of artificial intelligence, algorithms often make decisions in ways that are not immediately clear to humans. This “black box” nature can make it difficult to trust, debug, or even understand why a particular decision was made. This is especially true for powerful algorithms like Thompson Sampling (TS), which are widely used in scenarios requiring a balance between exploring new options and exploiting known good ones, such as in A/B testing or clinical trials.
A new visual analytics tool called TS-Insight aims to demystify these complex algorithms. Developed by researchers from the University of Luxembourg and the Luxembourg Institute of Science and Technology, TS-Insight provides a clear window into the internal workings of Thompson Sampling-based systems. It’s designed specifically for model developers, helping them verify, diagnose, and explain the exploration and exploitation dynamics at play.
Thompson Sampling and its variants, like Discounted TS (DTS), are a type of Multi-Armed Bandit (MAB) algorithm. Imagine a gambler at a row of slot machines (the “arms”), each with an unknown probability of paying out. The gambler’s goal is to maximize winnings over time by figuring out which machines are best. Thompson Sampling approaches this by maintaining a “belief” about each machine’s success rate, represented as a probability distribution. Instead of just picking the machine with the highest average success, it takes a random “draw” from its belief for each machine and selects the one with the highest draw. This clever method naturally balances trying out new machines (exploration) and sticking with proven ones (exploitation).
Shedding Light on the Black Box
TS-Insight tackles the opacity of these algorithms by offering a comprehensive dashboard with multiple interactive plots for each “arm” or option the algorithm is considering. These visualizations trace the evolution of the algorithm’s beliefs, the evidence it gathers, and the outcomes of its choices over time. The tool is open-source and available on GitHub, inviting developers to explore its capabilities.
The core of TS-Insight’s visual design revolves around three key subplots for each arm.
The HDR Evolution Plot visualizes the algorithm’s belief and uncertainty about an arm’s success rate. It uses a “Highest Density Region” (HDR) to highlight the most probable range of success. When a random draw from this belief falls outside this typical region, it signals an exploratory decision, helping users understand when the algorithm is taking a chance to learn more.
The Alpha/Beta & Barcode subplot tracks the cumulative evidence (successes and failures) for each arm, which are crucial parameters in Thompson Sampling. This helps verify how the algorithm updates its beliefs and how discounting works in DTS, where older evidence becomes less important. The Barcode view provides a compact history of when an arm was chosen and whether that choice succeeded or failed, making it easy to spot patterns or shifts in the environment.
For a step-by-step explanation of why a particular arm was chosen, the XAI Snapshot View compares each arm’s “posterior mean” (its average estimated success rate) with its “posterior draw” (the random sample that led to the decision). This view clearly illustrates whether the algorithm chose an arm because it strongly believed it was the best (exploitation) or because a lucky, high random draw encouraged it to explore a less certain option.
Also Read:
- A New Framework for User-Centric Selection with Proactive Information Acquisition
- Navigating Algorithmic Fairness in Dynamic AI Systems
Key Insights and Applications
TS-Insight is designed to answer critical questions for developers: Is the algorithm behaving as expected? Why was a specific choice made? When did the algorithm make a choice outside its certainty region?
For verification, users can visually confirm how evidence updates beliefs and how discounting affects idle arms. For explanation, the XAI Snapshot view provides clear reasons for arm selection, distinguishing between exploitation and exploration. For reliability, the HDR Evolution Plot helps identify decisions made under high uncertainty, revealing potential risks or opportunities for further learning.
The tool has been used to debug DTS-based active learning in classifying scientific papers, demonstrating its practical utility. By making the internal mechanisms of Thompson Sampling transparent, TS-Insight fosters greater trust and facilitates more effective debugging and deployment of these algorithms, especially in sensitive areas where understanding decision-making is paramount.
The researchers plan future work to include online (real-time) visualization and formal user studies to quantify the tool’s impact on debugging. They also aim to evolve the design towards fully interactive Coordinated Multiple Views, making comparisons across arms even more intuitive. You can find the full research paper here: TS-Insight Research Paper.


