File size: 4,561 Bytes
d51e608 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # Getting started with DaisyChain-Web
DaisyChain-Web trains a small transformer language model **peer-to-peer in the
browser**. Every device that opens the page becomes a training node: it
computes through the verified INT8 units (WebGPU, or the identical math on
CPU), exchanges gradients with the other devices over WebRTC, and all replicas
stay **bit-identical** β same weights, same loss, on every device, every step.
## The fastest way: the hosted Space
Open **https://huggingface.co/spaces/Quazim0t0/DaisyChain-Web** on two or more
devices. That's it β no install. Devices on the **same network** find each
other automatically (Snapdrop-style, grouped by public IP). To train with
devices on *different* networks, use a room code (below).
## Run it yourself
```bash
npm install
npm start # serves on http://localhost:8787
```
Open `http://localhost:8787` in two browser tabs to try it on one machine.
> **HTTPS matters.** WebGPU and cross-device WebRTC require a *secure
> context*: `localhost` or HTTPS. Plain `http://192.168.x.x` from another
> device will NOT get WebGPU (and may not connect at all). For real
> multi-device runs, serve over HTTPS β a tunnel (`cloudflared`, `ngrok`), a
> host, or a Hugging Face Space.
## Rooms: training across networks
Everyone opens the same URL with a shared code:
```
https://<host>/?room=MY-SECRET-CODE
```
The first person in the room is the **host** and must **approve each device**
before it can join (an Accept button appears per request). The room code is
never guessable from the public page; pick something private.
## Starting a run
1. Wait until the devices appear in each other's peer list.
2. On **one** device, pick the settings (that device's choices apply to the
whole group):
| Setting | Range | Default | What it does |
|---|---|---|---|
| Model width | 16β128 | 32 | embedding/channel width of the transformer |
| Sequence length | 16β128 | 32 | context window in tokens |
| Batch per device | 2β32 | 8 | each device adds this much batch β more devices = bigger effective batch |
| Steps | 100β10000 | 300 | training steps for the run |
| Learning rate Γ1000 | 5β50 | 10 | Adam learning rate (10 = 0.01) |
3. Press **Start training**. Every device begins the same run: the starter
broadcasts the config, everyone builds the same seeded weights, and the
loss falls in lockstep on all of them.
The **replica diff / weight hash** readout is the trust signal: every honest
device shows the same hash at the same step. Training data streams from
**FineWeb-Edu** (served by the Space from the HF CDN's parquet shards);
devices that can't reach it fall back to a built-in corpus.
Devices that join **mid-run** are synced in: the leader ships them the current
weights and step, and they participate from the next step.
## After training: generate, save, share
- **Generate** β type a prompt and sample from the trained model, right on the
page.
- **Download checkpoint (.pt)** β saves weights + step + config. **Load** it
later on any device; the loader validates the tokenizer and dimensions, and
loading on one device **broadcasts the checkpoint to the whole group**, so
one person can restore everyone after a failure.
- **Download inference kit** β a single self-contained HTML file with the
weights baked in. Open it anywhere, even offline, to run generations. Handy
for sharing what the group trained.
## Checking the math (no browser needed)
```bash
npm test
```
runs all ten verification suites β convergence, bit-identical replicas, the
IEEE-754 oracle, kernel gates, metamorphic properties, the external bug
corpus, the B2B chain, optimizer, transformer, and the int8 backward. Results
with methodology live in [TEST_RESULTS.md](../TEST_RESULTS.md).
## Safety notes
- WebRTC is direct: devices in a group can see each other's IP addresses.
- There is no gradient authentication β a malicious peer could poison the
model. Train with devices and people you trust. (Dishonest *math* is a
different story: a device whose kernel computes wrong values is caught by
the kernel probe and audits β see [VERIFICATION.md](VERIFICATION.md).)
- This is a proof of concept, not a hardened public service.
## More
- [ARCHITECTURE.md](ARCHITECTURE.md) β how the mesh, the training step, and
the wire protocol work.
- [VERIFICATION.md](VERIFICATION.md) β why you can trust the numbers.
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md) β common failure modes and what
the log messages mean.
|