# KEYRING

> Build a board from scratch, ranking each next piece by three signals learned from past strong boards. Reached 460 in a board family no earlier search had cracked.

- Canonical page (with interactive figures/demos): https://eternity2.dev/research/lab/experiments/raphael-anjou/learning/keyring/
- Updated: 2026-07-21
- Topics: construction, learning
- Reproduce: `just research-record-boards`
- Source: Beam search as bounded-width best-first construction (this project's concept page) — https://github.com/raphael-anjou/eternity2/blob/main/web/content/research/build/construct/beam-search.mdx

---
[PRIOR](/research/lab/experiments/raphael-anjou/learning/prior) trusted one
learned signal, a position count, to break its ties. KEYRING is the next step in
the [study](/research/lab/experiments/raphael-anjou/learning): what if one signal
is not enough? Building a board one piece at a time, the hard part is deciding
which piece to place next when several would fit, and a single rule of thumb, even
a learned one, tends to march the search into the same dead ends every time.
KEYRING carries three different learned hunches at once, a keyring of them, and
lets them vote, which keeps the search from over-trusting any one signal.

## How it works

From the library of strong boards, KEYRING learns three things. First, where
each piece likes to sit: how often a piece appears in each position across
good boards. Second, which pieces like to be neighbours: how often two pieces
end up touching. Third, which little 2×2 patches show up in good boards
versus bad ones.

It then fills the board with a beam search, keeping many partial boards alive
at once. When it has to choose the next piece, it scores each option by how
many edges it matches, nudged by the three learned signals together. A small
amount of randomness keeps the many parallel attempts from collapsing onto
the same path.

> **[Figure]** Interactive: the three-signal placement vote — interactive: KeyringDiagram. Rendered on the canonical page (link above); not shown in this markdown export.

## The board
> **[Interactive: RecordBoard]** Rendered on the canonical page (link above); not shown in this markdown export.
## The result

KEYRING reached 460 of 480, and did it in a corner arrangement where no board
had reached that level before, so it's not just another route to a known
board but a genuinely new region. Across repeated runs it landed a strong
board far more often than the simpler single-signal version it grew out of.

It is not the project's top score (that's 463), but finding a high board in a
fresh family matters: the strong boards are known to be isolated from each
other, so each new family is its own foothold.

## Method

The three signals, made precise, then how they steer the beam.

The strongest of the three is the **2×2 patch prior**. Over the corpus, split
boards into *high* (score ≥ 460) and *low* (< 460), and for every 2×2 patch $q$
(four pieces with their rotations) score it by a Laplace-smoothed log-odds
ratio:

$$
\text{score}(q) = \log\big(\text{count}_\text{high}(q) + \alpha\big) - \log\big(\text{count}_\text{low}(q) + \alpha\big), \quad \alpha = 0.5
$$

A patch that shows up in strong boards and not weak ones scores positive; a
consensus-trap patch scores negative. (In the run that found the 460, the
corpus split 23 high boards against 1255 low.) The other two signals are
simpler counts: a **piece-in-position** frequency and a **piece-pair
adjacency** frequency, each tallied over the same strong-board set.

The build is a **beam search**: keep $W$ partial boards alive, and at each step
extend every beam by scoring each candidate placement as its matched-edge gain
plus a weighted sum of the three priors, then keep the top $W$. A little
injected randomness stops the $W$ beams from collapsing onto one path, which
is what let KEYRING reach a *new* corner family rather than re-deriving a known
board. Patches pack into a `u64` key (piece ≤ 8 bits, rotation 2 bits, ×4
cells = 40 bits) so the prior lookup is a hash hit.

As with [PRIOR](/research/lab/experiments/raphael-anjou/learning/prior), the beam
build reaches the high 450s on its own; the committed 460 board takes that
construction and a local-refinement tail on top, the same construct-then-refine
split the record pipelines use. The three signals are what carry the *construction*
into a fresh family; the last few edges are the refinement's.

One limit worth stating: the priors are learned from a corpus that is itself
sub-perfect, so they encode the community's ceiling as much as its wisdom:
the same double edge that [PALIMPSEST](/research/lab/experiments/raphael-anjou/learning/palimpsest)
turns into a feature by separating good consensus from traps.

## Reproduce

`just research-record-boards` verifies the committed 460 board's score
byte-for-byte from its stored Bucas string. The search is stochastic (beam
search with injected randomness), so a re-run will not reproduce the same board;
the board is the artifact of record. The engine is the shared beam
producer; the change
this page describes is the three learned ranking signals. Those signals are
mined from a corpus of strong boards, so the run is not reproduced from scratch
here.

## Open questions

Would grading the patch signal by degree, rather than treating patches as
simply good or bad, help further? Could the weights on the three signals
shift as the board fills, trusting structure more late in the build? And can
this new family be pushed past 460 with a longer refinement?

## Related

- [Learned move-ordering](https://eternity2.dev/research/build/learning/learned-value-ordering) — When several pieces fit, which do you place next? Instead of one rule of thumb, carry several signals learned from strong boards and let them vote. Voting keeps the search from over-trusting any one hunch and marching into the same dead end.
- [Learning from strong boards](https://eternity2.dev/research/lab/experiments/raphael-anjou/learning) — A study in five experiments of one idea: instead of searching Eternity II from first principles, mine the corpus of strong boards already found for structure and feed it back into a search. A position prior, a learned move-vote, a scarce-demand compass, an anti-pattern miner, and a record decode, ordered from the simplest signal to the subtlest, and the one wall all five reach.
- [PRIOR](https://eternity2.dev/research/lab/experiments/raphael-anjou/learning/prior) — Build a board from nothing, breaking ties by where pieces tend to sit in the strong boards we already have. It reaches a high score with no starting board to copy.
- [Why basin-hopping looks impossible](https://eternity2.dev/research/why/sigma-cycles) — If you can't improve a great board by polishing it, maybe you can jump to a different great board. On every record pair tested, you can't, and the structural reason why is worth seeing.
- [Forbidden patterns](https://eternity2.dev/research/why/forbidden-patterns) — Almost every small patch of pieces you could build is impossible. For a 2×2 square, 99.72% of the ways to place four pieces can never be made to match.
- [Beam search](https://eternity2.dev/research/build/construct/beam-search) — Keep the K most promising partial boards alive at once and grow them cell by cell. Beam search is the workhorse behind this project's from-scratch builders, and a clean illustration of why breadth alone stalls in the deep interior.
