Deep parallel cooperative multi-agent reinforcement learning (CMARL)} trains multiple agents that all act at every time step to optimize a common objective. Like single-agent RL, CMARL can produce unsafe behaviors that violate implicit safety requirements not captured by the reward, and these behaviors are hard to explain. However, testing CMARL policies for safety has received less attention than the safety testing of single-agent RL policies. In this paper, we propose DisQ, a test case selection method that identifies failure-revealing states in value-based CMARL by exploiting a signal specific to trained Q-learning agents. The signal is the Q-value gap, an explainable metric that flags a state when the agents' estimates of the achievable return diverge by more than a calibrated threshold. DisQ selects such states for execution and skips those without a gap. Our experiments in four CMARL benchmark environments show that, in most of the evaluated configurations, DisQ improves failure detection over single-agent RL testing methods applied to CMARL, namely random testing and search-based testing with genetic algorithms. Our main contributions are the Q-value gap, an indicator of potential miscoordination computable from a single state without executing the system, and DisQ, a test case selection method that adapts existing single-agent testing methods to CMARL.
Figures & tables
Figure 1: Single-agent RL system where an agent receives an observation o and a reward rew from the environment after an action a was applied to the environment.
Figure 2: Cooperative MARL setting with two agents performing a joint action a=a1×a2 , leading to a new state s and shared reward rew , divided into observations o1 and o2 .
Figure 3: Illustration of Q-value gap between two agents when the distance between their maximal Q-values exceeds the threshold λ .
p
n
Rel. err. λ^
Selection rate (target 1−p )
0.90
25
−3.9%±13.8
0.128
[0.044, 0.246]
50
−2.0%±10.2
0.115
[0.053, 0.194]
100
−1.2%±7.2
0.108
[0.063, 0.161]
250
−0.5%±4.7
0.103
[0.074, 0.137]
0.95
25
−5.9%±14.8
0.083
[0.018, 0.182]
50
−3.2%±11.0
0.067
[0.022, 0.128]
Table 1: Sensitivity of the λ calibration: bootstrapped relative error of λ^ (vs. the quantile of 104 reference samples) and achieved selection rate ( P(D(s0)>λ^) , target 1−p ) with its 5th–95th percentile range, averaged over all eight trained policies (centralized and decentralized × four environments; 103 bootstrap calibrations each).
Hyperparameter
Value / Description
Population size
200 individuals
Initialization
Uniform random sampling within valid initial-state bounds
Figure 4: Relative change in average reward over Random Testing for the different testing methods, for centralized (top) and decentralized (bottom) CMARL, across all evaluated environments. The enhanced testing methods with DisQ outperform their vanilla alternatives in most cases. A ‘+’ marks a statistically significant difference from Random Testing (same test and significance decision as Tables 3 and 4 ); unmarked bars are not significant.
Figure 5: Diagrams that visualize the rewards in the Simple Speaker Listener environment for the different testing methods in centralized and decentralized CMARL. We observe that the boxplots of the DisQ enhanced testing methods indicate that DisQ finds failure behavior more often.
Setting
Method
ρ
p
Centralized
Genetic DisQ Testing
-0.65
4.25e-02
Genetic Testing
0.60
6.67e-02
Random DisQ Testing
-0.95
2.28e-05
Random Testing
-0.04
9.07e-01
Decentralized
Genetic DisQ Testing
-0.82
3.81e-03
Genetic Testing
-0.16
6.51e-01
Table 5: Spearman correlation between top-percentage (Q-distance quantile λ ) and average reward, Simple Spread (2).
Figure 6: Diagrams that visualize the average reward in the Simple Spread (2) environment over increasing q%-quantiles (Top Percentage) for centralized and decentralized CMARL. We observed in both cases that the larger the Q-value gap, the lower the average reward, showing the effect of DisQ.
Figure 7: Diagrams illustrating the effect of DisQ on the average reward in the Simple Spread (2) environment show a diminishing impact of DisQ as the local reward ratio increases. It also shows that DisQ outperforms the vanilla testing methods up to a local ratio of 0.9.
Method
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
Centralized
Random Testing
-56.5
-47.5
-45.2
-40.4
-38.8
-30.5
-25.0
-18.1
-12.8
-6.4
-0.1
Random DisQ Testing
-59.3
-48.2
-45.5
-43.4
-40.2
-32.1
-25.4
-20.8
-13.2
-6.8
-0.0
Genetic Testing
-60.6
-48.7
-50.0
-43.4
-42.7
-36.7
-27.4
-22.1
-15.4
-8.3
-0.9
Genetic DisQ Testing
-61.8
-46.9
-49.2
-43.7
-43.3
-35.9
-27.4
-25.9
-14.4
-7.1
-0.2
Decentralized
Random Testing
-34.5
-31.9
-27.8
-25.6
-21.7
-17.1
-14.6
-11.3
-7.7
-4.2
-0.2
Random DisQ Testing
-38.4
-35.5
-31.2
-28.7
-24.8
-19.5
-15.5
-12.5
-8.9
-5.0
-0.4
Table 6: RQ3.1: Average reward vs. local reward ratio, Simple Spread (2).
Reward
Failures
Train episodes
Method
Avg.
Δ %
A^12
Sig.
Fail./Exec.
Rate
OR
Sig.
100
Random Testing
-166.67
+0.0
–
–
1,250/25,000
0.050
–
–
Random DisQ Testing
-174.58
-4.8
0.06
306/3,855
0.079
1.64
Genetic Testing
-237.32
-42.4
0.00
7,698/24,983
0.308
8.46
Genetic DisQ Testing
-248.32
-49.0
0.00
3,135/7,589
0.413
13.37
1,000
Random Testing
-190.84
+0.0
–
–
1,250/25,000
0.050
–
–
Table 7: RQ3.3: Effect of training duration, Simple Spread (2), centralized CMARL.
Reward
Failures
Train episodes
Method
Avg.
Δ %
A^12
Sig.
Fail./Exec.
Rate
OR
Sig.
2,000
Random Testing
-99.78
+0.0
–
–
1,250/25,000
0.050
–
–
Random DisQ Testing
-105.73
-6.0
0.05
257/3,615
0.071
1.45
Genetic Testing
-126.48
-26.8
0.00
5,098/25,000
0.204
4.87
Genetic DisQ Testing
-124.40
-24.7
0.00
1,086/6,977
0.156
3.50
4,000
Random Testing
-70.76
+0.0
–
–
1,250/25,000
0.050
–
–
Table 8: RQ3.3: Effect of training duration, Simple Spread (2), decentralized CMARL.
Environment
Setting
Failures
D(s0)>λ
Mid-episode only
Never
Knight Wizard Zombies
centralized
261
28 (10.7%)
10 (3.8%)
223 (85.4%)
Knight Wizard Zombies
decentralized
266
16 (6.0%)
83 (31.2%)
167 (62.8%)
Simple Spread (2)
centralized
233
38 (16.3%)
23 (9.9%)
172 (73.8%)
Simple Spread (2)
decentralized
291
65 (22.3%)
173 (59.5%)
53 (18.2%)
Table 9: Partition of failure episodes ( 5,000 uniformly sampled episodes per configuration) by when, if ever, the Q-value gap exceeds the DisQ threshold λ ( 90% quantile of D(s0) ).
Figure 8: Q-values of agent 1 and agent 2 for each of their available actions in a single Q-value gap state of Simple Spread (2), selected by DisQ during testing.