Neural Sequence & Coin Predictor

Can an AI guess heads or tails better than you? Start with a fair virtual coin, then try a deliberately added pattern. The lesson is learning when there is something to predict—and when there is not.

Optional: model specifications and recorded test score
⚙️ Architecture: 14-dim Input → Dense(32) → Dense(16) → Sigmoid(1) • 💻 Training Platform: PyTorch 2.13 (CPU) • 📉 Objective: Binary cross-entropy; recorded CPU training • ⚡ Inference: Browser tensor calculation; not zero latency • 🎯 Evaluation Accuracy: Loading the current evaluation…
A THREE-STEP EXPERIMENT

First, meet the three kinds of virtual coin

The computer picks heads or tails using a rule. You choose the rule; you and the AI then guess the next result. These are made-up software outcomes, not a model of a coin tumbling through the air.

  1. Start fair. Choose heads or tails below. Each result has an equal chance.
  2. Look at the result. You and the AI each earn a point for a correct guess. Both can score, or both can miss.
  3. Try a pattern. Change the rule and play again. Ask whether a simple guessing strategy could do just as well.

Fair coin: every toss starts fresh

Heads and tails each have a 50% chance, whatever happened before. Past results do not give the AI a predictive advantage.

Example: even after H H H, the next outcome is still equally likely to be H or T. H means heads; T means tails.

What should I compare with this rule?

Watch for: short runs can favor either player by luck. More flips do not create a pattern in a fair process.

2. Make your first guess below. Leave the AI model on its recommended setting for now. Changing the coin rule or model clears the session so scores from different setups are not mixed.

Go to the coin and make a guess →

Optional: compare the two saved AI models

A model is the saved set of numerical settings the AI uses to make guesses. Both models were trained before this page loaded. Playing here does not retrain either one.

The newer model was trained in a controlled follow-up experiment. “Newer” does not guarantee a better score on every rule or short play session. The recorded comparison is below.

Your turn: guess the next face

🏆 HUMAN VICTORY!
Final Score: 6 - 4.

One round means one generated result. Guess heads or tails; the AI makes its own guess from earlier results. A correct guess earns one point, so ties are possible.

Match Format:
Round 1 of 10
How rounds, scores and rematches work

Choose 5, 10 or 20 rounds, or Endless to keep playing. Changing the round count or choosing Rematch resets the match scores; the session's flip history and overall AI accuracy continue until you change the coin rule or model.

You (Human)
0
Intuition & Pattern Guess
Neural AI
0
Fixed published weights
Select your guess to begin Round 1!
Your Turn — Choose Your Prediction:
Heads LIBERTY • 2005
Tails IN AI WE TRUST

The coin animation is decoration. The selected software rule determines each result; button timing does not control it.

Try more flips (optional):
What do Simulate and Auto-run do?

Simulate 10, 50 or 100 generates that many extra results and checks the AI, without asking for your guesses or changing the match scoreboard. Auto-run adds about five per second; click it again to stop. These results do count toward the session's AI accuracy and history.

AI guess & results

Saved model running
AI's next guess
Loading…
Based on the previous ten results, not your button choice.
How strongly the AI favors its guess 68.2%
A model preference, not the measured chance of being right.
AI guesses correct so far
54.8%
+4.8% vs 50.0% random chance baseline
How evenly heads and tails are mixed
0.974 bits
Streak: 2 Heads (Best: 5)
What does this balance number mean?

A value near 1 bit means a fairly even mix of heads and tails. It does not mean the order is unpredictable: H T H T is evenly mixed but follows a pattern. A streak is a run of the same face; Best is the longest run this session.

Optional: inspect the AI inputs and calculations

The model starts with the same ten example outcomes each time the coin rule or model changes. They give it initial inputs and are not scored rounds. The calculation below reads those inputs and the saved model settings; it is not a written thought process.

🧠 Calculated Features & Decision: Local tensor calculation
[READY] Fixed model loaded. Predictions use only prior outcomes.
State Features: Window: 10 flips • Streak Length • Alternation Rate • P(H|H) JavaScript forward pass

Recent flips: what the AI got right

(Last 30 flips • Green check = AI predicted correctly)

H means heads; T means tails. Each tile is an actual result from this session. A green check means the AI guessed that result correctly; a miss means it did not. The strip keeps the most recent 30 results.

Optional: see the neural network and training diagram

🧠 Neural Network Architecture & Gradient Flow

