Detecting Individual Decision-Making Style: Exploring Behavioral Stylometry in Chess

1 Introduction . The advent of machine learning models that surpass human decision-making ability in complex domains raises the prospect of building AI systems that can collaborate and interact productively with humans . While many advances will be essential in order to achieve this far-reaching goal , algorithmically characterizing aspects of human behavior will be a significant step . Whereas existing work focuses on characterizing human behavior in an aggregate or generic sense , genuine human-AI interaction will require specializing these characterizations to individual people . Developing algorithms that can detect signatures of individual decision-making style would constitute an important advance for many reasons . First , being able to recognize an individual from their behavioural characteristics would greatly benefit an AI system ’ s ability to coordinate with that individual . In general , decision-making styles can range from complementary to clashing , and a predictive characterization of an individual ’ s decisions would be useful for an AI system trying to adapt to their style . Second , such fine-grained , individual-level characterizations would help isolate the distinguishing features of individual styles . In a domain where ML systems are able to match 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . or surpass human performance , it becomes natural to try extending these systems to pinpoint the types of decisions a person is particularly good at , and types of decisions they could potentially improve . Finally , applying these algorithms to many different individuals would shed light on the structure of decision-making in the domain itself . For example , certain instances could prove particularly discriminative in detecting individual style . In addition to these benefits , the ability to identify individuals from behavioral traces also raises ethical concerns centered around privacy and generalization to high-stakes domains . We discuss the ethical consequences of our work in Section 5 . To formalize the above process , we study the problem of behavioral stylometry , in which the goal is to identify a decision-maker from their decisions alone . We pursue this task in the domain of chess , which for many reasons is an ideal model system for developing human-compatible algorithms . AI systems surpassed all human-level ability in chess at least 15 years ago . Despite this , millions of people at all skill levels still actively play . Through their activity , people generate detailed traces of their decisions , which are digitally recorded and publicly available . In chess , behavioral stylometry reduces to predicting the identity of a player from the moves they played in a given set of games . We present a transformer-based approach to behavioral stylometry in chess . We show how to adapt recent work in speech verification to the problem of detecting individual decision-making style . Working in the domain of chess requires us to extend these methods to the complex types of data found in the game-playing structure of chess . We apply our model in a few-shot classification setup , where only a small number of games are provided for the model to learn a representation of a player ’ s decisions , and the model must then identify the player from thousands of possible candidates , based on another small sample of their games . Compared to a recent approach , our method achieves high accuracy on this task , while being much more scalable and data-efficient . Our resulting embeddings of players and their games reveals a structure of human style in chess , with players who are stylistically similar clustering together in the space . We consider the implications of these findings , including the potential ethical implications of identifying individuals from their behavioral data . 2 Related Work . Speaker verification . Our work adapts recent work in speaker verification [ 46 , 52 ] , where given a speaker ’ s known utterances , the task is to verify whether an utterance belongs to that speaker . Recent approaches embed utterances into a vector space such that different speakers are distinguishable [ 28 , 42 ] . These embedding approaches can also be used for downstream tasks such as voice cloning and multi-speaker speech synthesis [ 21 , 27 , 34 ] . A key decision for our task is the choice of loss function , of which two families are most relevant [ 13 ] . Classification-based objectives are designed to identify ( classify ) an unknown target speaker from a pool of possible candidates . Cross-entropy loss is a simple approach , with many variations including angular softmax loss [ 29 ] , cosine loss [ 50 ] , and additive angular margin loss [ 14 ] . Contrast or metric-learning based objectives instead directly optimize the contrastiveness for samples in different classes , and similarity for those within the same class . Contrastive loss [ 11 ] , triplet loss [ 38 ] , and generalized end-to-end loss ( GE2E ) [ 49 ] are used in face verification , face clustering , and speaker verification respectively . In this work , we adapt GE2E to the problem of behavioral stylometry . Stylometry . Both speaker verification and handwriting recognition are stylometry tasks where the goal is to detect and analyze authorial style . Stylometry has historically been associated with attribution studies [ 45 ] and has been applied to de-anonymizing programmers from their code [ 8 ] , identifying age and gender from blog posts [ 22 ] , and distinguishing machine-generated text from human-generated text [ 5 ] . It is often framed as a task to determine the similarity between samples or features extracted from the samples [ 32 ] . Handwriting recognition has employed neural methods to identify individuals for decades [ 7 ] , and development is ongoing [ 23 , 24 ] . We introduce the task of behavioral stylometry , in which the goal is to identify decision-makers from their decisions . Chess . Chess has a long history in academic research as both a test bed for artificial intelligence [ 39 ] and for understanding human behaviour [ 1 , 6 , 9 ] . Recently , these two goals have begun to merge , as researchers have begun to create chess engines that behave in a more human-like manner [ 30 , 37 ] . Recent work presents personalized chess engines based on AlphaZero [ 40 ] that are trained to predict moves made by specific players [ 31 ] . As a side effect , these models can perform behavioral stylometry in chess . We develop a methodology that is both more scalable and more accurate than this approach . Few-shot learning . We approach behavioral stylometry as a few-shot learning task with tens to hundreds of samples per class , which is a well-studied problem formulation [ 18 , 19 , 51 ] . Transfer learning is a main approach to few-shot learning , where models are first trained on a large dataset and then specialized to several smaller datasets [ 16 , 33 , 43 , 53 ] . Embedding learning [ 26 ] is another approach , where an embedding space is constructed so that similar training samples are close together and different samples are further apart . Test samples can then be mapped to this space and compared with the closest training samples and their associated classes . Several architectures have been proposed , such as matching networks [ 4 , 10 , 48 ] and prototypical networks [ 36 , 41 ] . Finally , metalearning [ 2 , 44 ] is another popular approach , which uses a two-level learning process to train a model across similar tasks and adapts it to solve new tasks with a small number of training samples [ 20 , 35 ] . 3 Methodology . We begin by describing our model design for performing behavioral stylometry in chess . The model has three main components : the first extracts features from individual moves , the second aggregates information from the move level to the game level , and the third aggregates information from the game level to the player level . Given a chess position as input , the first step uses residual blocks to extract move-level features . Then in the second step , we aggregate move-level features into a game-level vector using a transformer-based method . Finally , the third step aggregates a player ’ s game vectors by calculating their centroid , producing a player vector that represents the player ’ s individual playing style . Move-level feature extraction . To extract features from chess boards and moves , we draw upon previous work ( AlphaZero and Maia ) and use a series of residual blocks . The input to the model is encoded as a 34-channel 8⇥ 8 chess move representation ; we represent a move with two board positions , corresponding to the boards before and after the player ’ s move . The first 24 channels each encode a specific type of chess piece ( 6 for each side in one position , and we encode two positions ) , and the next 10 channels encode position metadata relevant to chess such as repetition , castling rights , the active player ’ s side , 50-move-rule count , and border information . The output is a 320-dimensional feature vector that characterizes each move . Each residual block consists of convolutional layers , batch normalization , ReLU activations , and squeeze-and-excitation ( SE ) blocks [ 25 ] . On top of the residual blocks we add global average pooling , which summarizes the output from residual blocks into a 1⇥ 1⇥ 320 feature map , which we flatten into a 320-dimensional vector . The hyperparameters of the model were chosen to match the Maia architecture : 6 residual blocks with channel size of 64 and a reduction ratio for SE blocks of 8 . Aggregating information to the game level . The next component of the model takes in a sequence of move features extracted from the first component and constructs a game representation . The input features correspond to the moves played by the target player in a particular game . The output is a game vector that aggregates information about the move features . Although previous work used an LSTM to perform the analogous task in speaker verification , our experimentation revealed that a transformer [ 47 ] worked better for our task . Hence , in our approach we use a modified version of the Vision Transformer ( ViT ) [ 17 ] , which was originally proposed as a pure transformer replacement for CNNs in vision tasks , achieving comparable results to state-of-the-art CNN architectures with fewer computational resources . As we consider chess moves as 8 ⇥ 8 images with 34 channels , we can adapt ViT to fit in our setting . To do this , we first modified the input to ViT to take in a sequence of move features , instead of fixed-size patches extracted from an image . Both BERT [ 15 ] and ViT append a classification token to the input sequence , and the final hidden state of this token is considered as a representation of the entire sequence . However , in our task we achieve better performance if we directly average the output vectors of transformer blocks , so we remove the classification token in the input . As all move features are fed into the transformer simultaneously , we retain the ordering of the chess moves by adding a positional encoding to each move feature . The original ViT architecture includes a learnable 1D position embedding in the input sequence , but it can not easily accommodate variable length inputs during training . Therefore , we use sine and cosine functions to encode positions , a method proposed in the standard transformer , and we include support for encoding up to 500 chess moves . As an overview of our model , each 320-dimensional input move feature vector is first projected into 1024 dimensions , and a positional encoding is appended to the resulting vectors before they are fed into the transformer encoder . The encoder has 12 transformer blocks , each composed of an attention layer followed by a feed-forward layer , with layer normalization [ 3 ] applied before each layer . There are 8 attention heads , each with 64 dimensions , in each attention layer . The feed-forward layer uses MLP with two layers to project the 1024-dimensional vector into 2048 dimensions , where GELU activation is applied , and then another layer projects it back to 1024 dimensions . Each output vector of the encoder corresponds to an input move feature , and we average these vectors to get a single vector of dimension 1024 , which is finally projected with MLP into our final embedding space . This 512-dimensional embedding vector encodes the decisions the player made in the game . At inference time , the player vector is obtained by simply averaging all the game vectors ( i.e . the centroid ) that belong to the player . Loss Function . In order to capture individual playing style , we adapt Generalized End-to-End Loss for Speaker Verification ( GE2E ) [ 49 ] to our setting , which allows us to train the game vectors to maximize both intra-player compactness and inter-player discrepancy in the resulting embedding space . GE2E builds a similarity matrix on a batch of N ⇥ M games , where N is the number of players and M is the number of games per player . For each game from each player , we extract the current 512-dimensional embedding vector yji ( i-th game from the j-th player ) output by the residual blocks and transformer network . We also find the centroid vector cj of a specific target player by averaging all of their game vectors in the batch . However , we remove yji when computing the centroid of the true player as suggested in [ 49 ] , to help avoid trivial solutions . We then construct a similarity matrix Sji , k containing the cosine similarities between each game embedding vector and each player centroid ( for all players in the batch ) , which we further scale by two learned parameters w and b . For the target player , we calculate the centroid c ( i ) j = 1 M 1 PM m 6=i yjm , and otherwise simply use the average of game vectors for all other players ( k 6= j ) . Sji , k = ( w · cos ( yji , c ( i ) j ) + b if k = j ; w · cos ( yji , ck ) + b otherwise . ( 1 ) The final loss function is designed to maximize the similarity for the correct entries , while penalizing all other entries in the similarity matrix . As a result , the loss function L ( yji ) = Sji , j + log PN k=1 exp ( Sji , k ) pushes each embedding vector closer towards the player ’ s centroid and further from all other players ’ centroids simultaneously . Training procedure . We randomly sample N ⇥M games as a batch , where N = 40 is number of players and M = 20 is number of games per player . In order to speed up training and perform batch computing , we randomly sample a 32-move sequence from each game and pad 0s to games with length less than 32 moves . The entire model was trained with 4 Tesla K80 GPUs and SGD optimizer with an initial learning rate of 0.01 and momentum of 0.9 . The learning rate was reduced by half every 40K steps . Initial values of w and b for the similarity matrix were chosen to be ( w , b ) = ( 10 , 5 ) , and we used a smaller gradient scale of 0.01 to match the original GE2E model .

Summary: This paper introduces a task of behavioral stylometry in the domain of chess plays. It uses a few-shot learning framework and uses the optimization objective inspired by the speaker identification domain to solve this problem. It demonstrated clear gains over previous baselines and has performed a satisfactory analysis that can be used by future researchers to extend this work.