Quazim0t0 commited on
Commit
d51e608
Β·
verified Β·
1 Parent(s): 1a34a53

Upload web/docs/GETTING_STARTED.md with huggingface_hub

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