Leela
Leela is a strong Go playing program combining advances in Go programming and
further original research into a small, easy to use graphical interface.
It is freely available, making it an ideal introduction to the game.
Features
- Strong Go engine including support for multiple processors and GPU acceleration
- Strength over 9 dan on 19 x 19, depending on hardware
- 2008 Computer Olympiad Silver (9x9) and Bronze (19x19) medalist
- Featuring Deep Learning technology
- Easy to use graphical interface
- Adjustable board size (up to 25x25!), playing levels, handicap and komi
- Fixed strength and time based difficulty levels
- Chinese rules with positional superko
- SGF format loading and saving
- Rated game mode with auto-adjusting difficulty levels
- Analysis features including critical variations for each move and winning odds
- Graphical display of critical moves, territory, best lines, …
Download
Source code
Screenshots
Analyzing a game, showing the most probable moves.
FAQ
What's this Deep Learning technology?
Leela contains an AI technique modeled after the human visual system and brain,
a deep stack of artificial neurons processing visual input with each layer combining the
previous ones into higher level features (a so called DCNN, deep convolutional neural network).
This "neural network" has been trained with more than 32 million
positions from high level go games and taught to predict which moves a pro
player would most likely consider. In 19x19 games the engine will query this deep
"neural network" during the search to focus on the most critical variations. The result
is a substantial raise in playing strength (about 6 stones), and a more human-like
playstyle, while still allowing the engine to innovate of its own.
What's the benefit of GPU Acceleration?
A GPU is typically much faster than a normal processor at doing the kind of
calculations the Deep Learning algorithms need. For example, an AMD R9 390 (mid-range
videocard) can find the worthwhile moves in a Go position about 15 times faster than an
Intel Core i5-6600 (mid-range CPU). Leela makes use of this to explore variations
deeper and in more detail. You can notice that in analysis mode the critical variations
displayed by the engine are much longer when GPU Acceleration is used.
What do I need to run the "GPU Accelerated" version?
You need a video card with OpenCL 1.1 (or later) capability. This is supported on all
recent AMD and NVIDIA cards. Make sure the latest drivers for the video card are
installed. The detected video card can be seen in the Help->About menu.
Can I run the "GPU Accelerated" version on the built-in graphics of my CPU?
This only makes sense if the built-in GPU is faster at doing the Deep Learning calculations
than the CPU itself. Intel CPUs are typically very fast, with a weak built-in GPU,
so this is not recommended. AMD APU's typically have a slow CPU but a fast GPU, so
it would be worthwhile on those.
My Linux distribution is not listed.
You have several options:
- The "engine only" download has Linux binaries included that should run on almost all distributions, and which can be used with any Go GUI that supports the GTP protocol (almost all of them do). A good looking one is Sabaki. To use the OpenCL version you must have OpenCL drivers and an OpenCL ICD loader installed, please see the included README.TXT.
- The Windows installer and graphical interface work and are fully functional under wine-1.9.23 or later, although GPU acceleration will not work.
- Many Linux distributions have some way to take in Ubuntu/Debian packages and convert them to the distributions' own format. Perhaps someone has already done this for you. Look around!
Why does Leela report >100% or negative winrates?
Being sure of winning the game with 0.5 points corresponds to 100% winrate. Bigger margins of victory are represented by >100%.
How do I analyse games?
Enable the Analysis Window via Analyze→Analysis Window. Start analysis with F2 (or the toolbar) and move through the game with the arrow keys, looking for jumps in the Win% of the best move (the one on top). These represent mistakes by one of the players. Look at what moves Leela suggests instead. Show Network Probabilities (F3) and Show Best Moves (F4) can help understand direction of play mistakes and Show Territory (F5) can help understand the "size" and "temperature" of plays.
You can "save" the position by pressing the +, then try out a variation on the board. Then do Analyze→Revert to Stored (Alt-M) to go back to the position you saved. The position is also saved whenever you enter Analyze mode.
Enabling the Histogram (Ctrl-H) shows a graphical display of who was ahead at what point of the game. It plots winrate versus move number. A steep vertical bank in the line represents a likely mistake according to Leela. You can go to that move by clicking inside the Histogram window.
What do the columns in the Analysis Window mean?
Leela always orders the moves in this window from best to worst, i.e. the top move is the best move (so far). You can click in this window to show the principal variation for the selected move on the board.
- Simulations: the number of Monte Carlo playouts used to investigate the move. More simulations means more confidence in the winrate as the move has been investigated deeper.
- Effort%: the percentual amount of search effort Leela has spent on a move. A large search effort means that the move has consistently looked good throughout the search. Leela generally prefers such moves, unless a new very promising candidate has popped up.
- Win%: this represents Leela's best guess as to how likely it is for the player to move to win the game. If there is a move that is not investigated deeply yet, but appears to provide a higher chance of winning than the current best move, it is bolded. You might want to let Leela analyze a bit longer if this happens.
- MC Win%: the likelyhood that the player to move wins the game, as determined by randomized Monte Carlo playouts from the current position. This is a factor in the Win% calculation.
- Net Win%: the likelyhood that the player to move wins the game, as determined by analyzing the position with a neural network. This is a factor in the Win% calculation.
- Net Prob%: the probability that a pro player would play this move, as estimated by the Neural Network.
- Eval: displayed in non-19x19 games instead of Net Prob%. A dimensionless number expressing the likelihood of the move being good, based on a pattern database and the moves' features.
- PV: the principal variation. The sequence of suggested moves for both players that Leela believes is optimal.
My Mac is complaining that Leela can't be opened because it is from an unidentified developer.
Right click the download and select Open. You'll get the option to bypass the warning. Explanation from Apple.
Leela says that white is more likely to win when black gets handicap stones.
Leela's value network is generated from real human games, not idealized computer opponents. In handicap games, the stronger (white) player wins more often. You can look at the Monte Carlo evaluation for an assement with equally strong players.
Changes
Leela 0.11.0 (2017-10-24)
- Fixed wrong search algorithm being used when neural nets are disabled. This made the previous version play very weakly on non-19x19 boards.
- New, much stronger Monte Carlo evaluation by combining Policy Gradient Reinforcement Learning and Simulation Balancing.
- The combination of the above means that strength on non-19x19 has greatly increased compared to the previous release. As a result, rankings in rated game mode have been reset.
- The users' rank now adjust much faster in the first few rated games.
- More accurate, larger value network for 19x19.
- More accurate policy network for 19x19. With OpenCL enabled an even stronger, bigger network is used instead.
- Windows version is now compiled with Clang/LLVM 5.0 instead of MSVC2017. This makes the Monte Carlo evaluations about 15% faster.
- Improved OpenCL error handling with more useful error messages. The GUI will pop up a dialog if initialization fails.
- Resizing the board window to the minimum no longer crashes the program.
- The GUI version now runs the engine at normal, not lowered priority. This can improve responsiveness in some situations and avoids false hangs if another program is pegging the CPU.
- Small visual fixes to the settings window.
- Internal cleanups and changes to thread handling aimed at working arounds bugs in AMD's OpenCL drivers.
- Taking back a move in rated mode now properly makes the game not count.
- Fixed a bug where quickly moving backwards/forwards through a game could cause analysis mode to be activated.
- Winrates for the Score Histogram are now remembered even if the window is not currently active.
- Leela now includes the current date tag when writing SGF files.
- Workaround for a bug in GNOME and Unity regarding icon handling.
- Leela now marks itself as capable of handling SGF files on Linux.
- On Linux the program shortcuts now apply the PulseAudio wrapper automatically. This makes sound work by default on modern Linux distributions.
- "Score Histogram" renamed to "Win Rate Histogram".
- During scoring, "Play On" has been reverted back to read "Dispute Score".
- Position cache is now cleared when komi changes.
- It is now possible to play with negative or large komi in the UI, but note that the value network will not work as accurately compared to standard 0, 6.5 or 7.5 komis.
- “Dispute” button in the scoring dialog now works correctly, and will enable resumption of the game with all-stones-are-alive scoring.
- Leela now restores the size and position of the most important windows.
- Leela now remembers which visualization tools were enabled when restarting the program.
- Leela no longer auto-sizes the analysis window if the window is restored after startup.
- Larger, more modern fuseki library.
- --nobook option allows disabling the fuseki library (GTP version).
- Move information will now be displayed for all interesting moves, instead of the first 6 (GTP version).
- A loadsgf command with incorrect parameters no longer crashes the engine (GTP version).
- Clarified the description of some commandline parameters (GTP version).
- Abort on some combinations of commandline parameters that are inconsistent (GTP version). Notably, when restricting the playouts pondering must be disabled.
- The engine will now additionally ponder after kgs-genmove_cleanup commands (GTP version).
- The GUI version now accepts an SGF name and move number as startup arguments.
- macOS version now warns about Apple's OpenCL drivers on first run.
- Settings that are not available on the current platform are now greyed out.
- A score estimate for the current position is now displayed in the title of the analysis window.
- loadsgf now stops at the position before the specified move number (GTP protocol compatibility).
- Loading an SGF in the GUI now correctly loads the last move as well.
- Give a meaningful message if an OpenCL device reports it's not a CPU or GPU (GTP version).
- Loading an SGF and trying to play on now takes the settings from "New Game", instead of the last active ones (which would often be a rated game).
- Some more invalid SGF files with handicap games can now be parsed.
- Fix issues with loading SGF files with international characters in the name.
- Fix wrong version info in Linux .desktop files.
- Fix some keyboard shortcuts that were mapped to multiple functions.
- Fix a bug that could cause the variation display to use the wrong stone colors.
- Fix a bug that could cause erronous matches in the opening book or position cache.
- Fix a potential crash when the score histogram is enabled.
- Fix a crash when we cannot detect the number of threads/CPUs.
- Many internal cleanups.
Leela 0.10.0 (2017-05-18)
- Reworked, faster policy network that includes games from weaker
players. This improves many blind spots in the engine.
- Larger value network trained with more data (With thanks to Hiroshi
Yamashita).
- Value network computation is now done on the GPU (OpenCL version).
- Improved "easy move" and "snap move" system when move decisions look
obvious. Leela is less likely to blunder in those situations.
- Improved reading of ladders and detection of false ladders.
- Improved winrate estimation, taking confidence in Monte Carlo and
Value Network into account.
- Tuned and improved search, also for 9x9 and 13x13. The latter is up to
a stone stronger (but much weaker than 19x19).
- Various small fixes to the engine's diagnostic display in edge cases.
- Optimizations for large numbers of cores/threads: >=6 and >=14. 16
thread machines are up to half a stone stronger. Reduced amount of locking.
- Some set-up operations now run in parallel. This improves strength at
very fast time-controls or on systems with many cores.
- Native Linux GUI added.
- Native macOS GUI added.
- macOS engine no longer requires boost/homebrew (GTP version).
- More clear display of search statistics, notably effective search speed (GTP version).
- Small updates to fuseki library.
- clear_board no longer resets the komi value (GTP protocol compatibility).
- "--komiadjust" option to avoid 0.5 point losses when playing under
territory scoring rules (GTP version).
- Adjust some edge cases for time_left, such as time_left w/b 0 0 (GTP
protocol compatibility).
- Reworked score dialog. It will indicate if Leela is not confident in
the scoring or group status.
- Selecting a variation in the analysis window now shows the variation
with stones and numbering on the board.
- Reworked heatmap display with clearer coloring.
- Add a heatmap display that displays the current best moves from the
search. Add a column to the analysis window with percentage of search
effort spent.
- Add a clickable score histogram with current move indication.
- Don't auto-resize the analysis window if the user has resized it manually.
- Added explicit "Store position" and "Forget position" commands to the
UI. Positions are kept in a stack. The current position is automatically
saved upon loading a game or entering analysis mode.
- Added "winrate", "vn_winrate" and "mc_winrate" commands (GTP version).
- Add "heapmap" command (GTP version).
- Add support for specifying the GPU to use (GTP version).
- Add support for kgs-game_over (GTP version).
- Linux and macOS binaries now supports older systems and AMD Ryzen.
- Territory and move number now correctly update after moving through a
game or loading an SGF. Move number is displayed in the title bar.
- Copy/Paste SGF to clipboard options added to the GUI.
- Leela won't pass out games where the winner is not very certain.
- Time is now correctly subtracted from the clock when playing games in
the GUI. This makes Leela respect the set time-control again.
- Entering analysis mode from a rated game will disable the engine's
strength limits.
- Analysis data can now be copied by right-clicking the analysis window.
- Fixed algorithm for "influence" (GTP) and "Show Territory" (GUI).
Leela 0.9.0 (2017-02-18)
- Strongly improved search: the engine can now extend the search tree in
multiple steps, running the fastest ones on the CPU. Slightly less
dependent on a fast GPU, less slowdown due to communication with GPU,
less sensitive to holes in the neural network.
- Improved Monte Carlo evaluation, notably some life and death reading
requiring exact move sequences and nakade.
- A value network is now used as a second opinion to the Monte Carlo
evaluation. This benefits greatly from a modern CPU (Haswell or newer).
The reported winning rate takes both techniques into account.
- Retuned various search parameters.
- Altogether these improvements are worth about 1 to 2 stones.
- Retuned resign thresholds for new evaluation.
- Limit handicap setting in GUI to sane/supported levels.
- Don't overwrite the first moves in the graphical mainline display when
a recapture happens.
- Slightly adjust rated game mode difficulty.
- Fixed multiple issues with SGF parsing: whitespace issues, comments
and escape sequence parsing, default to 19x19 when no size specified.
- Added 7x7 board size in the new game dialog.
- Coordinates are now in uppercase (required by GTP spec).
- Added --quiet, which suppresses diagnostic output on stderr and can
solve GUI compatibility issues (GTP engine).
- Added --logfile option (GTP engine).
- The time_settings command now implies a clock reset (GTP version).
- Fixes to Canadian style byo yomi time. (GTP version)
Leela 0.8.0 (2016-11-17)
- Faster DCNN computation on CPU: up to 130% speedup on modern Intel CPUs.
- Faster DCNN computation on GPU: ~10-20% faster on AMD GCN, up to 150% faster on NVIDIA Pascal/Maxwell/Kepler.
- Stronger playouts: Better handling of self-atari moves, semeai, some minimal understanding of seki and nakade.
- Stronger search: Less hard pruning of unlikely moves, yet better focus on strong variations.
- More resistance to entering ladders, bugfixes to reading of branching ladders.
- OpenCL version now runs a self-test on startup and will report broken drivers.
- Bugfixes to byo-yomi timing, preventing some panic moves.
- Leela now resigns faster when losing.
- Leela no longer passes out the game when it is not yet won on the count.
- Bugfixes to marking dead stones in passed out games.
- The above adds up to about 1 to 2 stones strength improvement, depending on the hardware.
- Bugfixes to SGF writing, correct handling of resignations.
- Support for SGF writing via "printsgf" command (GTP version).
- Bugfixes to Show Probabilities when loading SGF games.
- Configurable buffer for interface/network lag (GTP version).
- Configurable number of playouts (GTP version).
- Moves with a higher winrate than the current best move (but insufficient confidence) are bolded in the analysis window.
- Heatmap displays correctly for moves on the board edge.
- Faster resizing of the board when heatmaps are enabled.
- Installer offers the choice of installing for current user or all users.
- Uninstaller will clean up registry settings correctly.
- Show move probabilities and Use Networks are greyed out in non-19x19
games.
- "Rating" display changed to "Your rating" to prevent some confusion.
- "Rating" display will disappear when the user uses any kind of hint
or analysis feature (and the game won't count).
- Analysis mode allows you to freely play moves on the board. There is
a menu option and toolbar button "Return to Mainline" that will revert
to the position where Analysis Mode originally got enabled.
- Browsing through the game with ahead/back 10 moves is much faster.
Leela 0.7.0 (2016-09-30)
- Larger DCNN and hence better move pruning.
- Fuseki library built from professional games included. Speeds up opening play.
- (GPU version) Faster dispatching to GPU, speeding up tree search.
- Better selection of critical variations during the tree search.
- Altogether about half a stone stronger than 0.6.2.
- Support for board sizes larger than 25 x 25 has been removed. This made many of the following enhancements much easier.
- Arrow keys can be used to move through a game in analysis mode.
- Engine stays in analysis mode when moving through a game.
- Show Territory reworked to use the calculation from the engine instead of a simplified one from the GUI. Display is now prettier and can show the likelihood graphically.
- Option to show the probabilities from the DCNN as a heatmap.
- Analysis Window providing in-depth display of the move evaluations.
Lines can be clicked to show the Principle Variation graphically.
- Windows DPI Scaling can be enabled or disabled via the settings menu.
- Dialogs should now fit better when using nonstandard screen or font sizes.
- Engine runs at lower priority so Windows stays more responsive.
- Windows XP SP2 is now supported as the minimal Windows version.
- OpenCL support is now available for the Linux GTP engines.
Leela 0.6.2 (2016-06-04)
- Deep Learning DCNN for move pruning during search (+6 stones strength).
- Added OpenCL version, running the DCNN on the GPU.
- Reworked search algorithm for Deep Learning mode.
Leela 0.4.6 (2016-04-07)
- Doubled size of pattern database and retuned move prediction.
- Fixed a bug introduced in 0.4.x that severely degraded life and death assessment.
- Other playout fixes improving life and death reading.
- Total playing strength improved by about half a stone.
- Dialogs will now render properly on high-DPI displays.
- Installer no longer requests administrator rights (no UAC prompt).
- Removed lite version. Full version is now free.