File size: 1,714 Bytes
9b994a0
96439e8
9b994a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96439e8
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
---
license: mit
tags:
- text-generation
- css
- synthetic-data
- custom-model
---

# DivCenterer

A deliberately tiny, single-task decoder-only Transformer that generates CSS to center one div with either CSS Grid or Flexbox.

## Model

- 1,107,216 parameters; 4 decoder layers, width 144, 4 attention heads, SwiGLU width 384.
- Trained from scratch with BF16 autocast and PyTorch SDPA on an AMD Radeon RX 9070 XT.
- Custom 768-token constrained byte-BPE tokenizer; this is not a Transformers `AutoModel` checkpoint.
- Files: `model.safetensors` (weights), `config.json`, `tokenizer.json`, `model.py`, and `tokenizer.py`.

Load the weights with the included implementation:

```python
import json
import torch
from safetensors.torch import load_file
from model import DivCentererLM, ModelConfig

with open("config.json", encoding="utf-8") as stream:
    config = ModelConfig(**json.load(stream))
model = DivCentererLM(config)
model.load_state_dict(load_file("model.safetensors"))
model.eval()
```

## Data and evaluation

The model was trained on a deterministic synthetic dataset. The prompts and HTML are generated from project-specific templates and word lists; no downloaded corpus or pretrained model weights were used. The model and dataset were developed with AI assistance.

Greedy exact-CSS results on the full synthetic evaluation suite:

| Split | Exact |
| --- | ---: |
| Validation | 410/410 |
| Held-out pairs | 410/410 |
| Unseen values | 64/64 |
| Held-out phrasing | 96/96 |
| **Total** | **980/980** |

These scores measure exact matches against the generated dataset's canonical CSS answers.

## License

The files in this repository are licensed under the MIT License. See [LICENSE](LICENSE).