Skip to main content

XiangqiBench

Paper PyPI Python CI License: MIT

Paper | Data card | Changelog | Citation

This repository contains the official implementation of Finding the Move Is Not Winning the Game: XiangqiBench for Closed-Loop Evaluation of LLM Agents.

XiangqiBench asks an LLM agent to convert 119 composed xiangqi (Chinese chess) endgames into checkmate against a Pikafish defender. The agent acts through a small command protocol under per-turn budgets and is scored only on whether it actually delivers mate: finding the right first move is not enough.

Installation

pip install xiangqibench                  # OpenAI-compatible and Azure endpoints
pip install "xiangqibench[anthropic]"     # adds the native Anthropic client

XiangqiBench requires Python 3.10 or later and a Pikafish binary for the defender:

git clone https://github.com/official-pikafish/Pikafish && make -C Pikafish/src -j build
export PIKAFISH_PATH=$PWD/Pikafish/src/pikafish
xiangqibench doctor                       # checks the engine and prints its build and NNUE hash

The paper's defender was Pikafish fd168f68 with the network whose sha256 begins a2f41d4d, searched to depth 18 with one thread and a 256 MB hash. Upstream has since replaced that network, and older builds cannot load the new one, so build the current Pikafish as shown above. Its moves can differ from the paper's defender. Every record stores the engine build and the network hash.

Usage

export OPENAI_API_KEY=...
xiangqibench run --model gpt-5.5 --mode sighted --limit 5
xiangqibench score runs/

Full runs are configured with a single YAML file; xiangqibench init writes a commented example. API keys are read from the environment, never from the file.

mode: restricted                # sighted | restricted | S | S-NT | R-T | R
model:
  name: qwen3-235b
  provider: openai              # openai | azure | openai-responses | anthropic
  base_url: http://localhost:8000/v1
  api_key_env: VLLM_API_KEY
run:
  trials: 3
  workers: 8
xiangqibench run -c my_run.yaml           # resumable: re-running fills in missing trials

Command-line flags override the file, and unknown keys are rejected.

Modes

Mode Observation Tools
sighted Board, FEN, and legal moves after every ply view_board, simulate, get_legal_moves
restricted Starting position once, then move diffs only none
S, S-NT, R-T, R Observation ablations: state push (S/R) × tool access (T/NT) as named

sighted and restricted are the paper's two settings. xiangqibench prompt --mode <mode> prints the exact system prompt for any mode.

Scoring

xiangqibench score reports pass@k and pass^k over the earliest three scored trials per (model, mode, case), with 95% case-bootstrap intervals using the paper's seeds. Trials cut short by infrastructure errors are excluded and re-run automatically. Runs that change the standard budgets or defender settings are marked standard: false.

Python API

from xiangqibench import load_config
from xiangqibench.runner import run_suite

report = run_suite(load_config("my_run.yaml"))

Any object with a name attribute and a complete(messages) -> Completion method can be evaluated as an agent; see xiangqibench.runner.play_trial.

Reproducibility

Every trial is stored as one JSON record with the full message history, the move list, the resolved configuration, and the defender's identity, including which backend chose each defender move. The test suite replays archived trials from the paper against this code and checks every environment message and verdict (xiangqibench.replay). Known differences from the code that produced the paper's archive are listed in the changelog.

pip install -e ".[dev]" && pytest

Citation

@article{xiangqibench2026,
  title   = {Finding the Move Is Not Winning the Game: {XiangqiBench} for Closed-Loop
             Evaluation of {LLM} Agents},
  author  = {XiangqiBench authors},
  year    = {2026},
  url     = {https://github.com/floatai/xiangqibench}
}

License

The code is released under the MIT License. The historical positions are in the public domain. Pikafish is licensed under GPL-3.0; it is not distributed with this package and runs as a separate process.

Metadata

Release files for xiangqibench 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xiangqibench 0.1.0
File Size Uploaded
xiangqibench-0.1.0.tar.gz 178.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xiangqibench 0.1.0
File Interpreter ABI Platform
xiangqibench-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 256.7 kB

Release files / xiangqibench-0.1.0.tar.gz

Download URL xiangqibench-0.1.0.tar.gz
Size 178.1 kB
Tags Source
SHA-256 checksum
How to use checksums
79efd4d193ae45697aa713de0fc87e9e0ceb02f308986b07c0db87c445a857b1
BLAKE2b-256 checksum
How to use checksums
1d7cd0e214dbf0f7fd2552c8a28da3e2ea00120f82e9a125fd34839b651d1660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / xiangqibench-0.1.0-py3-none-any.whl

Download URL xiangqibench-0.1.0-py3-none-any.whl
Size 78.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45bee45694f8fdb9ab0d18327f11a456ecfebbb576b67405305f070f9a706a2e
BLAKE2b-256 checksum
How to use checksums
49134f4b5eff085a0d96f2fe77c8ac4454672c22a949cdbda7ade5b40c70f4fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page