Reinforcement learning
Your first RL project
Explore Territory Playground, compare learned policies with programmed bots and evaluate a compatible checkpoint in a live browser arena.
Read article →DISTRIBUTED NEURAL TRAINING
Build web AI applications with browser-based distributed neural network training. Weei AI lets you train and test compact neural networks across participants’ browsers using CPU or GPU. Create models for sticky notes, next word prediction, shape recognition, text classification, sentiment analysis, keyword extraction, handwriting and gesture recognition, anomaly detection, and simple game agents. Train models on datasets or generated experience, review training results, and export checkpoints for your web application.
Dataset and experience models are supported. View training requirements →
Your peer ID: unavailable
Participants in this room update automatically. Create a coordinator job before inviting them to train. Room membership and training participation are separate.
No model inspected.
Connect to read this device’s execution settings.
These settings apply to this browser. Actual execution and worker capacity depend on the model and device. Other participants configure their own devices.
Commands are validated by Weei. If an action is not allowed for your role or the current job state, its error appears above.
No pending invitation.
Connected peers and invitations update automatically. Review the invitation before accepting.
Current speed: last 5 seconds of training. Average speed: processed examples / training time, excluding transfers and waiting. Timings belong to the displayed assignment. Stale snapshots must not be compared as live measurements.
Connect to receive the current state.
Progress, participant state, transfers, and results update from the public API subscription.
Open in Playground fills the model and selected checkpoint in the Playground section. GPU files and validation data are included only when selected above; an external tokenizer must be selected in Playground. Download any newer checkpoints you want to retain before restoring an earlier round.
No jobs requested.
DOCUMENTATION
Dataset and experience models are supported. Choose the model’s work source to see what you need before starting.
The model learns from files you provide. Participants train on dataset chunks; the coordinator combines their weight updates after each round.
Use this path for learning from prepared examples, such as supervised or self-supervised tasks, when implemented by your model. The WASM defines the architecture, input format, loss and local optimizer. Weei distributes the work; it does not convert Python, PyTorch or ONNX models into compatible modules.
| File | Requirement |
|---|---|
| Model .wasm | A trusted module implementing Weei WASM ABI 1, including model metadata, initial weights and training operations. |
| Manifest .json | A dataset chunk array, or the model package’s manifest.json. Each chunk must declare id, fileName, bytes, sha256, format and exampleCount. |
| Dataset chunks | Every named file, readable independently by the model. Names, byte sizes and SHA-256 hashes must match the manifest. Respect the model’s supported formats and chunk/example limits. |
| Validation file — optional | Separate held-out data. The model must support evaluation. For a package, match its validation file name, size and SHA-256; for a plain chunk list, stay within maxChunkBytes. The file remains on the coordinator. |
| WGSL archive — optional | The matching model package’s shader archive for supported GPU training. WASM is still required. Without the archive, training uses CPU. |
[{
"id": "chunk-001",
"fileName": "training-001.bin",
"bytes": 4096,
"sha256": "REPLACE_WITH_ACTUAL_SHA256",
"format": "MODEL_DEFINED_FORMAT",
"exampleCount": 128
}]Replace the example values with actual file metadata. The model determines what one example means and how its data is encoded.
Set Learning rate only when the model declares it in trainingParameters. The value must be greater than the model’s exclusiveMinimum and at most its maximum, within Weei’s global range of greater than 0 and at most 1. Leave it empty to use the model’s own default; Weei does not fill in that default.
The model generates training experience and updates its policy locally. Participants send back weights, metrics and counts; episodes, rewards and trajectories remain on their devices.
Classic reinforcement learning runs an environment inside the WASM model. Models can also use input records, such as prompts, and frozen reference, reward or opponent weights. Methods such as REINFORCE, GRPO, RLHF or self-play require a model that implements them; selecting an experience job does not add an algorithm to the model.
| Item | Requirement |
|---|---|
| Model .wasm + manifest.json | An experience model and its weei-model-package manifest. A plain dataset array, including [], is not accepted. Package sizes, hashes, model identity and weight size must match. |
| workSource | kind: experience; declared inputs, work-unit id/label, and unitsPerAssignment default/minimum/maximum. The package and model metadata must agree. |
| inputs: none | No dataset chunks or validation file. The package’s dataset manifest is empty. The model generates its own experience. |
| inputs: dataset | All declared input chunks. The model must declare workPartitioning so records are not split between participants. |
| Auxiliary weights | Select every file-based slot with Training files; sizes and SHA-256 hashes must match. Initial/checkpoint source slots need no local file: Weei supplies the declared snapshot. These weights stay frozen. |
| WGSL archive — optional | For inputs: none only, a declared GPU backend and matching shader archive enable hybrid execution: WASM plays episodes and GPU updates the policy. Experience training over dataset inputs currently has no GPU support. |
| Generated evaluation | Requires capabilities.evaluation and positive workSource.evaluationUnits. Evaluation uses fixed episodes for comparison between rounds. |
Experience models follow the same trainingParameters contract: only a declared learningRate can be supplied. Leave the field empty for the model’s default. A supplied value must meet the model’s bounds and be greater than 0 and at most 1.
Training rounds is the final round number, including the saved rounds: continuing round 397 to 500 runs 103 more rounds. Resume restores the saved experience sequence; New starts a new sequence while keeping the weights. File-based auxiliary weights must match those recorded in the checkpoint.
DOCUMENTATION
Check execution, completed work and model quality separately.
For dataset jobs, supply validation data when creating the job. Experience models use generated evaluation when supported. Run validation on the latest checkpoint or an explicit round. Compare metrics on the same held-out dataset. Lower training loss alone does not establish quality on unseen examples.
Training and validation values appear in the checkpoint table and metric chart. The chart uses checkpoint rounds on the horizontal axis; metric direction comes from the model. Test the downloaded checkpoint in your model’s compatible inference tool.
| Problem | Action |
|---|---|
| Training API unavailable | Check site registration and widget access. The workspace cannot grant itself permission. |
| Files rejected | Check model compatibility, manifest entries, original file names, sizes, and checksums. |
| Job waits for a participant | Check that participant's connection. Use Retry or Stop participant as appropriate. |
| Checkpoint save fails | Check browser storage. Preserve important downloads and retry saving. |
| Validation fails | Check model evaluation support and the selected validation file. Read the returned error. |
Choose a checkpoint, compatible model, manifest, and data files. “New dataset” keeps the weights with a fresh queue. “Same dataset” restores the previous queue. Continuing creates a new job; invite participants again as needed.
Check the model’s declared reward or return metric and its direction; metric names are model-defined. Compare generated evaluation on fixed episodes across checkpoint rounds. Training metrics alone do not establish policy quality. Progress uses the model’s declared work units, and a checkpoint marks an aggregated round. Episodes and trajectories stay on participants; only weights, metrics and counts are exchanged.
Hover over How to use? in the navigation and click Play beside a saved demo. The site calls Recording Demos play(id); the built-in widget repeats actions in the live application. Start from the same page state as the original recording. A missing element stops playback with an error. Stop walkthrough ends playback.
The menu’s Record button is shown only after signing in with a CP administrator account. Hovering, focusing or clicking opens recording controls. Set a name, optionally enable camera and microphone, and start recording. Stop & save recording uploads it to the shared library. The list refreshes when opened. Only saved recordings of kind demo are listed; captured issues are excluded. Libraries are scoped to the exact origin, so recordings on localhost do not automatically appear in production.
LOCAL MODEL INFERENCE
Load a trained checkpoint, generate text, and evaluate model quality on this device.
Model execution stays on this device. Inference does not send files to Weei or training peers. Use only trusted model packages.
No checkpoint selected.
Select a compatible model and checkpoint.
No model loaded.
Uses the model's CPU evaluation operation. TBT5 grouped training and rolling validation use different conditioning; their losses are not identical objectives.
Top-k = 1 is greedy. Generation stops at EOS when the tokenizer declares it.
Training’s Open in Playground action fills the exported WASM and checkpoint. GPU files, an external tokenizer and validation data may still need manual selection. Checkpoint versions 1 and 2 are supported. Optimizer state is verified separately and is not used for inference.
Byte-level Tiny Byte Transformer and BPE Tiny Token Transformer / TBT4 / TBT5 text generation are supported. Other ABI-compatible models can be inspected and evaluated if they expose evaluate; arbitrary models do not automatically support text generation. GPU inference is limited to the verified TBT Transformer graph, independently of GPU training support.
Stop terminates the Worker, including a synchronous WASM evaluation. Reload the selected files afterward. Changing files takes effect only after Verify & load.
SOLUTIONS
Practical guides and projects for training AI with Weei.
Reinforcement learning
Explore Territory Playground, compare learned policies with programmed bots and evaluate a compatible checkpoint in a live browser arena.
Read article →Getting started · Dataset training
Turn an idea into a training experiment: collect examples, prepare a dataset, generate compatible model files with AI and run your first job in Weei.
Read article →REINFORCEMENT LEARNING · TERRITORY
Train a small agent, put it in a competitive environment and observe the decisions it makes. Territory Playground gives this experiment a visible outcome: neural networks and programmed bots compete for cells on a live board.
In reinforcement learning (RL), an agent learns a policy: how to choose an action from an observation. It acts in an environment, receives a reward and uses that experience to update its policy. The objective is to increase expected cumulative reward over time. A move with a small immediate benefit can be useful if it leads to a better outcome later.
For a territory game, observations can describe the board and nearby opponents; actions determine the next move. The reward is a separate design choice. Survival, expansion and winning are possible objectives, but the exact reward must be defined by the training model. A larger training return does not automatically mean a stronger agent against new opponents.
The live project runs autonomous agents in the browser. Each has a body made of cells and chooses one move per tick. Its included neural networks are small: the project describes 16 hidden neurons and approximately 250 weights. The agent list includes an untrained network, networks from different training rounds, and programmed bots. This makes it possible to compare learned behaviour with explicit strategies.
The board shows territories, a ranking of the largest agents and wins during the current session. Pause the match to inspect a position, change playback speed or start a new match. Select which agents participate in the next match to compare specific checkpoints and opponents.
| Rule | What changes |
|---|---|
| Split | When an ageing bridge cell disappears, the smaller disconnected territory is lost. Narrow connections become a liability. |
| Attack | An agent can take a neighbouring enemy cell when it has stronger local support. |
| Strikes | Agents accumulate charges and spend them on attacks that penetrate enemy territory. |
| Land | Cells visited by a moving body become owned land. There is no decay; opponents can take that land. |
These are environment variants, not guarantees that a checkpoint has been trained for every rule. Keep the rules fixed when comparing agents. The game identifies the last surviving agent as the winner and territory ownership as a goal.
.weei-checkpoint or raw float32 weights in .weights or .f32 format. Arbitrary model checkpoints are not interchangeable.Territory is the arena for running and comparing agents; Weei Workspace runs the training job. Opening the arena does not train a new network. The game also supports adding a JavaScript bot, which provides a useful baseline without training a policy.
Start with the controls already available: rules, opponent selection and checkpoint choice. For experiments that change how the agent learns, modify the model or environment and retrain:
Record the checkpoint round, rule set and opponents for each comparison. Choose a small experiment with an observable success criterion before increasing model size or distributing more work.
Project controls and file formats were checked against the current live version. Reward and architecture changes above are experiment ideas, not controls claimed to exist in the arena.
Territory Playground ↗ · Current live version ↗ · Weei RL API documentation ↗
GETTING STARTED · DATASET TRAINING
Start with a question you can test. Can a small network recognise a pattern, classify a measurement or predict a useful label? Define the input, the expected output and how you will measure success. Then build a small experiment before collecting more data or increasing the model size.
Weei runs a compatible WebAssembly model on participant devices. The coordinator creates the job, distributes assignments, combines returned weights and saves checkpoints. The model defines how inputs are decoded, how learning works and which metrics it reports. The workspace gives you controls for the job and a view of its progress.
You need both the model and its data. A CSV, a folder of images or a Python training script alone is not a runnable Weei training job. For a first experiment, use a small CPU model with a documented data reader and a held-out validation set. Reinforcement learning is another route: an experience model can generate its own data, as described in Your first RL project.
A dataset is a collection of examples. For supervised learning, an example pairs an input with a target: a measurement with a category, a message with a label, or a question with an expected answer. The examples should reflect the task you want the trained model to perform.
For example, a small point classifier might learn which of three regions contains a coordinate:
{"features":[0.12,0.81],"label":2}
{"features":[0.74,0.16],"label":0}
This JSONL layout is an example of a format you can implement in a model. It is not a universal Weei format. The model must explicitly read it and declare a matching format ID; another model may require binary records, token IDs or a different layout.
AI-generated examples can help test the pipeline or create a controlled synthetic task. Review their labels and variety. Good results on generated examples alone do not establish performance on real inputs.
| File | Purpose |
|---|---|
model.wasm | The executable model implementing Weei WASM ABI 1, including training and weight export. |
dataset-manifest.json | For the simple dataset route, a JSON array with one entry per training chunk: id, fileName, bytes, sha256, format and exampleCount. |
| Training chunks | All files named by the manifest, encoded for this model. Select these under Training files. |
| Validation data | Optional held-out examples. The model must support evaluation. Kept on the coordinator’s device. |
| Model package files | When using a package rather than a plain chunk list, select its manifest.json and every required auxiliary file. Optional GPU execution needs the matching shader archive. |
The example below requests the simpler CPU route: a WASM model, a plain dataset manifest, training chunks and validation data. It does not require a GPU archive or an initial checkpoint. Hashes and sizes must be calculated after the real files have been generated.
Use an assistant that can create files and run a compiler. Replace the sample task with your own once the first pipeline works. The request asks for actual artifacts and verification, rather than a description of a package.
Build a complete, reproducible CPU training example for Weei AI Training.
First read the current public documentation:
https://weei.io/documentation/widgets/distributed-training/
https://weei.io/documentation/get-started/
Use only documented contracts. If a required ABI detail is not specified,
identify the missing detail and ask for it; do not invent a signature.
Task: classify two-dimensional points into three regions with a small
trainable neural network. Use synthetic points with a fixed random seed
and an explicitly defined labelling rule. This is a pipeline demonstration.
Deliver the following as real files in one output directory:
1. model.wasm, compiled from the included source. Implement Weei WASM ABI 1:
memory, alloc, free, resultLength, getModelInfo, createInitialWeights,
loadModel, train, getUpdate and getMetrics, using the documented JSON
requests and responses. Add evaluate and declare evaluation support
according to the documentation. Do not depend on WASI or unsupported imports.
2. A documented JSONL data reader for records such as
{"features":[0.12,0.81],"label":2}. Choose a format ID and declare it in
getModelInfo.dataFormats. Implement actual parameter updates in train;
do not return constant metrics or unchanged weights as fake training.
3. 4,096 training examples in 16 independent chunks of 256 examples,
512 separate validation examples, and 512 separate test examples.
Generate unique examples with disjoint splits and the same schema.
4. dataset-manifest.json: a plain JSON array for TRAINING chunks only.
Every entry must contain id, fileName, bytes, sha256, format and
exampleCount. Calculate byte counts and lowercase SHA-256 hashes from
the final files; do not use placeholders. Respect the model's limits.
5. A held-out validation file supported by evaluate. Declare loss and
accuracy metrics with their correct minimize/maximize directions.
Count uniqueExamplesForFedAvg separately from repeated local passes.
6. Source code, pinned build instructions, a data-generation script,
and a verification script that checks all manifest entries, hashes,
byte sizes, record counts and split separation. Keep model metadata,
weight layout and float32-le weight serialization consistent.
7. A short file-selection map for the Weei UI: Model WASM, Dataset / model
package manifest, Training files, and Validation dataset. List training
settings supported by this model and a command to rebuild everything.
Use CPU execution and FedAvg for the first run. Do not add WGSL, invent a
package schema or rename a Python/ONNX file to .wasm. Training chunks
must be individually readable by the model. No test data in training.
Compile the module and run the artifact checks. Where possible, test
the documented ABI, demonstrate a real weight update and evaluate on
held-out data. Report exactly which checks passed. If a compiler or a
runtime check is unavailable, say so; do not call an untested bundle ready.
Provide the files as an archive if your environment supports it.
Review the generated sources and verification output. A manifest with plausible-looking hashes is not evidence that the files match. Successful compilation checks the module format; a short run in the workspace checks the integration.
A dataset pass covers all training chunks; a round is one assignment per active participant followed by aggregation. They are different counters. For final assessment, use the untouched test set with a compatible evaluator. Playground capabilities depend on the model: a point classifier does not automatically support text generation.
Keep the data, build settings and selected checkpoints together so you can repeat the experiment. Change one factor at a time and compare against the same baseline.
Model contract ↗ · Dataset manifest ↗ · Training requirements