Repository navigation
feat(semantic-emoji-filter): Laya in the browser — the web verifier on the Q8_0 lane - #45
Merged
Merged
Conversation
…on the Q8_0 lane - :webVerifier, a Kotlin/Wasm worker shipped under laya-worker/ with -PlayaVerifier=true: fetches the pinned checkpoint from Hugging Face into the Cache API on an explicit opt-in (System 2 chip, VerifierState.OptIn / Verifier.enable), installs the SIMD128 sidecar, and builds the agent with LayaWeightForms.q8_0For (about 340 MB packed instead of 1.3 GB FP32). - The verifier module gains a wasmJs target; LayaWebSource is the web checkpoint source, LayaVerifier and EmojiMatchSchema are shared with desktop and Android unchanged. - WorkerLayaVerifier on the page side and WorkerProtocol (shared) with request ids, so a verdict for an abandoned query is dropped; progress lines go straight to the page. - The grid scrolls to the top on every new ranking; it used to follow its first card's key. - CI compiles the worker and the app with the flag; webapp.json builds the site with it. Measured in headless Chromium: first load 146 s (download + quantize), cached 88 s; 5-7 s per decision on the simd128-mt sidecar; verdicts equal the FP32 desktop reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Laya in the browser: the SemanticEmojiFilter web build gets the second stage, on the engine's browser lane (SKEEP-007) — the "web verifier" step of the plan.
How it works
:webVerifier(Kotlin/Wasm executable, built with-PlayaVerifier=true); its raw compiler output ships underlaya-worker/next to the app and the page starts it as a module worker. The page's Kotlin/Wasm runs on the single JS thread and a decision is seconds of compute, so nothing of Laya runs on the page's thread.VerifierState.OptIn,Verifier.enable()); nothing downloads until the user taps. The worker fetches the pinned Hugging Face checkpoint through CORS into the browser's Cache API, so later visits read it from disk (643 MB read into memory in 2.7 s).LayaWebSource(verifier module,wasmJsMain) builds the agent with the commonLayaModelLoader.load(files, weights, …)andLayaWeightForms.q8_0For: about 340 MB of packed weights instead of 1.3 GB of FP32, served by the SIMD128 sidecar, which the worker installs first (simd128-mtinside the worker on the examples site, where the page is cross-origin isolated).LayaVerifier,EmojiMatchSchemaand the verdict cache are unchanged; only the checkpoint source differs. The page side (WorkerLayaVerifier) speaks a small string protocol (WorkerProtocolinshared) with request ids, so a verdict for a query the user has already left is dropped.wasmJstarget; thewebapp.jsonbuild command uses-PlayaVerifier=true, so the examples site ships it. CI compiles the worker and the app with the flag.Also fixed
Measured (headless Chromium on this laptop, served over http, cross-origin isolated)
simd128-mtsidecar. The matmuls are no longer the cost; what is left is the Kotlin-side eager path (attention, norms, dequantizing token rows). That is the engine's next step (SKEEP-007 PR 3: resident activations, banded SDPA), not the sample's.