RFC: Laya routes by request class, not by asking for a device #186
Unanswered
bong-water-water-bong
asked this question in
rfcs
Replies: 2 comments
|
Accepted by the maintainer (2026-09-28). Building it; the PR will link here. |
0 replies
|
Built and merged in #187. Answers to the open questions, measured: the typed-decisions checkpoint classifies best (95.5% vs 92.0% root, with long_doc decided by size); the confidence threshold is 0.16 (the least confident quarter is 84% right, the rest 98-100%); and it ships opt-in ( |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Lemonade's
onebitrecipe starts1bit serve --device autoby default, and--device autostill means "Vulkan" for every.gguf. The Laya router (step 4: #18, #90, #91, #93) only runs when someone passes--laya-model DIRby hand, and nothing in the packages or the recipe does that. So Laya is built and gated, but no real request goes through it.Asking Laya the routing question directly ("which device should run this request?") is not usable as a default. Measured 2026-09-28 on Strix Halo, pinned root checkpoint,
1bit route, eight requests (code, "hi", a translation, a contract summary, a B-tree explanation, arithmetic, a large refactor, a haiku):vulkan,hrx,zinczinc8 of 8npu,hrx,vulkan,zincnpu4,zinc4The picks do not follow the request, and they can't: the model has no knowledge of this hardware. ZINC runs 64 architectures and is not the fastest device on this box for most of them. Each decision also costs 0.38 s before the first token.
Design
Laya answers questions about the request, which it is trained for. A measured policy picks the device and settings. Proposed:
laya/routeasks typed questions whose answers are properties of the request: task kind (code, prose chat, short answer, long-document work) and whether it needs a long context. The answers come with Laya's calibrated confidence; below a threshold the request falls back to the default route.config/route-policy.jsonmaps (task kind, model family) to a device and serve settings, filled only from measured results in the docs. For example, Qwen3.8-27B: code and prose go to Vulkan with the DFlash2 drafter (45.7 / 28.3 tok/s against 31.7 / 25.8 with MTP, docs/serve.md), and short answers go to Vulkan with MTP (28.2 against 17.8). A model with no rows keeps today's route. Embedding and reranking models never go through Laya.servecaches the class per conversation (the leading messages' hash), so the decision cost is paid once, not on every turn.--device autouses Laya when a checkpoint is found (--laya-model, else$ONEBIT_LAYA_MODEL, else~/.local/share/1bit/laya), and Vulkan otherwise, as today.--no-layaturns it off.scripts/fetch-laya.shinstalls the pinned checkpoint to that path.Files:
laya/route.{h,cpp},app/serve.cpp,config/route-policy.json,docs/laya.md,docs/serve.md,scripts/fetch-laya.sh, packaging.Alternatives
--laya-modelbehaviour). The table above shows why not.How it will be checked
tests/laya_route_cases.json. Report accuracy and confidence calibration of the typed answers against the labels, on the pinned checkpoint.tests/laya_route_e2e.shextended, with requests of each class reaching the backend the policy names (fake backends).serve_e2e; low confidence means the default route.Dependencies, licences and security
No new dependency: Laya (Apache-2.0) and its checkpoint pin are already in NOTICE and
config/laya.json. No network exposure, secrets or workflow changes. The checkpoint (842 MB for the root checkpoint) is installed byfetch-laya.sh, not bundled in the package.Open questions
typed-decisions/checkpoint answers them better than the root checkpoint.--laya auto) first.All reactions