PreRankModel

dicechess.engine.search.PreRankModel
See thePreRankModel companion object
final case class PreRankModel(modelPath: String, extractFeatures: (GameState, Color) => Array[Float], chunkSize: Int = ..., contract: Option[ModelManifest] = ...)

A model whose only job is to order the mover's legal turns, so the search expands the best ExpectimaxConfig.candidateLimit of them rather than the best the material proxy could find.

It gets its own session on purpose. Ordering candidates and valuing positions are different jobs: a ranker is trained on which turn is better, a value model on how good a position is, and the two have different targets, can use different feature schemas, and are not interchangeable just because both emit one number per row. Reusing the leaf model for ranking is the cheaper option this repository already offers — preRankWithModel — and the two are alternatives, not a pair.

What bounds its cost is the feature schema, not this type. Pre-ranking sees every legal turn, which in Dice Chess is routinely hundreds and can be thousands; at that width material-7-v1 is a thousand cheap rows while kcp-13 is a thousand 216-outcome capture-probability searches, which is not viable at this seam at all. The pre-rank pass is also paid in full before the deadline is consulted — it has to be, since its output is what the anytime fallback plays — so a schema too expensive for the position's candidate count overruns the move budget before the search proper begins.

Value parameters

chunkSize

rows per session run, forwarded to OnnxEvalSearch.onnxEvalBatchChunked. A bound, not a tuned value: it keeps one [rows × F] tensor from growing with the position's branching, and the throughput-optimal value depends on the model and belongs in the host's configuration.

extractFeatures

this model's own feature extractor

modelPath

path to the pre-ranking model, independent of the main model

Attributes

Companion
object
Source
OnnxExpectimaxSearch.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product