Repository navigation
Laya router: the step-4 scorer in C++, routing each request to a device - #90
Conversation
…nd route requests per device
The non-autoregressive System 1 scorer (1bit-MONSTER src/laya_scorer.cpp on
backup/laya-and-results-2026-09-22) lands as laya/scorer.{h,cpp} +
laya/safetensors.{h,cpp} (Apache-2.0, zero Python at runtime): ModernBERT-large
encoder + RLCD head, weights via model.safetensors, tokens via npu::Tokenizer
(tokenizer.json). npu::Tokenizer gains token_id() and the Rust-tokenizers
ByteLevel regex so ModernBERT's tokenizer.json encodes digit runs correctly.
Gated against the Python reference on the pinned root and typed-decisions
checkpoints: tests/laya_gate.cpp compares raw logits (<= 1e-3), act logits
(<= 1e-3 rel), argmax (identical) and probabilities (<= 1e-4). Both pass.
Wired into the router: 1bit serve --laya-model routes each request by the
scorer (replacing the auto->vulkan hardcode) and lazily starts the chosen
device's backend; 1bit route prints the decision. tests/laya_route_e2e.sh
proves a request reaches the Laya-chosen backend.
… dirs, GPU backends for .gguf) route_device now takes a candidate device list. A .gguf routes among vulkan, hrx and zinc (NPU is never offered for a .gguf, so a request can no longer route to a device that cannot run it), and an NPU model directory routes to npu through the same path. 1bit route gains --devices. The e2e test now proves routing across more than one device (vulkan and zinc) plus the npu-only decision.
…ckend lines) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docs7 for 1bit-monster/engine
Commit |
PR Reviewer Guide 🔍(Review updated until commit ad47f86)Here are some key observations to aid the review process:
|
… for bit) One routing decision took about 15 s on one core of Strix Halo's 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preparing review... |
|
Persistent review updated to latest commit 6fc774b |
|
Persistent review updated to latest commit ad47f86 |
…to our fork (Loom NaN backport) (#320) * Bump HRX: llama.cpp 522dab4789ce (long-prompt fix), hrx-system to our fork 98d05d94a9f9 third_party/llama.cpp e57beb9721af -> 522dab4789ce (fork #89 runtime overhead, #90: graph inputs never written back to host — every multi-ubatch prompt was wrong since #82 — and the non-replay upload race). third_party/hrx-system moves from ROCm/hrx-system 51b1739ae5fd to our fork 1bit-MONSTER/hrx-system 1bit/main 98d05d94a9f9 = the same AMD commit plus the GFX11 wave64 lane-mask drain backport (#313 NaN) and two libhrx device knobs. bump-hrx.yml now moves only the llama.cpp pin; hrx-system is rebased by hand. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * registry: regenerated at llama.cpp 522dab4789ce Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
agent-b72a1b's Laya scorer work, brought onto current
main.What it adds
laya/scorer.{h,cpp}andlaya/safetensors.{h,cpp}: the non-autoregressive step-4 scorer (ModernBERT-large encoder + RLCD head) in C++. Weights load frommodel.safetensors, tokens come fromnpu::Tokenizer, and nothing runs in Python.npu::Tokenizer: gainstoken_id()and the ByteLevel regex, so ModernBERT'stokenizer.jsonencodes digit runs correctly.laya/route.{h,cpp}:route_device(scorer, state, devices), which answers the fixed routing question among the candidate devices.1bit route --laya-model DIR --state TEXT [--devices ...]: prints the scorer's decision.1bit serve --laya-model DIR(with--device auto):.ggufon (vulkan, hrx, zinc)npuas its only candidate.Merge notes: the work was based on a pre-#69
main. Itsserve.cpprewrite (Backend/backend_for) is re-applied on today'sLaunch/launch_forstructure, andlaunch_foris unchanged frommain. Laya mode:Launchper candidate device, and starts it lazily under a lockdrop_model/set_model--adaptive,--embedding/--reranking,--prefill-deviceand--lean.Tested on Strix Halo:
ctest8/8:laya_gate_rootandlaya_gate_typed_decisions: raw logits ≤ 1e-3, act logits ≤ 1e-3 relative, argmax identical, probabilities ≤ 1e-4 against the Python reference, on the pinned checkpoints.laya_route_e2e: a request reaches the Laya-chosen backend, across vulkan and zinc, plus the npu-only decision.smoke_serve,think_split,npu_*.🤖 Generated with Claude Code