Style Transfer Generative Adversarial Networks: Learning to Play Chess Differently

Muthuraman Chidambaram, Yanjun QiarXiv 2017

Abstract

The idea of style transfer has largely only been explored in image-based tasks, which we attribute in part to the specific nature of loss functions used for style transfer. We propose a general formulation of style transfer as an extension of generative adversarial networks, by using a discriminator to regularize a generator with an otherwise separate loss function. We apply our approach to the task of learning to play chess in the style of a specific player, and present empirical evidence for the viability of our approach.

Introduction

Style transfer has achieved remarkable success in the visual arts, enabling the transformation of photographs into the stylistic likeness of famous painters. However, these techniques typically rely on loss functions tailored to image pixels and convolutional neural network (CNN) feature maps, making them difficult to adapt to discrete, non-visual domains like strategic games or code generation.

In the context of chess, "style" is a well-recognized but elusive concept. While human observers can distinguish between aggressive, tactical players and defensive, positional ones, quantifying these differences for machine learning is challenging. Traditional chess engines are optimized for objective strength, resulting in a lack of "personality." This research introduces Style Transfer Generative Adversarial Networks (STGANs) to bridge this gap, providing a framework to inject human-like style into task-oriented agents without sacrificing fundamental effectiveness.

Methodology

The STGAN architecture modifies the standard Generative Adversarial Network (GAN) framework to accommodate a functional evaluator as a generator.

The Generator ($G$)

The generator is a feedforward neural network based on the "Deep Pink" architecture. Rather than generating data from noise, it acts as a chess board evaluator. It takes a 768-unit input representing the board state and outputs a scalar score. The generator is trained using a triplet loss approach: it evaluates an initial board, a "master move" board (from high-level human play), and a "random move" board. The objective is to ensure the master move receives a higher evaluation than the random alternative.

The triplet training architecture for the generator.

The Discriminator ($D$) and Adversarial Regularization

The discriminator serves as a "style detective," analyzing pairs of boards to determine if a move was played by a specific target grandmaster or by the generator. The core innovation lies in Adversarial Regularization. The generator does not merely attempt to fool the discriminator; instead, the discriminator’s output acts as a regularization term within the generator's primary loss function. A hyperparameter $k$ controls this balance: a higher $k$ value compels the generator to prioritize the target player's style, even if it necessitates a slight deviation from the objectively optimal move.

Experimental Setup

To train the model, the researchers utilized two primary data sources:

  • General Play: A broad dataset of games from the Free Internet Chess Server (FICS), focusing on players with ratings above 2000, was used to teach the generator the fundamentals of high-level chess.
  • Style Targets: The primary target was Mikhail Tal, the "Magician from Riga," whose aggressive and daring style is documented in 2,431 games. Secondary experiments were conducted using 688 games from the 19th-century master Mikhail Chigorin.

The authors define "style" primarily as a favoritism toward specific board positions, which is most measurable during opening sequences. This approach addresses the "data scarcity" problem: while there isn't enough data from a single player to train an engine from scratch, the STGAN can learn general competence from a large dataset and specific behavioral traits from a smaller, stylized dataset.

Results

The efficacy of the STGAN was evaluated by observing its preferences in common openings, such as the "Queen's Pawn" sequence.

Comparison of moves chosen by the baseline and stylized models in a Queen's Pawn opening.

As shown in Figure 5, the baseline model ($k=0$) preferred the move f8e7. However, as the style influence increased ($k=1, 2$), the STGAN shifted its preference to d7d5. This move is a recognized hallmark of Mikhail Tal’s repertoire for this opening. Similarly, when trained on Chigorin’s games, the model successfully emulated the "Chigorin Defense" in response to the Queen's Gambit, whereas the baseline favored modern standard responses. These results demonstrate that the STGAN can successfully adopt a specific persona while maintaining a positive evaluation of the board.

Discussion and Future Work

While the STGAN successfully captured stylistic preferences in openings, identifying and measuring style in the complex mid-to-late game remains a subjective challenge. Furthermore, the current experiments utilized a "negamax" search depth of only one to isolate the neural network's learned preferences. Increasing search depth would be necessary to make the engine competitive at a professional level.

Beyond chess, the STGAN framework offers a generalizable method for regularizing task-oriented generators with stylistic discriminators. This has potential applications in various fields, including stylized text generation, music composition, and the development of pedagogical AI that allows human players to practice against specific types of strategic opponents.

Summary updated

BibTeX
@misc{chidambaram2017style,
  author = {Muthuraman Chidambaram and Yanjun Qi},
  title = {{Style Transfer Generative Adversarial Networks: Learning to Play Chess Differently}},
  year = {2017},
  eprint = {1702.06762},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1702.06762},
}
Figure