Repository navigation
Conversation
ale18V
force-pushed
the
feat/train-models-in-web-worker
branch
from
October 14, 2026 11:31
8f97532 to
377c8eb
Compare
ale18V
force-pushed
the
feat/train-models-in-web-worker
branch
from
October 14, 2026 11:31
377c8eb to
182a6bb
Compare
This branch has not been deployed
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.
What & why
Training currently runs on the browser's main thread and can freeze the UI for large models. This moves model training into a Web Worker for local, federated, and decentralized sessions. For decentralized training, WebRTC remains on the page and the worker exchanges serialized model weights with the page at round boundaries. Image loading now works in a worker, and training progress and stop controls continue to update the dashboard. The dashboard regression test retains real Titanic CSV training, computed accuracy, and savable-model checks through the production worker entry, and caught a Vue proxy that could not be cloned into the worker.
Technical plan
The dashboard streams dataset samples to the worker and receives progress and the final model. A client bridge forwards decentralized connection, synchronization, and weight exchange requests to the page. Encoded weights use transferable buffers between threads. A local Chromium integration run against the real signaling server passed with two isolated browser contexts, four decentralized rounds per peer, and both trained models saved. A separate synthetic CPU benchmark of two 64 MiB weight sets measured median main-thread encoding, decoding, and averaging times of 14.6 ms, 23.1 ms, and 637.4 ms respectively (three runs); no main-thread long tasks were observed during the small Titanic training session.
Deviations from plan
None.
Todo
Move decentralized aggregation and large-weight serialization off the main thread to address the measured stalls. A WASM experiment reduced 64 MiB averaging to a median 36.7 ms, but the complete encode/decode/average sequence still took 150.2 ms; this backend change is not included in the PR. The existing full LUS COVID test configuration is restored, but its CPU fallback run did not complete: after more than five minutes it was still on the first training batch, so that validation remains unresolved.