⚙️Model Parameter Reference

Tuning Principle

Fix sequence length and batch size first, then fine-tune model capacity (layers / hidden units / attention heads).

Overfitting Signal

Training loss keeps falling while validation loss rises — the model is too large or trained too long. Reduce capacity or stop early.

Temperature

Temperature only affects the sampling stage, never training. 0 means greedy (always pick the highest-probability number); larger values make the distribution more random.

🧠

LSTM Parameters

Long Short-Term Memory networks carry memory across a sequence via gating. Smaller than Transformers and faster to train in the browser.

Sequence Length

20 – 100 · default 50 · draws

The number of historical draws fed into the model — i.e. how many recent periods are used to predict the next one. Too small and the model can't see enough historical trend and will overfit noise; too large and per-run compute grows linearly while very old information adds little value for the current draw. SSQ: 30–60 recommended; DLT: 40–80.

Layers

1 – 3 · default 2

How many LSTM layers are stacked, determining the model's level of abstraction. One layer already captures short-term dependencies; two is the standard choice and can learn higher-order temporal patterns; three or more easily overfits on lottery data with its extremely low signal-to-noise ratio, and training time scales up sharply. Going beyond 3 is generally not recommended.

Hidden Units

32 – 256 · default 128

The dimension of the internal state vector in each LSTM layer — essentially the model's memory capacity. Too small (< 64) can't retain enough historical patterns; too large (> 256) blows up parameters and overfits severely on datasets of a few hundred to a few thousand samples. For the browser, staying under 192 is advisable.

Embedding Size

8 – 64 · default 32

The dimension of the dense vector each number ID is mapped to. For red balls (33 candidates), 16–32 works well; for blue balls (16 candidates), 8–16. Too small loses semantic distinctions between numbers; too large provides no benefit when the vocabulary is tiny and just adds training overhead.

Epochs

10 – 200 · default 50

How many times the model traverses the full training set. Too few and the model hasn't converged, loss still falling; too many and training loss keeps dropping while validation loss climbs — that's overfitting. Watch val_loss in the training log and stop around the epoch where it starts to rebound.

Batch Size

8 – 128 · default 32

How many samples are used per parameter update. Small batches (8–16) introduce more gradient noise — sometimes better generalization, but slower training. Large batches (64–128) are more stable and faster but tend to converge to sharp minima. With limited sample counts, 16–32 is a good middle ground.

Temperature

0 – 1.5 · default 0.8

Applies only during prediction sampling: 0 means greedy (always the highest-probability number); around 0.5 is conservative and stays close to the model's optimum; 0.8–1.2 smooths the distribution so lower-ranked numbers have a chance of being selected; above 1.5 it approaches uniform randomness. Recommended: 0.7–1.0, balancing model preference with diversity.

🔮

Transformer Parameters

Built on self-attention: processes the entire sequence in parallel, models long-range dependencies better, but has far more parameters and demands more data.

Sequence Length

20 – 100 · default 50 · draws

Same meaning as for LSTM — the historical window size. Because Transformer has global attention, it's less sensitive to sequence length than LSTM, though it still pays the O(N²) complexity cost. 50–80 is a safe range for the browser; beyond 100 things slow down noticeably.

Layers

1 – 4 · default 2

How many encoder layers are stacked. One captures simple patterns; two is the most common balance; three to four models richer interactions but costs noticeably more memory and training time. Lottery data has extremely low signal-to-noise, so beyond 4 layers there's essentially no gain.

Attention Heads

2 – 8 · default 4

The number of parallel attention heads, each attending to different patterns from a different subspace. Must evenly divide the embedding dimension. 2–4 heads suit lottery data; too many heads shrink each head's dimension (embeddingSize / numHeads) until nothing useful can be learned. This site caps it at min(hiddenSize, 4).

Feed-forward Dim

64 – 512 · default 2 × embedding size

The hidden dimension of the feed-forward network inside each Transformer block, usually 2–4× the embedding size. Too small weakens the model's nonlinear capacity; too large inflates parameters and noticeably slows browser training. The default of embeddingSize × 2 covers most scenarios.

Epochs

10 – 200 · default 50

How many times the model traverses the full training set. Transformers converge more slowly than LSTMs and typically need more epochs for the same data volume. Start at 50, watch the val_loss curve, and stop near its inflection point.

Batch Size

8 – 128 · default 32

How many samples are used per parameter update. Transformers are more sensitive to batch size: too small and gradient variance in the attention layers makes training unstable. Recommended 32–64; drop to 16 if memory is tight.

Temperature

0 – 1.5 · default 0.8

Identical to the LSTM setting — sampling only. Transformer outputs are typically sharper than LSTM outputs, so the same temperature makes the model appear more "confident". If selected numbers cluster on a few candidates too tightly, raise the temperature to 1.0–1.2 for more diversity.

Tuning Cheat Sheet

Quickly locate the parameter to adjust based on common symptoms.

SymptomAdjustmentReason
Training loss stays high and falls slowly↑ Hidden units / layersModel capacity is insufficient to fit the data. Increase capacity first, then reassess.
Low training loss but high validation loss↓ Layers / hidden units, ↓ epochsClassic overfitting — the model memorized the training set and can't generalize. Shrink it or stop early.
Training is too slow↓ Sequence length / hidden units, ↑ batch sizeCompute scales quadratically with sequence length. Shortening the window and shrinking the model helps most directly.
Every selection comes out identical↑ TemperatureThe temperature is so low that sampling degenerates into greedy selection. Raising it introduces diversity.
Selections look completely random↓ TemperatureToo high a temperature over-smooths the distribution toward uniform randomness. Lower it to restore the model's preference.