publish guide/: the operating manual distilled from 54 failure records, for future agent sessions
Browse files- guide/01-before-you-start.md +93 -0
- guide/02-data.md +98 -0
- guide/03-preflight.md +119 -0
- guide/04-the-run.md +121 -0
- guide/05-publish-and-evaluate.md +92 -0
- guide/06-checklists.md +133 -0
- guide/07-platform-notes.md +78 -0
- guide/README.md +38 -0
guide/01-before-you-start.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 01 β Before you start
|
| 2 |
+
|
| 3 |
+
Nothing in this phase costs GPU. It costs an afternoon, and it is the phase that decides whether the run finishes.
|
| 4 |
+
|
| 5 |
+
## 1. Write the constitution first, then freeze it
|
| 6 |
+
|
| 7 |
+
One file, checked into the repo, that a future session cannot edit but must obey. It holds:
|
| 8 |
+
|
| 9 |
+
- **The deliverable.** Params, tokens, benchmarks, where it is published. Numbers, not adjectives.
|
| 10 |
+
- **Ranges, not points.** "90β110M params, 900Mβ1.1B tokens" β so a decision inside the range is a
|
| 11 |
+
choice, not a violation, and a decision outside one is loud.
|
| 12 |
+
- **The budget, in billed units.** Hours per week, when the week resets, what a test costs, what the run costs.
|
| 13 |
+
- **The prohibitions.** The short list you will be tempted to break at 3 a.m.
|
| 14 |
+
- **The phases and their gates**, where *a gate is passed only with written evidence in a file*, never with confidence.
|
| 15 |
+
|
| 16 |
+
Freeze the constitution before you have a stake in the outcome. Later you will want to change a rule because a
|
| 17 |
+
measurement inconveniences you, and that is the moment the frozen rule earns its keep.
|
| 18 |
+
|
| 19 |
+
## 2. Fix in writing, before the first GPU minute
|
| 20 |
+
|
| 21 |
+
Each of these is cheap to decide now and impossible to decide neutrally later:
|
| 22 |
+
|
| 23 |
+
| Settle now | Why it must be pre-declared |
|
| 24 |
+
|---|---|
|
| 25 |
+
| Architecture + hyperparameters | So a mid-run loss spike cannot be "fixed" by changing them |
|
| 26 |
+
| Token total and step count | So "done" is arithmetic, not a feeling |
|
| 27 |
+
| Which eval split each benchmark uses, and its metric | So you cannot pick the flattering combination afterwards |
|
| 28 |
+
| Expected score bands per task, with a source | So the report is a comparison, not a reveal |
|
| 29 |
+
| What counts as a passed gate | So you cannot pass a gate by redefining it |
|
| 30 |
+
| The kill rule: what you may change mid-run and what you may not | So plumbing fixes don't quietly become new experiments |
|
| 31 |
+
|
| 32 |
+
The distinction that survives contact with a failing run: **parameters that touch the loss landscape are frozen;
|
| 33 |
+
plumbing is fair game.** Storage cadence, resume logic, logging, device placement β change freely. LR, batch,
|
| 34 |
+
seq length, optimizer, data β never, once checkpoint 1 exists. Write that sentence down; you will need it.
|
| 35 |
+
|
| 36 |
+
## 3. Memory files are the real state
|
| 37 |
+
|
| 38 |
+
A future session is not you. It has no conversation, no intent, and no reason to believe you. Give it files,
|
| 39 |
+
and make the files the authority:
|
| 40 |
+
|
| 41 |
+
- `STATE.md` β live board, **rewritten not appended**, under ~80 lines: current phase, key numbers, next 3
|
| 42 |
+
concrete actions, blockers, timestamp. Read first, every wake.
|
| 43 |
+
- `LOG.md` β one β€15-line block per session, newest at top. What was attempted, what ran, what changed remotely, result.
|
| 44 |
+
- `DECISIONS.md` β numbered records: context, options, choice, justification, evidence link. **Never rewritten** β
|
| 45 |
+
you add a newer number that supersedes it. This is what stops the fifth session re-litigating the first.
|
| 46 |
+
- `ERRORS.md` β every failure worth remembering: symptom, root cause, fix, how to avoid rediscovering it.
|
| 47 |
+
Read before debugging anything you have seen before. Also log *the same failure recurring after its fix* β
|
| 48 |
+
that is a signal your fix was wrong, and it is otherwise invisible.
|
| 49 |
+
- `QUOTA.md` β the spend ledger: date, activity, hours used, hours remaining, cumulative against the cap.
|
| 50 |
+
Written **before** launching a GPU job, not after.
|
| 51 |
+
- `ASSETS.md` β the answer to "where is my artifact": repo + revision, shard and token counts, checkpoint
|
| 52 |
+
steps with size and verified/pruned status, tokenizer identity, pinned commit shas.
|
| 53 |
+
|
| 54 |
+
Rules that make these work:
|
| 55 |
+
|
| 56 |
+
1. **Verify before acting on a note.** A memory that names a file, function, or checkpoint is a claim about the
|
| 57 |
+
past. Check it still exists. Files and repos describe the present; when they disagree, the platform wins and
|
| 58 |
+
the note gets corrected β not the other way round.
|
| 59 |
+
2. **No prose that a table can carry.** Cheap to read is the only property that keeps a status board current.
|
| 60 |
+
3. **Every session ends by parking**: work committed, checkpoints verified remotely and pruned locally,
|
| 61 |
+
`STATE.md` rewritten with the next 3 actions, `LOG.md` appended, quota and assets updated, no orphaned jobs.
|
| 62 |
+
A session that skips this donates a morning to its successor.
|
| 63 |
+
|
| 64 |
+
## 4. Credentials
|
| 65 |
+
|
| 66 |
+
One rule: **the token never reaches a public artefact** β not a pushed file, not a job log, not a model card,
|
| 67 |
+
not a kernel source revision.
|
| 68 |
+
|
| 69 |
+
- Put the secret in a *private* repo the job reads at run time through one function every job calls (D-006).
|
| 70 |
+
Rejected alternatives, and why: the token in a job's source puts a credential in every revision the platform
|
| 71 |
+
keeps and in anything that mirrors job source; the token in a typed-in constant breaks idempotent relaunch.
|
| 72 |
+
- **Prove the store is private with two different calls** (`E-011`). An anonymous read that fails with 403/404
|
| 73 |
+
does **not** mean "private" β it also means "never created". The near-miss here was a privacy check returning
|
| 74 |
+
`private_confirmed: true` for a dataset that did not exist, one step before uploading the token to it. Confirm
|
| 75 |
+
existence with an authenticated listing *and* absence of public read with an anonymous fetch, and treat the
|
| 76 |
+
two as one inseparable check.
|
| 77 |
+
- **Grep the whole workspace you are about to mirror, not just the code.** The live token was sitting in the
|
| 78 |
+
*constitution* β a file that convention copies into the public code repo, because it's in the tree and reads
|
| 79 |
+
like documentation. `upload_folder` / `allow_patterns="*"` is one call away from publishing it. Exclude it
|
| 80 |
+
deliberately, by name, and keep the exclusion list next to the upload command.
|
| 81 |
+
- Never print it; never let a library echo the environment it came from. Any code path that reads it must also
|
| 82 |
+
run anonymously, so "clean room" is a mode you can prove rather than assert (`05` Β§2 β and note that
|
| 83 |
+
`token=False` does not undo a token already sitting in `HF_TOKEN`).
|
| 84 |
+
|
| 85 |
+
## 5. Learn the platform by probing it, not by reading about it
|
| 86 |
+
|
| 87 |
+
Before the design is final, run one throwaway CPU job and one throwaway GPU job end to end: author, submit,
|
| 88 |
+
watch it queue, read its logs, fetch its artifacts. Record the mechanics you will depend on later β timeouts,
|
| 89 |
+
whether a job has internet, how installs behave, where logs and outputs land, how quota is reported, when the
|
| 90 |
+
week resets, whether logs exist before completion. A GPU path is unproven until a tiny GPU job has *completed*.
|
| 91 |
+
|
| 92 |
+
Most of these are undocumented, badly documented, or version-specific. Find out empirically and write the answer
|
| 93 |
+
in `07-platform-notes.md` style numbers, not vibes. See `03` for why the cheapest possible probe is the one you run first.
|
guide/02-data.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 02 β Data
|
| 2 |
+
|
| 3 |
+
The mix is the part you cannot re-run cheaply after training starts. Build it once, publish it reproducibly,
|
| 4 |
+
and prove it is clean before a single GPU second is spent on it.
|
| 5 |
+
|
| 6 |
+
## 1. Design for abilities, not for items
|
| 7 |
+
|
| 8 |
+
<sub>Sources: Phase 1 of the constitution Β· D-009</sub>
|
| 9 |
+
|
| 10 |
+
Decide what the finished model must do β commonsense and physical inference, science QA, breadth of factual
|
| 11 |
+
knowledge, factuality, arithmetic, multi-step reasoning β then reason from *what kinds of text build those
|
| 12 |
+
abilities* to proportions. Write a rationale per source, citing the corpus property you relied on.
|
| 13 |
+
|
| 14 |
+
**The line that keeps this honest:** proportions justified by corpus properties are legitimate; proportions
|
| 15 |
+
justified by looking at evaluation questions are contamination. If a source's justification reads like a
|
| 16 |
+
benchmark name, that's the tell.
|
| 17 |
+
|
| 18 |
+
- Prefer few large, well-attributed sources over many small scraped ones. Every source is a maintenance cost
|
| 19 |
+
and a contamination surface.
|
| 20 |
+
- Check what a source's maintainers *already* exclude. Some curated math sets decontaminate against **test**
|
| 21 |
+
splits only β which silently leaves validation in your train data if you don't look.
|
| 22 |
+
- Question every modality you are told to include. This project's constitution said "general English plus math
|
| 23 |
+
and code", and code was **dropped** (D-009): the corpus exposed whole-repository rows behind a nested struct,
|
| 24 |
+
honest per-file token accounting was a subproject, and at 100M parameters with GSM8K being word problems,
|
| 25 |
+
those tokens bought more elsewhere. An instruction in a plan is not a measurement.
|
| 26 |
+
|
| 27 |
+
## 2. Size the mix with headroom, then let dedup eat it
|
| 28 |
+
|
| 29 |
+
Target `N` tokens in the *final* mix; assemble **1.1β1.25Γ** that, because dedup, exclusion masks and the
|
| 30 |
+
held-out split all subtract and you cannot top up after publication. Reserve validation (~2 %) *before*
|
| 31 |
+
sharding, with the same tokenizer, and keep it out of every training shard.
|
| 32 |
+
|
| 33 |
+
## 3. Tokenise once, pack, shard for exact positional resumption
|
| 34 |
+
|
| 35 |
+
Emit raw `uint16`/`uint32` token arrays per shard plus a manifest.
|
| 36 |
+
|
| 37 |
+
| Decision | What this project chose | Why, and the alternative |
|
| 38 |
+
|---|---|---|
|
| 39 |
+
| Document boundaries | **Contiguous packing, no separator token, no block-diagonal mask** (D-008) | The seam cost was *measured* at ~0.16 % of windows before it was accepted. A separator plus attention mask is the textbook answer and costs throughput; the wrong move is to pick either without measuring the seam rate. |
|
| 40 |
+
| Sample length | Fixed multiple of `seq_len`; tail dropped | **Record the dropped count** β it belongs in the reproducibility proof. |
|
| 41 |
+
| Shard size | Small enough that a job reads a few at a time | Select shards by step range and stream. A training job must never materialise the whole mix on an instance disk. |
|
| 42 |
+
|
| 43 |
+
## 4. Exact positional resumption is a data-structure problem, not a state problem
|
| 44 |
+
|
| 45 |
+
`sample k` must be a pure function of `(dataset fingerprint, shuffle_seed, k)`.
|
| 46 |
+
|
| 47 |
+
| Layout | Verdict |
|
| 48 |
+
|---|---|
|
| 49 |
+
| Shuffle the *list* of samples with a recorded seed; persist `samples_consumed` | **Works** β recompute everything else |
|
| 50 |
+
| Shard-major, offset-major traversal; cursor = `(shard, offset)` | **Works** |
|
| 51 |
+
| Anything relying on Python iteration order, an open file handle, unsaved `DataLoader` worker state, or *the set of files on disk at the time* | **Fails** β and fails quietly, which is worse |
|
| 52 |
+
|
| 53 |
+
Persist in the checkpoint, all of them: `seq_len`, `samples_consumed`, `shuffle_seed`, `shuffle_perm_sha`,
|
| 54 |
+
`dataset_files_sha`, `step`, `tokens_consumed`. The hashes let a resume **detect** that it is resuming into a
|
| 55 |
+
different dataset than it was trained on β raise, never silently re-shuffle.
|
| 56 |
+
|
| 57 |
+
Prove it three ways: recorded index/hash, token-offset check, and loss continuity across the break within
|
| 58 |
+
noise. Then **resume twice in sequence** β one interruption is a fluke. Position must never drift backwards or
|
| 59 |
+
re-read consumed data.
|
| 60 |
+
|
| 61 |
+
## 5. The contamination audit is mechanical, and its scope is narrow
|
| 62 |
+
|
| 63 |
+
**Audit against `validation`/`dev` material only. `test` splits stay untouched until the benchmark phase.**
|
| 64 |
+
This is a hard boundary, not a conservatism: reading test items β even to count overlap against them β is the
|
| 65 |
+
one thing that can quietly invalidate the entire result set. Compute overlap without ever printing an item.
|
| 66 |
+
|
| 67 |
+
Method: normalise (lowercase, strip punctuation/whitespace), count exact long-n-gram matches (13-grams are the
|
| 68 |
+
usual standard) between mix documents and each task's **non-test** reference split, report per-source with an
|
| 69 |
+
`overlap_total`. Drop or clean any source that fails; re-run to zero.
|
| 70 |
+
|
| 71 |
+
Three traps, all of which produce a *passing* audit that means nothing:
|
| 72 |
+
|
| 73 |
+
1. **Zero denominator.** If extraction pulled 0 reference strings, `overlap_total 0` is true and worthless.
|
| 74 |
+
Assert a minimum row count per task, and print denominators beside numerators.
|
| 75 |
+
2. **Wrong split.** Verify per task which split the harness actually scores. In current lm-eval several standard
|
| 76 |
+
academic tasks are scored on `validation`, and some datasets expose no `test` at all. Auditing `test` because
|
| 77 |
+
that's the intuitive name measures the wrong bytes *and* breaks the rule above.
|
| 78 |
+
3. **The audit's own artefacts leak benchmark text.** Exception strings, sample matches and debug dumps get
|
| 79 |
+
serialised into `audit.json` and published with the mix, quoting real cells. Publish **counts**, and scrub
|
| 80 |
+
every string that could carry an item β this happened here before it was caught.
|
| 81 |
+
|
| 82 |
+
Keep the re-runnable script and the row-count-bearing report in the repo. "We decontaminated" is a claim; a
|
| 83 |
+
script another party can run against the published mix is evidence.
|
| 84 |
+
|
| 85 |
+
## 6. Publish so a stranger can rebuild it
|
| 86 |
+
|
| 87 |
+
- `manifest.json`: per-source token counts, train/val totals, shard counts and sizes, tokenizer identity (hub
|
| 88 |
+
repo, revision, vocab size, tokenizer file hashes), the packing rule, the seed.
|
| 89 |
+
- **The exclusion masks and dedup keys**, not just the result β otherwise the build is unreviewable.
|
| 90 |
+
- A **content fingerprint** over the ordered file set (hash of concatenated per-file sha256s) plus the per-file
|
| 91 |
+
sha256s. Training asserts it matches; that is what makes `dataset_files_sha` above meaningful.
|
| 92 |
+
- Self-consistency: totals equal the sum of parts, shard counts equal the file listing, no empty shards. Write
|
| 93 |
+
the checker; don't eyeball a table. A manifest whose numbers don't add up is worse than none, because it
|
| 94 |
+
reads like a guarantee.
|
| 95 |
+
|
| 96 |
+
Then verify the **published** artefact: re-download the manifest anonymously, re-hash shards, and feed the
|
| 97 |
+
downloaded bytes to the same reader the trainer uses. The dataset is done when an instance with an empty cache
|
| 98 |
+
can start from the repo id alone and read the right tokens.
|
guide/03-preflight.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 03 β Preflight
|
| 2 |
+
|
| 3 |
+
The discipline of this phase is one sentence: **spend the cheapest evidence first, and make each rung answer a
|
| 4 |
+
different question.** Every rung below caught, in the project this guide comes from, a bug that would have
|
| 5 |
+
destroyed a multi-hour session.
|
| 6 |
+
|
| 7 |
+
## 1. The ladder
|
| 8 |
+
|
| 9 |
+
| Rung | Budget | Question it answers |
|
| 10 |
+
|---|---|---|
|
| 11 |
+
| 0. Static | seconds, local | Does it import? Does the launch command line parse? Do the hashes of the files I'm about to run match the files I reviewed? |
|
| 12 |
+
| 1. Free-CPU rehearsal | minutes, no accelerator | Does the *whole control flow* work with the real modules β plan, resume decision, cursor math, checkpoint cycle β with training stubbed? |
|
| 13 |
+
| 2. Cheap GPU smoke (20β30 steps) | **budgeted** ~10 min | Does the machinery run on the accelerator: install, device, one real optimiser step, one push, one verified resume? |
|
| 14 |
+
| 3. Measurement probe | 1β1.5 h billed | Does the *config* hold for hours: sustained rate, flat memory, cadence cost, cold resume from the Hub on an empty disk? |
|
| 15 |
+
| 4. The run | everything | β |
|
| 16 |
+
|
| 17 |
+
Two honest corrections about rung 2, because they are the argument *for* the ladder, not against it:
|
| 18 |
+
|
| 19 |
+
- It cost **1.25 h across eight attempts**, not ten minutes. Every attempt but the last failed on a real defect:
|
| 20 |
+
`torchrun` handed the interpreter instead of the script (E-037), a stale-stop guard refusing correctly on a
|
| 21 |
+
dirty repo (E-038), an argument-order slip in `delete_folder` (E-039), a harness that could not read its own
|
| 22 |
+
tee'd output (E-041), and finally a rank-only assertion that killed every *successful* leg (E-044). A smoke
|
| 23 |
+
rung's *budget* is ten minutes; its *cost* is the number of bugs in the code it is the first to execute. That
|
| 24 |
+
is still cheaper than finding them in a 4.5-hour session β but plan the budget as "10 min, or 1.5 h if the
|
| 25 |
+
code is new", not as "10 min".
|
| 26 |
+
- The CPU rehearsal caught the plumbing defects (E-036, E-037). It did **not** catch the expensive one: the
|
| 27 |
+
rank-only-`on_save` crash needed GPU legs to reproduce and took seven attempts to diagnose. Don't oversell
|
| 28 |
+
the free rung β it buys you command lines and control flow, not distributed semantics.
|
| 29 |
+
|
| 30 |
+
**Order by price-per-question, and re-run rungs 0β1 on every edit to run code.** They are free; the only cost of
|
| 31 |
+
a rehearsal is the nine minutes you didn't spend on something else.
|
| 32 |
+
|
| 33 |
+
## 2. Make the rehearsal rehearse the real thing
|
| 34 |
+
|
| 35 |
+
- Import the *real* modules β a rehearsal of a reimplementation proves nothing about the original.
|
| 36 |
+
- Print the command line the launcher would execute and parse it in the rehearsal, so a flag typo fails there.
|
| 37 |
+
- Point it at real artefacts where it can: hash the actually-published shards, read the actually-verified
|
| 38 |
+
checkpoint. The Phase 4 rehearsal re-hashed all 151 mix files, which is why the run started knowing its data.
|
| 39 |
+
- Assert the same invariants the run will assert, so a rehearsal pass means the run's guards are armed, not
|
| 40 |
+
merely present.
|
| 41 |
+
|
| 42 |
+
## 3. Model size: prove size-dependent things at the real size
|
| 43 |
+
|
| 44 |
+
"Preflight on tiny models" is the instruction, and taken literally it is wrong. **Memory, throughput,
|
| 45 |
+
checkpoint byte-size, DDP rank behaviour and optimizer-state resume are all size-dependent** β a 15M model
|
| 46 |
+
proves the code path and nothing about the run's numbers. This project therefore ran every Gate 3 proof at the
|
| 47 |
+
**real 106M geometry on 2ΓT4**, and used CPU/tiny cells only for properties that genuinely don't scale
|
| 48 |
+
(reader semantics, order determinism, the storage cycle's logic). Choose per proof: if the quantity you're
|
| 49 |
+
measuring is a function of size, the size has to be right; if it isn't, spend nothing.
|
| 50 |
+
|
| 51 |
+
## 4. What preflight must demonstrate, with logs
|
| 52 |
+
|
| 53 |
+
The eight proofs. Each is a line in the preflight report, with the log excerpt that shows it.
|
| 54 |
+
|
| 55 |
+
1. **Upload** a checkpoint to the Hub; **restart** and pull it back.
|
| 56 |
+
2. **Exact data position** on resume β recorded index/hash *and* a token-offset check, not "loss looked
|
| 57 |
+
continuous".
|
| 58 |
+
3. **Optimizer and LR state** restored: print the scheduler value on the first resumed step and compare it to
|
| 59 |
+
what the interrupted run would have produced.
|
| 60 |
+
4. **Loss continuity** across the restart within noise, with numbers.
|
| 61 |
+
5. **Measured throughput** on the target hardware, and the ETA it implies.
|
| 62 |
+
6. **Cold resume**: interrupt, *kill the instance*, start fresh with an empty disk, recover solely from the Hub.
|
| 63 |
+
This is the only resume test that counts, because every real interruption looks like this. A resume that
|
| 64 |
+
reads a local leftover file is testing something that will not exist.
|
| 65 |
+
7. **The storage cycle**: upload β verify by fetching bytes back β delete locally β confirm free space β keep
|
| 66 |
+
training, at sizes representative of the real model **plus optimizer state** (`07`: ~12 bytes/param, not
|
| 67 |
+
the weight file alone).
|
| 68 |
+
8. **Two sequential resumes** β position must never drift backwards or re-read consumed data.
|
| 69 |
+
|
| 70 |
+
Anything unproven here is a bug you have not found yet.
|
| 71 |
+
|
| 72 |
+
## 5. Then measure the config, and let the measurement change it
|
| 73 |
+
|
| 74 |
+
Preflight is the last cheap moment to *choose*. Throughput is not a spec sheet; it's a distribution on your
|
| 75 |
+
hardware with your batch shape, and small-N numbers lie:
|
| 76 |
+
|
| 77 |
+
- A 20-step average is not a rate. The 20-step figure here was **6 % optimistic** β the difference between
|
| 78 |
+
fitting the week and not. Take the sustained number over a long leg (two legs of 120 and 60 steps measured
|
| 79 |
+
12,312 and 12,221 tok/s; the planning number adopted was 12,300).
|
| 80 |
+
- Measure memory as a **time series**, not a peak. `max_memory_reserved` is process-lifetime, so a
|
| 81 |
+
post-training validation pass "raises the peak" without any leak. Gate on the leg that does not evaluate,
|
| 82 |
+
and compare step 10 against step 120 in the same process.
|
| 83 |
+
- Report the **cross-rank max**, obtained by an explicit `all_reduce(MAX)`. Rank-0-only peak statistics under-
|
| 84 |
+
report, and that is the number you will otherwise make an OOM decision on.
|
| 85 |
+
- Cost the checkpoint cycle in seconds per push at real conditions: whole-object read-back measured 797 s off
|
| 86 |
+
a cold CDN; bounded ranged verification runs inside a 7β10 s pushβpoint gap on the live run. That single
|
| 87 |
+
measurement decides how often you may push, hence how much work an interruption costs.
|
| 88 |
+
- If the measurement shows headroom, ask what your current setting is still paying for. 5.99 GB peak on a
|
| 89 |
+
15.4 GB card meant gradient checkpointing was buying memory nobody needed; since it computes *identical
|
| 90 |
+
gradients*, dropping it was plumbing, not a loss-landscape change. It bought ~30 % throughput and turned an
|
| 91 |
+
infeasible 29.7-hour run into a 22.6-hour one.
|
| 92 |
+
|
| 93 |
+
**Rule for reopening a frozen choice:** only before results exist, only when the change provably leaves
|
| 94 |
+
gradients identical, and shrink the blast radius first (finer cadence so a failure costs less). Never after a
|
| 95 |
+
number is on the board β that is tuning, and it invalidates the report.
|
| 96 |
+
|
| 97 |
+
## 6. Prove the failure paths, and prefer a discriminating job to an argument
|
| 98 |
+
|
| 99 |
+
Rungs 0β3 are where you *inject* faults, because the alternative is discovering them mid-run:
|
| 100 |
+
|
| 101 |
+
- Serve checkpoint bytes back wrong (flipped byte inside the ranged window, wrong span, a server that ignores
|
| 102 |
+
`Range`) and confirm verification **fails**. A verifier that has never rejected anything is decoration.
|
| 103 |
+
- Point prune at an unverified result and confirm it refuses to delete.
|
| 104 |
+
- Kill a run mid-leg: confirm the stop guard fires for the right reason and the resume lands where it should.
|
| 105 |
+
- Test the absence case: an empty repo must read as "nothing here", not as a timeout or a 403.
|
| 106 |
+
- **Test rank-blind guards on every rank.** `on_save` ran on rank 0 only, so a "did you push?" assertion was
|
| 107 |
+
unsatisfiable on rank 1 and killed every correct leg (E-044). Two rules follow: assert only predicates the
|
| 108 |
+
rank can actually satisfy, and print diagnostics on *all* ranks β a rank-0-only logger turns a crash into
|
| 109 |
+
silence, which is how E-044 survived seven attempts.
|
| 110 |
+
- **When an error fits a plausible story, spend five minutes disproving the story directly** (E-017). A
|
| 111 |
+
cheap, targeted job settled in one run what a morning of reasoning about token scopes could not. The
|
| 112 |
+
plausible explanation is the expensive one to trust.
|
| 113 |
+
|
| 114 |
+
## 7. Sign the report
|
| 115 |
+
|
| 116 |
+
Write the phase's report with each of the eight proofs (Β§4) and its evidence, plus measured tokens/sec, the
|
| 117 |
+
main-run ETA, the GPU-hour estimate, and the arithmetic showing it fits the remaining quota. Named files, not
|
| 118 |
+
conversation β a reader without this project's history must be able to check every claim. If a proof cannot
|
| 119 |
+
state a number, it is missing, and saying so is cheaper than discovering it later.
|
guide/04-the-run.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 04 β The run
|
| 2 |
+
|
| 3 |
+
Assume interruption. Session caps, idle timeouts, preemption, quota exhaustion at the week boundary β all
|
| 4 |
+
routine, and the design goal is that none of them costs more than one checkpoint of work.
|
| 5 |
+
|
| 6 |
+
## 1. Freeze, then stop deciding
|
| 7 |
+
|
| 8 |
+
After checkpoint 1 exists, **restarting the run is forbidden.** Everything about the model is frozen; what you
|
| 9 |
+
may still change is plumbing (`01` Β§2). If a bug surfaces mid-run that touches the loss landscape, you continue
|
| 10 |
+
the run and record the finding as a *limitation of the reported result*. That is the difference between a
|
| 11 |
+
measurement and a demo.
|
| 12 |
+
|
| 13 |
+
## 2. The checkpoint cycle, in the one correct order
|
| 14 |
+
|
| 15 |
+
```
|
| 16 |
+
write locally β push (no local delete) β verify by reading the bytes back from the remote
|
| 17 |
+
β roll the "latest" pointer β read the pointer back and assert it points here
|
| 18 |
+
β prune local, only if verification passed
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Each arrow is where a real artefact was lost when the order slipped:
|
| 22 |
+
|
| 23 |
+
- **Verify means bytes.** A returned commit is not proof; a file listing is not proof; HTTP 200 on an LFS
|
| 24 |
+
pointer is not proof. Re-fetch each file's content β ranged, if it's big β and compare sha256. Know which
|
| 25 |
+
hash each file class exposes before writing the equality check: a remote may report a sha1 blob id for small
|
| 26 |
+
files, which is *not* comparable to your sha256 (`07`).
|
| 27 |
+
- **Delete never precedes verification.** Make the prune function itself take the verification result and raise
|
| 28 |
+
if `ok is not True`. A guard that lives in the caller gets bypassed by a caller β usually by a flag added for
|
| 29 |
+
an unrelated reason. Here, a well-intentioned `prune=False` on the only mid-run path silently un-gated
|
| 30 |
+
deletion for several sessions (E-042).
|
| 31 |
+
- **Point last.** `latest` is what a resume reads. Writing it before the bytes verify advertises a checkpoint
|
| 32 |
+
that may not exist, and resuming onto a half-pushed step is worse than restarting the leg.
|
| 33 |
+
- **Refuse, don't warn.** Every one of these checks raises. A printed warning in a log nobody reads is a comment.
|
| 34 |
+
- **Capacity, one line:** 106 M params β **1,274,563,198 B per checkpoint** β 1.19 GiB, cycle cost 7β10 s,
|
| 35 |
+
pruning floor asserted at 8 GB free, 19.5 GB on a fresh instance. Disk is not a surprise at this scale if you
|
| 36 |
+
prune on verify; it is a surprise the moment you don't.
|
| 37 |
+
|
| 38 |
+
## 3. Sizing sessions and cadence
|
| 39 |
+
|
| 40 |
+
Two grids must agree, and the arithmetic is where the bugs live:
|
| 41 |
+
|
| 42 |
+
- **Session length**: total steps Γ· steps-per-session, tiled so the *last* session ends exactly on the horizon.
|
| 43 |
+
If a plan function computes a per-session budget, assert it divides the remainder β a session that stops
|
| 44 |
+
mid-checkpoint wastes a leg.
|
| 45 |
+
- **Push cadence**: `session_steps % push_every == 0`, and the trainer must *reject* a cadence that isn't a
|
| 46 |
+
whole multiple of its own checkpoint grid. Otherwise the final push of a session lands on a step no resume
|
| 47 |
+
can name.
|
| 48 |
+
- Cadence is how much an interruption costs: at 127 steps Γ 21.5 s, a death loses **β€45 minutes**. Choose the
|
| 49 |
+
finest cadence whose measured cycle cost you can afford (`03` Β§5) and then stop feeling guilty about it.
|
| 50 |
+
- Name every artefact by its step (`ckpt/checkpoint-<step>`) and keep one mutable pointer (`latest.json`) that a
|
| 51 |
+
fresh instance can read with no knowledge of your session numbering.
|
| 52 |
+
|
| 53 |
+
## 4. Resume logic
|
| 54 |
+
|
| 55 |
+
A session needs nothing but the repo id and the remote pointer. On boot: read `latest` β fetch that checkpoint
|
| 56 |
+
by step β assert the dataset fingerprint and cursor hashes match yours β load weights, optimizer, scheduler,
|
| 57 |
+
scaler, cursor β start at `step + 1`. If the pointer is absent, start from zero. If the pointer exists but the
|
| 58 |
+
bytes don't, **raise** β never fall back to step 0 and retrain 20 % of the model over good data.
|
| 59 |
+
|
| 60 |
+
Make launching idempotent: launching the same session twice must be safe β the second sees the pointer and
|
| 61 |
+
either refuses or resumes correctly, never double-writes.
|
| 62 |
+
|
| 63 |
+
## 5. Quota arithmetic, done before launch and re-read at every launch
|
| 64 |
+
|
| 65 |
+
Write the sum, not a guess: `sessions Γ hours_per_session + per-session overhead + Phases 5 and 6`, against
|
| 66 |
+
`hours_remaining` from a **live** read, with the reset instant named. Then:
|
| 67 |
+
|
| 68 |
+
- **Every phase gets a line, including the ones you haven't reached.** A budget with no row for publishing and
|
| 69 |
+
benchmarks is not a budget β that omission is what this project found five hours late, when 1.48 h of margin
|
| 70 |
+
was all that remained for eight tasks whose cost had never been measured.
|
| 71 |
+
- If the estimate exceeds the week, plan the multi-week resume *explicitly*, in the status file: which session
|
| 72 |
+
ends where, what happens across the boundary, what fills the idle hours. A pause at a checkpoint boundary is
|
| 73 |
+
a designed outcome, not an incident.
|
| 74 |
+
- Know the size of your slack and say what it insures. Here: 1.48 h against a 4.55 h session β one lost session
|
| 75 |
+
spends the entire margin, so the priority order (training, then publication, then as many benchmarks as fit)
|
| 76 |
+
is decided in advance rather than improvised at 06:00Z.
|
| 77 |
+
- Book the ledger row **before** the job starts and update hours remaining after. The version where you remember
|
| 78 |
+
afterwards is how a week disappears.
|
| 79 |
+
- Track wall-clock vs billed hours if the platform charges one and reports the other (Kaggle bills 1Γ wall
|
| 80 |
+
clock, so a queued or installing job is not free).
|
| 81 |
+
|
| 82 |
+
## 6. Monitoring, and the loss rule
|
| 83 |
+
|
| 84 |
+
On every wake, before anything else: is the job alive, does the remote show the checkpoint you expect, and is
|
| 85 |
+
loss on the planned curve? All three are answerable from remote artefacts β a checkpoint's own
|
| 86 |
+
`trainer_state.json` and `cursor.json` are anonymously readable β without waiting for a job log, which matters
|
| 87 |
+
because many platforms expose no logs until a job completes.
|
| 88 |
+
|
| 89 |
+
**A loss anomaly is investigated and documented; never silently ignored, never fixed by changing the
|
| 90 |
+
configuration.** Record step, value, neighbouring values, grad-norm and LR; rule out the boring causes in order
|
| 91 |
+
(a shard boundary, a resume, an LR knee, real divergence where grad-norm moves with it). Then keep going and put
|
| 92 |
+
it in the report. Monotone-with-noise across a restart is also your *positive* evidence that resume is correct,
|
| 93 |
+
so print those numbers rather than hiding them.
|
| 94 |
+
|
| 95 |
+
Verify the counts as they land: tokens at checkpoint `k` must be exactly `k Γ tokens_per_step`, and cursor
|
| 96 |
+
samples `k Γ accum Γ micro Γ ranks`. When they are, write it down; when they aren't you've found a data bug
|
| 97 |
+
while it's still cheap.
|
| 98 |
+
|
| 99 |
+
## 7. "The job finished" is not "the job reported"
|
| 100 |
+
|
| 101 |
+
A run that trained correctly and lost its report achieved nothing, and this is where it happened three times
|
| 102 |
+
(E-004, E-012, E-019):
|
| 103 |
+
|
| 104 |
+
- A trailing cross-check raised **after** the work had succeeded, and took the whole report down with it.
|
| 105 |
+
Write the artefacts first, verify afterwards, and make verification non-destructive β a check that can delete
|
| 106 |
+
results is a check that will.
|
| 107 |
+
- A job whose status said `COMPLETE` had two voided steps in it. Read the numbers, not the status.
|
| 108 |
+
- A stray print line flipped a passing rehearsal's own summary to `false`. Keep machine-read verdict lines
|
| 109 |
+
free of incidental output, and parse them from a structured record rather than from stdout.
|
| 110 |
+
|
| 111 |
+
## 8. Long jobs: don't babysit
|
| 112 |
+
|
| 113 |
+
Launch, record exactly how to check on it, and move to unblocked work or end the session. The hours between
|
| 114 |
+
checkpoint 3 and checkpoint 6 are for Phase 5/6 scripts, the report skeleton and free-CPU rehearsals β not for
|
| 115 |
+
polling. Design the run so that **you leaving is not an event.**
|
| 116 |
+
|
| 117 |
+
## 9. What the run log is for
|
| 118 |
+
|
| 119 |
+
One row per session and per checkpoint: date, step, tokens, loss, free GB, what was done. Append-only, so nobody
|
| 120 |
+
can quietly improve history. It is the raw material for the report's "what went wrong", and the only thing that
|
| 121 |
+
will let you reconstruct an incident next week.
|
guide/05-publish-and-evaluate.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 05 β Publish and evaluate
|
| 2 |
+
|
| 3 |
+
Publishing is where a sloppy project quietly becomes a misleading one. Two rules cover almost all of it:
|
| 4 |
+
**prove the artefact loads from nothing**, and **report what the harness actually did, not what you intended.**
|
| 5 |
+
|
| 6 |
+
## 1. The model repo
|
| 7 |
+
|
| 8 |
+
<sub>Sources: Phase 5 of the constitution Β· E-045 (13 findings) Β· E-046</sub>
|
| 9 |
+
|
| 10 |
+
Push weights, config and tokenizer to a public repo with a card stating: the mix (sources, token counts),
|
| 11 |
+
hyperparameters, exact parameter count, tokens consumed, measured throughput, hardware, contamination statement.
|
| 12 |
+
Generate every field **by reading the artefacts** β the checkpoint's trainer state, the dataset manifest, the
|
| 13 |
+
run log β not by typing prose into a template. A hand-typed card field will be wrong, and wrong in the
|
| 14 |
+
flattering direction.
|
| 15 |
+
|
| 16 |
+
Guard it in code, and make the guard *able* to fail (E-045):
|
| 17 |
+
|
| 18 |
+
- List required fields explicitly; refuse to push if any is missing or still a placeholder. A check that reads
|
| 19 |
+
a dict of defaults cannot fail, which means it isn't a check.
|
| 20 |
+
- Recompute and assert: parameter count from the config vs the checkpoint's tensor shapes, vocab size vs the
|
| 21 |
+
embedding rows, `tokens_consumed == steps Γ tokens_per_step`, mix fingerprint vs the published manifest.
|
| 22 |
+
- Only then create/commit the repo. Re-hash **every** file you just published, and don't write the README in a
|
| 23 |
+
`--dry-run`.
|
| 24 |
+
|
| 25 |
+
## 2. The clean room is a mode, not a statement
|
| 26 |
+
|
| 27 |
+
"Loads from the Hub" must be demonstrated on a fresh instance, empty cache, **without credentials**:
|
| 28 |
+
|
| 29 |
+
- Set cache/home env vars **before** importing anything β after the import the paths are already resolved and
|
| 30 |
+
your override is a no-op (E-046).
|
| 31 |
+
- **Passing `token=False` is not sufficient.** If your codebase has a credentials installer, it puts
|
| 32 |
+
`HF_TOKEN` in the environment and `huggingface_hub` reads it from there β so the "clean room" runs
|
| 33 |
+
authenticated and Gate 5 silently proves nothing (E-045 item 1). Pop every token variable name your installer
|
| 34 |
+
may have set, *and* pass `token=False`, *and* pass an explicit empty `cache_dir`.
|
| 35 |
+
- Generate text and print the config plus a continuation.
|
| 36 |
+
- Re-hash every published file by anonymous fetch; that catches the repo that only loads because your cache is
|
| 37 |
+
warm.
|
| 38 |
+
- Distinguish the failure kinds in the "nothing there" check: 404 means absent; a **timeout does not**, and
|
| 39 |
+
neither does 403 (a private repo answers the same way a nonexistent one does to the wrong caller). Treating
|
| 40 |
+
either as "empty" turns a network incident or a mis-set permission into a green check (E-011, E-046).
|
| 41 |
+
|
| 42 |
+
## 3. Benchmarks: pin, then run only what you pre-registered
|
| 43 |
+
|
| 44 |
+
<sub>Sources: Phase 6 Β· E-045/E-047/E-048/E-049 Β· `docs/05-eval-plan.md`</sub>
|
| 45 |
+
|
| 46 |
+
Only now may you touch eval data β including the **test** splits, which stayed unopened through the whole
|
| 47 |
+
contamination audit (`02` Β§5). Pin the harness version and per-task settings in the repo.
|
| 48 |
+
|
| 49 |
+
What silently changes a score:
|
| 50 |
+
|
| 51 |
+
- **Which split.** Several standard academic tasks are scored on `validation` in current lm-eval; some expose no
|
| 52 |
+
`test` at all. Take the split from the harness's own task config and print it.
|
| 53 |
+
- **The metric key.** Shaped `"<name>,<aggregation>"`, and not settleable from a config you read once (E-049).
|
| 54 |
+
Assert the key exists in the *result dict* during a smoke run and fail loudly if it doesn't. Read with
|
| 55 |
+
`.get(k, 0)` and a missing key becomes a zero, and a column of zeros becomes a result.
|
| 56 |
+
- **The effective shot count.** Asked-for and actually-run can differ; some tasks carry per-subject or
|
| 57 |
+
multiple-metric settings (MMLU's subjects; GSM8K's two formats). Record the number from the outputs with its
|
| 58 |
+
provenance; never publish a null or an assumed 0.
|
| 59 |
+
- **The denominator.** Record `n_input` per task. A cell without one isn't a measurement β give it a `status`
|
| 60 |
+
and make your "all ok" check honour `status`, not the value (E-045).
|
| 61 |
+
- **Installs.** `--no-deps` on an eval harness imports fine and dies mid-run on an optional module (E-047).
|
| 62 |
+
Install with dependencies and assert the version *and* import path of every pinned library on every code path,
|
| 63 |
+
including after a cached install.
|
| 64 |
+
- **Commands you assume exist.** `lm_eval --tasks list` is not one of them in 0.4.13 (E-048); ask the task
|
| 65 |
+
registry object instead. Verify any listing convenience by executing it, and make sure your probe checks the
|
| 66 |
+
field you think it checks β a probe that guesses a field name proves nothing about it (E-049).
|
| 67 |
+
|
| 68 |
+
Run against the **published** model, not local weights, so the evaluation exercises the artefact people will
|
| 69 |
+
use.
|
| 70 |
+
|
| 71 |
+
## 4. Incremental results, because evals get interrupted too
|
| 72 |
+
|
| 73 |
+
Save each task's result as it completes, keyed by task, and skip completed tasks on re-run only if their recorded
|
| 74 |
+
config matches. Then a quota cut mid-eval costs the current task, not the campaign β which is what makes it safe
|
| 75 |
+
to spend leftover hours on benchmarks at all.
|
| 76 |
+
|
| 77 |
+
Push the full table plus the exact reproduction config. And run the tiny smoke pass first (`--limit 5`, one or
|
| 78 |
+
two tasks): minutes, and it is where the metric key, the split, the install and the task-name typos die.
|
| 79 |
+
|
| 80 |
+
**A partial table is not a result.** If not every task ran, say so, name which ran, and do not publish a subset
|
| 81 |
+
as a score set. Fix the task order in advance (constitution order, not "whichever finished") so a delay can
|
| 82 |
+
never be read as selection.
|
| 83 |
+
|
| 84 |
+
## 5. Reporting
|
| 85 |
+
|
| 86 |
+
Per task: shot count (effective, with provenance), metric name verbatim, split, denominator, score. Then
|
| 87 |
+
measured vs. the pre-registered band from `01` Β§2. Bands set before results exist are the only honest
|
| 88 |
+
comparison available afterwards; if you didn't set them, label the comparison post-hoc and leave it there.
|
| 89 |
+
|
| 90 |
+
Report failures with the same specificity as successes: which task errored and why, which config changed
|
| 91 |
+
mid-project and when, which proof you could not complete. A reader who cannot reproduce a number from the
|
| 92 |
+
published artefacts does not have a result, and neither do you.
|
guide/06-checklists.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 06 β Checklists
|
| 2 |
+
|
| 3 |
+
The working page. Tick nothing from memory. Each gate names the error/decision records it came from, so a claim
|
| 4 |
+
here is checkable against the ledger rather than taken on trust.
|
| 5 |
+
|
| 6 |
+
## Gate 0 β Orientation Β· `E-001..E-019`
|
| 7 |
+
|
| 8 |
+
- [ ] Credentials verified by a call returning identity, not by a file existing
|
| 9 |
+
- [ ] **A secret store's privacy proved by two different calls** (authenticated listing *and* anonymous read) β
|
| 10 |
+
403/404 alone cannot distinguish "private" from "never created" (`E-011`)
|
| 11 |
+
- [ ] Remote quota read live; hours remaining + reset **instant** written in the ledger (look up the weekday)
|
| 12 |
+
- [ ] One throwaway CPU job and one throwaway GPU job completed end to end; mechanics recorded
|
| 13 |
+
- [ ] Any async job from a previous session found and accounted for (running / finished / dead)
|
| 14 |
+
- [ ] Memory files match reality; every discrepancy logged, not silently corrected
|
| 15 |
+
|
| 16 |
+
## Gate 1 β Plan Β· `E-020..E-026`
|
| 17 |
+
|
| 18 |
+
- [ ] Architecture, hyperparameters, token total, step count written and dated
|
| 19 |
+
- [ ] Throughput estimate with its source, and the GPU-hour arithmetic it implies
|
| 20 |
+
- [ ] **Budget has a line for every remaining phase, including publish and benchmarks** (`D-019`)
|
| 21 |
+
- [ ] Per-benchmark target bands pre-registered, each with a citation
|
| 22 |
+
- [ ] Eval split + metric named per task **before** any eval code exists
|
| 23 |
+
- [ ] What you may change mid-run vs what is frozen, stated as one sentence
|
| 24 |
+
- [ ] Every choice traceable to a source you actually looked at
|
| 25 |
+
|
| 26 |
+
## Gate 2 β Data Β· `E-027..E-035`
|
| 27 |
+
|
| 28 |
+
- [ ] Assembled above target; validation split reserved before sharding
|
| 29 |
+
- [ ] Deduplicated; mechanical overlap audit at `overlap_total 0`
|
| 30 |
+
- [ ] **Audit touched `validation`/`dev` only; no `test` split opened**
|
| 31 |
+
- [ ] Audit denominators (rows per task) asserted nonzero and printed beside the counts
|
| 32 |
+
- [ ] No benchmark item text in any published audit artefact, including exception strings
|
| 33 |
+
- [ ] Shard layout proven small enough that a job reads a few shards, not the mix
|
| 34 |
+
- [ ] Packing boundary choice *measured*, not assumed (seam rate)
|
| 35 |
+
- [ ] Published public; token count re-verified **from the Hub copy** against the manifest
|
| 36 |
+
- [ ] Manifest self-consistent (sums, counts, no empties); per-file + set fingerprints recorded
|
| 37 |
+
- [ ] Cursor design supports exact positional resume; fingerprint keys chosen and persisted
|
| 38 |
+
|
| 39 |
+
## Gate 3 β Preflight Β· `E-036..E-044` Β· `D-012..D-018`
|
| 40 |
+
|
| 41 |
+
- [ ] **Rehearsal re-run after every edit to run code** β it's free
|
| 42 |
+
- [ ] Rehearsal imports the real modules and parses the real launch command line
|
| 43 |
+
- [ ] Each proof run **at the size the property depends on** (`03` Β§3), not at a token tiny model
|
| 44 |
+
- [ ] Fault injection: wrong bytes, ignored `Range`, unverified prune, absent repo β all *rejected*
|
| 45 |
+
- [ ] Guards tested **on every rank**; diagnostics printed on every rank, not just rank 0
|
| 46 |
+
- [ ] Upload β restart β pull-back, on the Hub
|
| 47 |
+
- [ ] Exact data position proven by index/hash **and** token offset
|
| 48 |
+
- [ ] Optimizer/LR state restored, values printed; loss continuous across restart
|
| 49 |
+
- [ ] **Cold resume** on a fresh instance, empty disk, recovering solely from the Hub
|
| 50 |
+
- [ ] Storage cycle end to end at representative size (**weights + optimizer state**), free space logged
|
| 51 |
+
- [ ] Two sequential resumes, no backward drift, no re-read data
|
| 52 |
+
- [ ] Sustained tokens/sec over a long leg (not 20 steps); memory as a time series, cross-rank max
|
| 53 |
+
- [ ] Checkpoint-cycle cost measured in seconds per push
|
| 54 |
+
- [ ] Report: the eight proofs (`03` Β§4) each with evidence + ETA + GPU-hour arithmetic that fits the quota
|
| 55 |
+
|
| 56 |
+
## Gate 4 β Run Β· `E-042`, `D-018`
|
| 57 |
+
|
| 58 |
+
- [ ] Config frozen; hash recorded and asserted at every session start
|
| 59 |
+
- [ ] Cadence divides session length; session tiling ends exactly on the horizon
|
| 60 |
+
- [ ] Per checkpoint: write β push β **verify bytes** β point β read pointer back β prune
|
| 61 |
+
- [ ] Prune gated by the verification result *inside* the prune function
|
| 62 |
+
- [ ] Free space logged beside loss, every cycle
|
| 63 |
+
- [ ] Ledger row booked **before** each GPU job; hours remaining re-read **at each launch**
|
| 64 |
+
- [ ] `tokens == steps Γ tokens_per_step` and cursor sample math checked at each checkpoint
|
| 65 |
+
- [ ] Loss anomalies documented with grad-norm and LR context, config unchanged
|
| 66 |
+
- [ ] **Results written before trailing cross-checks**; verification cannot destroy a completed report (`E-012`)
|
| 67 |
+
- [ ] Multi-week plan written if the estimate exceeds remaining hours
|
| 68 |
+
|
| 69 |
+
## Gate 5 β Publish Β· `E-045`, `E-046`
|
| 70 |
+
|
| 71 |
+
- [ ] Card fields generated from artefacts; required-field guard demonstrably fails on an empty run
|
| 72 |
+
- [ ] Parameter/vocab/geometry assertions recomputed from the pushed files
|
| 73 |
+
- [ ] Clean-room `from_pretrained` + generate: env set **before** import, `token=False`, **and every token var
|
| 74 |
+
popped from the environment**
|
| 75 |
+
- [ ] Anonymous re-hash of every published file
|
| 76 |
+
- [ ] 404 vs timeout vs 403 distinguished in the "nothing there" path
|
| 77 |
+
|
| 78 |
+
## Gate 6 β Benchmarks Β· `E-045..E-049`
|
| 79 |
+
|
| 80 |
+
- [ ] Harness version pinned; task names validated against the harness's own registry, by executing it
|
| 81 |
+
- [ ] Smoke pass with `--limit` green: metric keys present, splits correct, installs complete **with deps**
|
| 82 |
+
- [ ] Per task: effective shot count + provenance, metric name verbatim, split, `n_input`
|
| 83 |
+
- [ ] Failed / missing-metric / no-denominator cells carry a `status` and fail the "all ok" check
|
| 84 |
+
- [ ] Incremental saving; completed tasks skipped on re-run only if config matches
|
| 85 |
+
- [ ] Run against the published repo, not local weights
|
| 86 |
+
- [ ] Task order pre-declared; a partial table never published as a result
|
| 87 |
+
- [ ] Table + exact reproduction config pushed into the model repo
|
| 88 |
+
|
| 89 |
+
## Gate 7 β Report
|
| 90 |
+
|
| 91 |
+
- [ ] Measured vs. targeted per task
|
| 92 |
+
- [ ] What went wrong, with steps and dates
|
| 93 |
+
- [ ] Contamination statement: method, splits used (never test), denominators, exclusions, residual risk
|
| 94 |
+
- [ ] Limitations, incl. any mid-run finding that touched the loss landscape and was *not* fixed
|
| 95 |
+
- [ ] Which week each number came from, if the schedule spanned a reset
|
| 96 |
+
- [ ] Status file set to COMPLETE; re-verify and stop
|
| 97 |
+
|
| 98 |
+
## The five recurring failure patterns
|
| 99 |
+
|
| 100 |
+
Nearly every ledger entry is one of these (`E-001..E-049`). Check for them before checking for anything exotic.
|
| 101 |
+
|
| 102 |
+
1. **A claim written from memory instead of from the artefact.** A doc says a function does X; it doesn't. A log
|
| 103 |
+
line says a gate passed; the gate read a default. *Fix: assert against the file, the bytes, or the executed
|
| 104 |
+
call β never against the note.*
|
| 105 |
+
2. **A guard that cannot fail.** Empty-list denominators, `dict.get(k, 0)`, `.get("ok", True)`, a required-field
|
| 106 |
+
check over defaults, a verifier that has never rejected anything. *Fix: every guard gets one negative test
|
| 107 |
+
that makes it fire.*
|
| 108 |
+
3. **Verification by listing instead of by bytes.** Commit returned, file in the tree, HTTP 200 on a pointer β
|
| 109 |
+
none of them authorise deleting the local copy.
|
| 110 |
+
4. **A check that is blind to its own context.** Guards and logs written rank-0-only in a 2-rank job (`E-039`,
|
| 111 |
+
`E-044`); clean rooms that inherit an installed token (`E-045`); "which environment runs this step" never
|
| 112 |
+
decided, so a job depends on packages the other image doesn't have (`E-007`, `E-010`, `E-028`, `E-047`).
|
| 113 |
+
*Fix: state the executor β rank, container, interpreter β for every assertion and every install.*
|
| 114 |
+
5. **Assuming the platform matches its docs.** A CLI subcommand that isn't; a field that moved; a split that
|
| 115 |
+
isn't there; billing on one clock and reporting on another. *Fix: execute before you rely.*
|
| 116 |
+
|
| 117 |
+
Meta-pattern underneath all five: **the check itself needs a test.** Twice here a fix for a verified bug was
|
| 118 |
+
itself wrong (E-046: four of thirteen fixes), and it passed because the check was written by the same reasoning
|
| 119 |
+
that wrote the bug. Independent review of the *test*, not just the code, is the cheap way out.
|
| 120 |
+
|
| 121 |
+
## Runbook: a session died at 04:00Z and nobody is awake
|
| 122 |
+
|
| 123 |
+
1. Read the remote pointer and the commit list. `latest -> N` tells you exactly what survives. Do not read the
|
| 124 |
+
job status as the authority.
|
| 125 |
+
2. Compute what is lost: at most one cadence interval (`04` Β§3). Nothing before `N` needs re-running.
|
| 126 |
+
3. Check remaining quota against remaining steps from `N`. Both numbers come from live reads.
|
| 127 |
+
4. If quota covers it: relaunch the same kernel, unchanged. It resumes from the pointer β this path is
|
| 128 |
+
idempotent by construction, which is why it was tested.
|
| 129 |
+
5. If quota doesn't: park at the boundary, write the resume instructions in the status file with the step
|
| 130 |
+
number and the reset instant, and stop. **Do not change configuration to fit** β that's Β§8's prohibition,
|
| 131 |
+
and the pause is a documented outcome.
|
| 132 |
+
6. Only after the run is safe: read the dead session's log for the cause, and write it up in the error ledger
|
| 133 |
+
with the symptom that will let the next session recognise it in ten seconds instead of seven attempts.
|
guide/07-platform-notes.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 07 β Platform notes
|
| 2 |
+
|
| 3 |
+
Numbers measured on one account, one week, one hardware generation. Treat them as **the shape of the fact to
|
| 4 |
+
record**, not as facts: re-measure anything you're about to rely on. Staleness here is the default state.
|
| 5 |
+
|
| 6 |
+
Stack: Kaggle for compute (2ΓTesla T4), Hugging Face Hub for storage and publication.
|
| 7 |
+
|
| 8 |
+
## Kaggle
|
| 9 |
+
|
| 10 |
+
| Fact | Measured |
|
| 11 |
+
|---|---|
|
| 12 |
+
| GPU billing model | **1Γ container wall-clock**, not accelerator-seconds. A job that idles, installs, or waits in a queue is billed. Start the clock deliberately. |
|
| 13 |
+
| Weekly allowance | 108,000 s = 30 GPU-h. Reset **Saturday 00:00Z** (`quota_refresh_time` 2026-09-26T00:00:00Z, which is a Saturday β looked up, not assumed). Read it live; don't infer the weekday. |
|
| 14 |
+
| Small-model test cap (self-imposed) | 6 GPU-h lifetime for all preflight; closed at 4.63 h |
|
| 15 |
+
| Session ceiling | ~25,200 s (7 h) for a GPU session; treat the *practical* cap as lower and end on a checkpoint with margin |
|
| 16 |
+
| Kernel logs | **Not available until the session completes.** Plan monitoring around remote artefacts instead |
|
| 17 |
+
| Env vars to a job | Cannot be passed through `create_notebook_session`. Workaround: a thin **pinned wrapper kernel** that `runpy.run_path`s the real script fetched at a commit sha, and carries only **non-secret** values (chosen session size, planning rate, quota figure). Secrets never go in kernel source β see `01` Β§4 and D-006. |
|
| 18 |
+
| Quota read | `get_accelerator_quota`; `time_reserved` was `0s` in every read taken between jobs, so it is **not** a live-job indicator β use the session-status call for that |
|
| 19 |
+
| Throughput, 106M model, seq 1024, 2ΓT4, no checkpointing | **12,221β12,312 tok/s sustained** = 21.5 s/step at 262,144 tok/step. With gradient checkpointing: 9,358β9,696 tok/s |
|
| 20 |
+
| Memory, same config | **cross-rank max** reserved 12.84 GiB / allocated 12.70 GiB, identical at step 10 and step 120 of the same process (i.e. stable *over time*; per-rank equality was never established β the number is an `all_reduce(MAX)`) |
|
| 21 |
+
|
| 22 |
+
MCP/API mechanics that bit:
|
| 23 |
+
|
| 24 |
+
- `save_notebook` requires `language` and `kernelType` (and `machineShape` for some CPU shapes).
|
| 25 |
+
- Passing `newTitle` **rewrites the kernel slug**. Address existing kernels by their current slug and re-read it
|
| 26 |
+
after any title change; every stale reference breaks silently.
|
| 27 |
+
- `dockerImagePinningType` accepts `latest` and will not pin a revision usefully, so reproducibility comes from
|
| 28 |
+
*your* commit shas plus explicit `pip` version pins β not from the image.
|
| 29 |
+
- pip `--user` installs land under `/root/.local/...`, which is **not** on the parent process's `sys.path` when
|
| 30 |
+
the directory is created mid-process. Install, then start a fresh interpreter, or add the path explicitly.
|
| 31 |
+
- Big tool outputs persist to a file rather than returning inline; decode the `log` field with stdlib JSON.
|
| 32 |
+
- A job that exits within ~2 minutes almost always *refused to start* on its own assertions. That is a good
|
| 33 |
+
outcome β make refusals print a named verdict line you can grep for.
|
| 34 |
+
|
| 35 |
+
## Hugging Face Hub
|
| 36 |
+
|
| 37 |
+
| Fact | Measured |
|
| 38 |
+
|---|---|
|
| 39 |
+
| Commit-rate ceiling | ~139 sequential commits in a burst starts failing. **Batch** multi-file pushes into one commit. |
|
| 40 |
+
| Checkpoint cycle, 1.27 GB | **7β10 s** on the live run, measured as the gap between the `checkpoint ckpt/checkpoint-N` commit and the `latest -> N` commit (verification happens in between, so this bounds push + ranged byte-verify + point). The earlier whole-object download design took **797 s** off a cold CDN. Verification design sets your cadence. |
|
| 41 |
+
| LFS files | `lfs["oid"]` **is** the content sha256 β and it's a dict entry, not an object attribute |
|
| 42 |
+
| Small (non-LFS) files | expose only a sha1 *blob id*, **not** comparable to a sha256. Don't write an equality check that mixes them. |
|
| 43 |
+
| Range requests | return 206 with `content-range: bytes a-b/size` through the LFS redirect. Compare the header to the window you asked for: a server that ignores `Range` answers 200 with the whole object, which is how a "verified" read-back can prove nothing. |
|
| 44 |
+
| Small-file fetches | `resolve/main/<small file>` answers **307 β `/api/resolve-cache/<commit sha>/<path>`**. A client that doesn't follow redirects reads the redirect stub as the file. The target embeds the head sha β a free consistency check. |
|
| 45 |
+
| Missing repo | 404 / `RepositoryNotFoundError`. A **timeout is not** "missing", and neither is 403. |
|
| 46 |
+
| 403 is ambiguous | a *private* repo and a *nonexistent* repo both answer 403/404 to the wrong caller. Proving a secret store is private takes **two different calls** (`01` Β§4). |
|
| 47 |
+
| Anonymous reads | public repos are readable with no token, including a checkpoint's `trainer_state.json` β remote loss monitoring needs no credentials. |
|
| 48 |
+
|
| 49 |
+
## Evaluation harness (lm-eval)
|
| 50 |
+
|
| 51 |
+
| Fact | Detail |
|
| 52 |
+
|---|---|
|
| 53 |
+
| Metric keys | shaped `"<name>,<aggregation>"`: `acc,none`, `exact_match,strict-match`. Not settleable from config files; assert the key exists in the *result dict* at smoke time |
|
| 54 |
+
| MMLU | grouped across subjects; the per-group value is a list, so `len()` of the result isn't a row count. Some tasks have **two** metrics (em + strict-match); pick one and record which |
|
| 55 |
+
| Splits | several "zero-shot academic" tasks score on `validation`; some datasets have no `test` split at all |
|
| 56 |
+
| `lm_eval --tasks list` | **not** a listing command in 0.4.13 β `ValueError: Tasks not found: list`. Use `TaskManager().task_index` |
|
| 57 |
+
| Optional deps | `--no-deps` installs import fine and then die at run time on `sacrebleu`. Install with dependencies |
|
| 58 |
+
| Denominators | `n_input` / `n_logged` live in per-task output JSONs; harvest by walking the output tree, and treat a missing denominator as a failed cell, not a zero |
|
| 59 |
+
| **Not measured** | total eval wall-clock for the eight tasks on 2ΓT4. Unknown as of the freeze, which is exactly why `D-019` puts training ahead of it |
|
| 60 |
+
|
| 61 |
+
## Hardware reality check
|
| 62 |
+
|
| 63 |
+
- **fp16 autocast + fp32 master weights + GradScaler** works on Turing. bf16 is unavailable (no Ampere+), so any
|
| 64 |
+
recipe assuming bf16 or Hopper-only kernels (flash-attn/FA2) is out. Eager attention is the price.
|
| 65 |
+
- Optimizer state dominates the artefact: measured **12 bytes per parameter** in a checkpoint
|
| 66 |
+
(fp32 master 4 + two fp32 moments 8 + fp16 grads) β **6Γ the fp16 weight file**, 3Γ an fp32 one. So a 106M
|
| 67 |
+
model ships 1,274,563,198 B. That number, not the weight size, decides the storage cycle.
|
| 68 |
+
- 15.4 GB per card leaves real headroom at this scale; measure it before accepting a memory-saving technique
|
| 69 |
+
that costs throughput (`03` Β§3).
|
| 70 |
+
- A 1B-token run here costs ~22.6 h of stepping against 24.96 h of remaining quota β a **1.48 h margin** after
|
| 71 |
+
D-019's arithmetic. Throughput decisions are quota decisions, and the margin is thin enough that a single
|
| 72 |
+
lost session (4.55 h) spends the week's slack entirely.
|
| 73 |
+
|
| 74 |
+
## The habit
|
| 75 |
+
|
| 76 |
+
Every external system gets a dated table like the above: the number, how it was measured, when, and what would
|
| 77 |
+
invalidate it. When a plan breaks, the cause is rarely your model β it's a platform fact that was true in a doc
|
| 78 |
+
and false on the account.
|
guide/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Training a small LLM from scratch β an operating guide
|
| 2 |
+
|
| 3 |
+
For the next agent session that has to build, train, publish and evaluate a ~100M-parameter language model
|
| 4 |
+
on rented, capped, per-week GPU. It is the distilled version of one real project: 106,194,240 params,
|
| 5 |
+
999,817,216 tokens, 2ΓTesla T4 on Kaggle, storage on the Hugging Face Hub, eight academic benchmarks, and a
|
| 6 |
+
public report β plus 54 written-up failure records spanning E-001β¦E-056 that are the actual source of these rules.
|
| 7 |
+
|
| 8 |
+
Read in order once; then use `06-checklists.md` as the working page.
|
| 9 |
+
|
| 10 |
+
| File | What it covers |
|
| 11 |
+
|---|---|
|
| 12 |
+
| `01-before-you-start.md` | The constitution: what to fix in writing, and why memory files are the real state |
|
| 13 |
+
| `02-data.md` | Mix design, tokenisation, sharding, the contamination audit, publishing reproducibly |
|
| 14 |
+
| `03-preflight.md` | The evidence ladder: free rehearsal β cheap smoke β measurement probe β run |
|
| 15 |
+
| `04-the-run.md` | Checkpoints, resume, session sizing, quota arithmetic, what to do when it breaks |
|
| 16 |
+
| `05-publish-and-evaluate.md` | Model card, clean-room load, benchmark protocol, honest reporting |
|
| 17 |
+
| `06-checklists.md` | Copy-paste gates for each phase, and the recurring failure patterns |
|
| 18 |
+
| `07-platform-notes.md` | Kaggle and HF mechanics measured rather than believed, with the numbers |
|
| 19 |
+
|
| 20 |
+
## The five sentences that matter most
|
| 21 |
+
|
| 22 |
+
1. **Every claim about a tool is a hypothesis until you have executed it** β the expensive mistakes in this
|
| 23 |
+
project were all "documented behaviour" that the installed version did not have.
|
| 24 |
+
2. **Verify bytes, never listings.** A commit that returned, a file that is listed, and bytes that
|
| 25 |
+
download are three different facts, and only the third authorises deleting your copy.
|
| 26 |
+
3. **Design for interruption; it is not an exception.** Every interval must end on a verified, pointed-at
|
| 27 |
+
checkpoint on shared storage, and the only resume test that counts deletes the local disk first.
|
| 28 |
+
4. **Free compute is a strategy, not a fallback.** A CPU rehearsal that costs nine minutes buys back a
|
| 29 |
+
five-hour session; run everything that does not need the accelerator there, forever.
|
| 30 |
+
5. **Write the report before the results exist.** Frozen choices, pre-registered targets and a contamination
|
| 31 |
+
statement composed after you can see the scores are a different kind of document.
|
| 32 |
+
|
| 33 |
+
## What "done" means
|
| 34 |
+
|
| 35 |
+
A public model repo that a stranger loads with `from_pretrained` from an empty cache; a dataset repo whose
|
| 36 |
+
manifest, hashes and exclusion masks let someone rebuild that exact mix; a benchmark table where every row
|
| 37 |
+
names its metric, its shot count and its split, and can be re-run from published config; and a report that
|
| 38 |
+
says what failed. Model quality is not the deliverable β a trustworthy number is.
|