You are a participant in a controlled experiment. You will write the weights of a small neural network directly, by reasoning and arithmetic. There is no training step and you will never see the data. The network is then executed by an independent judge on a sealed test set that you will not see. You are not told the score.

Your working folder is:
{FOLDER}
It is your only workspace. Use absolute paths. It already contains check_spec.py (a validator).

## Task
Language identification of Wikipedia paragraphs. There are 50 languages. Texts come from WiLI-2018: paragraphs of at least 140 characters taken from Wikipedia, balanced across classes. Text is real, so it contains names, numbers and some foreign words.

Class index and language (ISO 639-3 or Wikipedia code, as in WiLI-2018), index 0 first:
0 afr, 1 ara, 2 asm, 3 ben, 4 bul, 5 cat, 6 ces, 7 dan, 8 deu, 9 ell, 10 eng, 11 fas, 12 fin, 13 fra, 14 guj, 15 heb, 16 hin, 17 hun, 18 ind, 19 ita, 20 jpn, 21 kan, 22 kok, 23 kor, 24 mai, 25 mal, 26 mar, 27 msa, 28 nep, 29 nld, 30 nob, 31 ori, 32 pan, 33 pol, 34 por, 35 ron, 36 rus, 37 san, 38 sin, 39 slk, 40 snd, 41 spa, 42 swa, 43 swe, 44 tam, 45 tel, 46 tur, 47 ukr, 48 urd, 49 vie
(asm Assamese, kok Konkani, mai Maithili, msa Malay, nob Norwegian Bokmal, ori Oriya, snd Sindhi, san Sanskrit; the others are the usual codes.)

Input tensor: shape (1024,), float32. A fixed feature map of the text, exactly this code:

```python
"""T3 fixed feature map. Copied verbatim into the T3 writer prompt."""
import math, unicodedata
FEATURE_DIM = 1024
FNV_OFFSET, FNV_PRIME = 2166136261, 16777619

def fnv1a32(data: bytes) -> int:
    h = FNV_OFFSET
    for b in data:
        h ^= b
        h = (h * FNV_PRIME) & 0xFFFFFFFF
    return h

def ngram_bucket(gram: str) -> int:
    return fnv1a32(gram.encode("utf-8")) % FEATURE_DIM

def normalise(text: str) -> str:
    text = unicodedata.normalize("NFC", text).lower()
    text = " ".join(text.split())
    return " " + text + " "

def counts(text: str) -> dict:
    s = normalise(text); c = {}
    for n in (1, 2, 3):
        for i in range(len(s) - n + 1):
            b = ngram_bucket(s[i:i+n]); c[b] = c.get(b, 0) + 1
    return c

def featurise(text: str):
    """Returns (indices, values): sparse L2-normalised hashed char 1,2,3-gram counts."""
    c = counts(text)
    norm = math.sqrt(sum(v*v for v in c.values())) or 1.0
    idx = sorted(c)
    return idx, [c[i]/norm for i in idx]
```

So x[i] = value at bucket i from featurise(text), and zero elsewhere. Feature values are L2-normalised counts of hashed character 1-grams, 2-grams and 3-grams of the lowercased text with single spaces and one space of padding either side. You may copy this code into your script so you can compute buckets for any string you write from memory.
Output: 50 logits. The prediction is argmax.
Metric: accuracy on the sealed test set.

## Architecture language
The network is a sequential model or a simple DAG of standard layers, described in spec.json. No custom code, no lookup outside the weights, no conditionals.

spec.json format:
{"input_shape": [1024], "output": "<name of the last layer>", "layers": [ <layer>, <layer>, ... ]}

Layers are listed in topological order. Each layer has a unique "name" and reads from "input" (the name of an earlier layer, or the literal "input" for the network input). Inputs have a batch dimension that the spec does not mention. The allowed layers are these, with PyTorch semantics exactly:
- {"name":..., "op":"Conv2d", "input":..., "in_channels":C, "out_channels":C2, "kernel_size":k, "stride":1, "padding":0, "bias":true}  (square kernels, integers; stride, padding and bias are optional with these defaults)
- {"name":..., "op":"Linear", "input":..., "in_features":n, "out_features":m, "bias":true}
- {"name":..., "op":"ReLU", "input":...}
- {"name":..., "op":"MaxPool2d", "input":..., "kernel_size":k, "stride":k, "padding":0}  (stride defaults to kernel_size)
- {"name":..., "op":"AvgPool2d", "input":..., "kernel_size":k, "stride":k, "padding":0}
- {"name":..., "op":"Flatten", "input":...}  (flattens everything after the batch dimension, in C order)
- {"name":..., "op":"Concat", "inputs":[name1, name2, ...]}  (concatenates along channel dimension for 4-d tensors, feature dimension for 2-d tensors; 2 or more inputs)

weights.npz holds one array per parameter: "<layer name>.weight" and, when bias is true, "<layer name>.bias". Shapes follow PyTorch: Conv2d weight (out_channels, in_channels, k, k), bias (out_channels); Linear weight (out_features, in_features), bias (out_features). No other keys. Values must be finite. They are loaded as float32.

Parameter cap for this task: 100,000. The count is the total number of entries in weights.npz, zeros included.
A network whose files do not validate, or do not execute, is scored at chance. That is recorded, not dropped.

## Rules (a run that breaks one is thrown out and replaced)
1. Stay inside your folder. Do not read, list or search anything outside it. Do not look at the Python install, the home directory or any other project. Do not check whether any dataset is cached on this machine.
2. No dataset of any kind. Do not read, download or import any data. Do not import torchvision, torch, sklearn, tensorflow, datasets, scipy, PIL or similar. Do not use the internet. Tools: use only Bash, Read, Write and Edit. Do not use WebSearch, WebFetch, ToolSearch, Skill or Agent, and do not start other agents. Do not load any skill; NOTES.md is a technical log, not reader-facing prose.
3. Nothing is trained or fitted. No gradient steps, no perceptron or iterative updates, no least squares, pinv or other matrix solves to fit targets, on any data, real or synthetic. Weights must come from your own reasoning: explicit numbers, formulas, or closed-form computation from things you write from memory yourself (for example, a stroke template you rasterise, or counts over word lists you recall).
4. Zero forward passes. You may not execute the network, or any part of it, in any form (numpy, by hand in code, or otherwise) on any input, real or invented. Do not write a simulator of your network. Reasoning about its behaviour in your head and on paper is what this experiment is. Running check_spec.py is allowed; it only checks shapes and counts.

## What you must leave in your folder
- build_weights.py: when run as `python3 build_weights.py` with no arguments, it writes weights.npz and spec.json next to itself (use the folder of __file__). It imports only numpy and these standard library modules: json, math, os, sys, itertools, collections, functools, unicodedata, struct, re, string, pathlib, typing, dataclasses. It reads no other file; everything it needs is inside the script. It finishes in under 120 seconds. It must be deterministic: a judge reruns it under a sandbox with no network and no file access outside the folder and compares the output bytes. If the rerun does not reproduce your weights, the network is scored at chance. Use np.savez (not savez_compressed); seed any randomness; do not embed dates.
- weights.npz and spec.json, produced by running that script.
- NOTES.md: your reasoning, and one line accounting for each block of weights (what that block does and where its numbers came from).

Run `python3 {FOLDER}/check_spec.py wili {FOLDER}` at the end and make it print OK.

Aim to finish in about 25 minutes. Your reply when finished must be one line: DONE, or FAILED and why. Do not include anything else in the reply.
