Add uncertainty weighting to dag-preview#2412
Conversation
Node and LowNode must stay below cache line sizes to avoid CPU performance problems. This requires careful planning what values are stored. N can be replaced with W to save memory. This makes a small change which nodes are visitsed which tested as an improved.
There was a problem hiding this comment.
Pull request overview
This PR extends the dag-preview (dag_classic) search to support uncertainty-weighted updates by introducing an additional NN output (e) and propagating it through neural backends, caching, ONNX conversion, and the DAG search’s backup/update logic (including replacing integer visit-count semantics with floating “weight” semantics in key places).
Changes:
- Add a new
efield to NN evaluation results and plumb it through backend interfaces, memcache, CUDA/ONNX backends, and ONNX conversion/proto metadata. - Introduce uncertainty-weighting search parameters for dag_classic and apply the weighting transform during NN result fetch.
- Replace/augment visit-count logic in dag_classic nodes with a floating “weight” (
weight_) and update selection/backup/bounds code to use weight-based values.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/search/dag_classic/search.h | Update function signatures to use weight-based “fix” parameters instead of integer visit counts. |
| src/search/dag_classic/search.cc | Apply uncertainty-weighting transform to NN e; switch several visit-count computations/prints to float weight semantics; propagate weight through backup/bounds logic. |
| src/search/dag_classic/params.h | Replace alias with a dag_classic SearchParams subclass exposing uncertainty-weighting options. |
| src/search/dag_classic/params.cc | Define UCI/CLI options and defaults for uncertainty weighting and implement SearchParams. |
| src/search/dag_classic/node.h | Add Eval::e, introduce weight_ for Node/LowNode, and convert several N-related APIs to float/weight-based forms. |
| src/search/dag_classic/node.cc | Implement weight-based score updates and adjust debug/dot output to display weight as N. |
| src/neural/wrapper.cc | Copy e from NetworkComputation into EvalResultPtr during evaluation. |
| src/neural/onnx/converter.h | Add ONNX output name for error head and a selectable error_head. |
| src/neural/onnx/converter.cc | Refactor value-head building and optionally emit an error-head output (/output/error) with sigmoid. |
| src/neural/network.h | Add virtual GetEVal() API (default 0) for network computations. |
| src/neural/memcache.cc | Cache and restore the new e value alongside q/d/m/p. |
| src/neural/backends/onnx/network_onnx.cc | Detect optional output_err, store its head index, and expose GetEVal() from ONNX outputs. |
| src/neural/backends/cuda/network_cudnn.cc | Update InputsOutputs construction signature (currently hardcoded wdl_err=false). |
| src/neural/backends/cuda/network_cuda.cc | Add CUDA support for optional value-error head, including allocation, eval, download, and GetEVal(). |
| src/neural/backends/cuda/layers.h | Extend ValueHead to optionally load/run error-head weights. |
| src/neural/backends/cuda/layers.cc | Implement optional error-head dense path and sigmoid output for ValueHead. |
| src/neural/backends/cuda/inputs_outputs.h | Allocate buffers/events for error-head output when enabled. |
| src/neural/backend.h | Extend EvalResultPtr/EvalResult to include e. |
| src/neural/backend.cc | Pass &result.e into computations in batch evaluation. |
| proto/net.proto | Add output_err to OnnxModel metadata. |
| meson.build | Ensure new dag_classic params.cc is compiled when dag_classic is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is @daniel-monroe's uncertainty weighting with a few changes. The most important change is replacing visit count ( The minor search focus change tested as a positive change using many different time controls and search parameters: This branch backports changes from TCEC branch. I was trying to merge this for FRD event but there was issues getting it work before deadline. Validation test for this branch is scheduled after 907 completes: I'm still going to run a test if logistic function would improve the error output conversion formula. Tune is scheduled after 907 completes: |
No description provided.