Tapered Eval

Home * Evaluation * Tapered Eval



Tapered Eval, a technique used in evaluation to make a smooth transition between the phases of the game using a fine grained numerical game phase value considering type of captured pieces so far. The technique requires aggregating two distinct scores for the position, with weights corresponding to the opening and endgame. The current game phase is then used to interpolate between these values. The idea behind Tapered Eval is to remove evaluation discontinuity.

=History= Though Tapered Eval has been used for many years (for example The King, as described in 1991 and Phalanx), and was already mentioned by Hans Berliner in 1979, the technique gained massive popularity only during the past few years, with the release of Fruit and the growing awareness among programmers of the sensitivity of the evaluation function to discontinuity. . Zurichess by Alexandru Moșoi uses the TensorFlow library for automated tuning - in a two layers neural network, the second layer is for phasing endgame and middlegame scores.

=Implementation example= Tapered Eval is done as follows in Fruit (similar implementations can be found in engines like Crafty and Stockfish etc.). The scaling looks like this: eval = ((opening * (256 - phase)) + (endgame * phase)) / 256 Where opening is the evaluation of the position with middle game in mind (e.g. keep kings protected behind their pawn covers) and endgame is the evaluation with endgame in mind (e.g. activate the kings). Both these evaluations are done in parallel when evaluating a position.

The phase is evaluated like this (code specifics left out): PawnPhase = 0 KnightPhase = 1 BishopPhase = 1 RookPhase = 2 QueenPhase = 4 TotalPhase = PawnPhase*16 + KnightPhase*4 + BishopPhase*4 + RookPhase*4 + QueenPhase*2

phase = TotalPhase

phase -= wp * PawnPhase // Where wp is the number of white pawns currently on the board phase -= wn * Knight   // White knights ... phase -= br * RookPhase phase -= bq * QueenPhase

phase = (phase * 256 + (TotalPhase / 2)) / TotalPhase

=See also=
 * Evaluation Discontinuity
 * Evaluation Philosophy
 * Game Phases
 * Neural Networks
 * PeSTO's Evaluation Function
 * Stockfish Evaluation Guide

=Selected Publications=
 * Hans Berliner (1979). On the Construction of Evaluation Functions for Large Domains. III. Smoothness, IJCAI 1979, Tokyo, Vol. 1

=Forum Posts=

2005 ...

 * designing neural networks by Gerd Isenberg, CCC, August 31, 2007
 * Re: Lemming Poll by Robert Hyatt, CCC, September 22, 2008 » Crafty, LearningLemming
 * Superlinear interpolator: a nice novelity ? by Marco Costalba, CCC, September 20, 2008 » SIMD and SWAR Techniques
 * Re: talk about IPP's evaluation by Richard Vida, CCC, November 07, 2009 » Ippolit, SIMD and SWAR Techniques

2010 ...

 * My experience with Linux/GCC by Richard Vida, CCC, March 23, 2011 » C, Linux, SIMD and SWAR Techniques
 * two values in one integer by Pierre Bokma, CCC, January 18, 2012
 * Tapered evaluation by Marco Pampaloni, CCC, March 18, 2014
 * advanced tapered evalutation by Marco Belli, CCC, August 08, 2014 » SSE

2015 ...

 * Why do some programs evaluate MidGame and EndGame together? by Syed Fahad, CCC, March 01, 2015
 * Tapered Eval by Robert Pope, CCC, August 05, 2015
 * is phase a good indicator of game progress? by Alexandru Mosoi, June 23, 2016 » Game Phases
 * Re: Deep Learning Chess Engine ? by Alexandru Mosoi, CCC, July 21, 2016 » Deep Learning, Zurichess
 * Tapered Evaluation Questions by Jayakiran Akurathi, CCC, October 01, 2016
 * couple of questions about stockfish code ? by Mahmoud Uthman, CCC, October 26, 2016 » SIMD and SWAR Techniques, Stockfish
 * Define end game by Laurie Tunnicliffe, CCC, November 16, 2016 » Endgame
 * Early / middle / end game transitions? by notachessplayer, OpenChess Forum, February 19, 2017
 * Four game phases by Stefan Geschwentner, FishCooking, February 20, 2017 » Stockfish
 * Tapered Eval between 4 phases by Andrew Grant, CCC, October 16, 2017
 * Re: Tapered Eval between 4 phases by Jonathan Rosenthal, CCC, October 16, 2017 » Winter
 * Re: Tapered Eval between 4 phases by Youri Matiounine, CCC, October 16, 2017 » AVX2


 * Re: New uci engine: Rofchade by Ronald Friederich, CCC, August 28, 2018 » RofChade, Piece-Square Tables
 * Four-way evaluation trick? by Nick Pelling, FishCooking, September 07, 2018 » Stockfish
 * mg vs eg eval by Joost VandeVondele, FishCooking, October 06, 2019 » Middlegame, Endgame, Stockfish

2020 ...

 * Tapered Evaluation and MSE (Texel Tuning) by Michael Hoffmann, CCC, January 10, 2021 » Texel's Tuning Method

=External Links=
 * Stockfish Evaluation Guide » Stockfish Evaluation Guide
 * Tapered Eval from Mediocre Chess by Jonatan Pettersson
 * Taper from Wikipedia
 * Cone (geometry) from Wikipedia
 * Interpolation from Wikipedia
 * Fuzzy logic from Wikipedia
 * T-norm fuzzy logics from Wikipedia
 * Linear taper potentiometer from Wikipedia
 * Sigmoid function from Wikipedia
 * Association P.C. - Frau Theunissen´s Kegel, Erna Morena (1973), YouTube Video
 * Pierre Courbois, Jasper van 't Hof, Toto Blanke, Sigi Busch, and Heiner Wiberny

=References=

Up one level