Towards Efficient Detection and Optimal Response against Sophisticated Opponents

Tianpei Yang, Jianye Hao, Zhaopeng Meng, Chongjie Zhang, Yan Zheng, Ze Zheng

In multiagent reinforcement learning (MARL), the effectiveness of an agent's strategy is intrinsically tied to the behavior of its counterparts. While traditional MARL approaches often assume opponents utilize stationary or simple switching strategies, real-world scenarios frequently involve "sophisticated" opponents capable of higher-level reasoning. This paper, originally presented at IJCAI-19, introduces Bayes-ToMoP, a framework designed to detect and respond to such sophisticated opponents by integrating Bayesian Policy Reuse with recursive Theory of Mind (ToM).

The Challenge of Sophisticated Opponents

Most existing algorithms, such as BPR+ or DRON, operate under the assumption that an opponent is either stationary or switches between a limited set of fixed strategies. However, advanced AI and human players often employ Theory of Mind—a cognitive mechanism for attributing mental states like beliefs and intentions to others. If an opponent is actively modeling your behavior to exploit you, standard models typically fail, often achieving no better than a 50/50 win rate. The core challenge lies in quickly detecting these unobservable high-level reasoning strategies and responding optimally.

The Bayes-ToMoP Framework

The authors propose two primary variants of the Bayesian Theory of Mind on Policy (Bayes-ToMoP) framework:

  1. Bayes-ToMoP0 (Zero-order): An extension of Bayesian Policy Reuse that maintains a "zero-order belief" regarding which strategy from a known library the opponent is currently using, allowing for the selection of a best response.
  2. Bayes-ToMoP1 (First-order): The framework's core innovation, which maintains dual levels of belief. It tracks both the opponent's current strategy (zero-order) and the opponent's perception of the agent's own strategy (first-order).

A critical component of this framework is the confidence factor ($c_1$). This parameter dynamically balances the two belief levels. When the agent is winning, it increases reliance on the first-order prediction, assuming its model of the opponent's reasoning is accurate. Conversely, if performance dips, the agent reverts to the simpler zero-order model to avoid over-complicating its strategy.

To scale to high-dimensional environments, the authors developed Deep Bayes-ToMoP, which integrates Deep Q-Networks (DQN) to approximate value functions and estimate opponent policies using neural networks rather than simple lookup tables.

Experimental Evaluation

The framework was evaluated in two classic competitive environments: Soccer (a 7x7 grid game) and Thieves and Hunters. Both games included tabular and deep versions to test the scalability of the approach.

Performance comparison in Thieves and Hunters and Soccer environments.

As shown in the performance plots, Bayes-ToMoP1 significantly outperforms state-of-the-art baselines. In the Soccer environment, Bayes-ToMoP1 achieved a near-perfect win rate of 99.82% against sophisticated opponents, while the previous standard (BPR+) hovered around 49.78%.

Adaptability and New Opponent Detection

A key strength of Bayes-ToMoP is its ability to handle unknown strategies. If the agent's win rate falls below a specific threshold ($\delta$), the system identifies the opponent's strategy as "previously unseen." This triggers an online learning phase to develop a new best-response policy, which is then added to the agent's library.

Adaptation to strategy changes over time.

This adaptability is evident when opponents switch strategies mid-game. The framework successfully detects these shifts and learns new optimal responses, whereas baseline models often fail to adapt to policies outside their initial library.

Key Insights and Future Directions

The primary contribution of this work is the "modeling the modeler" approach. By explicitly accounting for an opponent's first-order beliefs, an agent can stay ahead of opponents who are trying to exploit its behavior. The adaptive confidence parameter ensures the agent remains efficient even against simpler opponents.

Future work aims to explore higher-order reasoning (ToM2+) and scale the framework to N-agent scenarios. Additionally, the authors suggest using policy distillation to speed up the learning of new strategies, addressing the current limitation where learning from scratch can be computationally intensive.

Summary updated

BibTeX
@inproceedings{yang2019towards,
  author = {Tianpei Yang and Jianye Hao and Zhaopeng Meng and Chongjie Zhang and Yan Zheng and Ze Zheng},
  title = {{Towards Efficient Detection and Optimal Response against Sophisticated Opponents}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.24963/ijcai.2019/88},
}
Figure