14 Input Features → 32 Dense Units (ReLU) → 16 Dense Units (ReLU) → 1 Sigmoid Output • 1,025 Trainable Parameters
PyTorch 2.13 (CPU)
← Offline training: backpropagation Input (14-dim) x[t-10..-1] Window Streak Len Heads Ratio Alternation P(H | H) Rolling Vector Dense 1 32 Neurons ReLU Act. Dense 2 16 Neurons ReLU Act. Output σ(z3) Sigmoid ∈ (0,1) τ = 0.50 Threshold ≥ 0.5: HEADS < 0.5: TAILS

What is backpropagation? During training, the model works backward from its prediction errors to calculate how its weights (saved numerical settings) should change. The notation ∂L/∂W describes how the error, L, changes with the weights, W. That training happened offline; this page uses the saved weights to make guesses.

Diagram and training terms, explained
Input features
Fourteen numbers describing the previous ten flips and their recent patterns. “Dim” means the number of inputs.
Dense layers
Groups of calculations connected to the previous group. The two hidden groups here have 32 and 16 units.
ReLU
A calculation that keeps positive values and replaces negative ones with zero.
Sigmoid and threshold
The final calculation produces a score between 0 and 1. At 0.5 or above, the model chooses heads; below that, tails. This score is not a verified success probability.
Weights and parameters
The saved numerical settings used in those calculations. This network has 1,025 of them.
PyTorch and CPU
PyTorch is software used to train the model. CPU means the computer's main processor.
Loss and binary cross-entropy
A penalty for prediction errors on two possible outcomes. Lower loss is better on the same examples, but does not prove good performance on new examples.
Epoch and checkpoint
An epoch is one pass through the training examples. A checkpoint is a saved version of the model. The validation results help choose which checkpoint to keep.

How to read the charts

Loss measures prediction error; lower is better on the same examples. Accuracy is the share of guesses that were correct. These charts show saved training until you play, when the accuracy chart switches to your session.

Training, validation, epochs and final tests explained

Training is practice on examples used to adjust the model. Validation is a separate set used to choose which saved version to keep. A final test uses another set after that choice. These are different checks.

Move the pointer across a chart, or touch it, to inspect recorded values. The legend names each colored line. An epoch along the bottom is one pass through the training examples. The charts initially show saved training records. Once you play, the accuracy chart switches to your current session. A high score on an invented pattern does not show an advantage on a real fair coin.

Training: did prediction error go down?

Lower loss means less prediction error on the training examples.
PyTorch 2.13 (CPU)

Accuracy: saved training or this session

Recorded training and validation accuracy; final test is separate
Archived Training Snapshot
CHECK THE EVIDENCE

What does the current model actually achieve?

Both fixed models are evaluated on the same fresh test rows. Compare them with repeat-last-face and always-switch strategies. Changing the play-session generator above is separate from selecting the recorded test subset here.

Loading the reproducible evaluation artifact…
Download the data and see how the experiment was run

The recovered original generator reconstructs 6,000 seed-42 rows. Its 1,200-row validation counts match the saved weights’ 52.58% result. That validates the final evaluation on that split, not every claim in the original write-up.

The new candidate trained on 20,000 synthetic rows, used 5,000 separate validation rows for early stopping, and was compared with the original on 15,000 fresh test rows. Validation selected checkpoint 36; training stopped after 44 epochs. The test set did not select the checkpoint. The recorded curve includes all epochs, while inference uses the selected checkpoint.

All examples are invented stochastic rules, not collected human choices or physical coin measurements. Independent draws can share the same short binary context; that is expected in a finite input space. The splits use separate random seeds.

What should you learn from this?

Balance is not randomness

The balance-entropy gauge uses only the proportions of heads and tails. 01010101 scores 1 bit because half the entries are heads, even though the next entry is predictable. This gauge ignores order.

A fair coin has no exploitable history

For independent fair outcomes, any predictor based only on the past has 50% expected accuracy. Finite samples can finish above or below 50%; that alone proves no advantage.

A constructed pattern needs its own baseline

With 51.5% persistence, always repeating the previous face already has 51.5% expected accuracy. Compare the model with that strategy, not just with random guessing.

Noise needs a definition

Flipping a percentage of binary labels is not the same measurement as audio signal-to-noise power. For power SNR, 10 log10(signal/noise), 0 dB means equal powers. The old unsupported noise-sweep table has been removed.