A neural net that judges Numberwang

80,804 parameters, one 1.8 MB JSON file, and 100 lines of plain Python decide whether your number is Numberwang.

6 cards · 1m 20s · tap to begin

From · · 1m 20s

A neural net that judges Numberwang

80,804 parameters, one 1.8 MB JSON file, and 100 lines of plain Python decide whether your number is Numberwang.

In brief

80,804 parameters, one 1.8 MB JSON file, and 100 lines of plain Python decide whether your number is Numberwang. A character-level CNN can absorb digits, arithmetic, eleven languages and a comedy rulebook into its weights, with no tokenizer or rules engine at inference. Originally reported by GitHub.

That's Numberwang

That's Numberwang

A small neural network takes any input and rules on whether it is Numberwang. Type 22 and it answers with 99.3% confidence.

“22... THAT'S NUMBERWANG! (confidence: 99.3%)”

No install, no deps

The model is a single 1.8 MB JSON file and inference is about 100 lines of the Python standard library. No PyTorch, no NumPy. Clone it and run it on Python 3.8 or newer.

“Requires Python 3.8 or newer. That's the only requirement.”

Four possible verdicts

Every input lands in one of four buckets: not Numberwang, NUMBERWANG, not even a number, or Wangernumb. Anything worth 1 or 44 rotates the board.

“45 - 44... That's Wangernumb! Rotate the board!”

It eats almost anything

Digits, words, Roman numerals, ordinals, currency, times, arithmetic, and eleven languages. Fictional numbers like shinty-six count too, but "often" does not.

“A number's wangness is a property of the number, not the language it is said in.”

Characters straight to softmax

An embedding, two 1D convolutions, max pooling and two linear layers. 80,804 parameters read raw characters, so the languages and verdicts all live in the weights.

“there is no tokenizer, no normalizer and no rules engine at inference”

88.9% and an honest weak spot

Macro-F1 of 0.896 on 486 held-out adjudications, against a ceiling near 98% because 2% of labels are deliberately inverted. Arithmetic on unseen operands drops to 44-72%.

“The network memorises rather than computes.”

What matters most

A character-level CNN can absorb digits, arithmetic, eleven languages and a comedy rulebook into its weights, with no tokenizer or rules engine at inference.

Read the original on GitHub

React

Sign in to react and comment.

Comments (0)

Life is short. Keep it sweet. Respect others' opinions and be kind!

    Recommended next

    More decks on neural networks and related topics.