hn.today

WangNet – 1.8 MB, zero-dependency Numberwang adjudication in 11 languages

github.com69 points24 comments
Screenshot of WangNet – 1.8 MB, zero-dependency Numberwang adjudication in 11 languages

A compact neural adjudicator labeled "Numberwang" classifies textual input as one of four verdicts: "That's not Numberwang," "THAT'S NUMBERWANG!," "That's not even a number," or "That's Wangernumb!" The full model is a single 1.8 MB JSON file with inference implemented in roughly 100 lines of pure Python (requires only Python 3.8+). It accepts digits and spelled-out numbers in eleven languages, arithmetic expressions (judged by their evaluated result), negatives, decimals, currency and unit notations, Roman numerals, ordinals and words built on numbers; the network operates on raw characters with no tokenizer or rule engine. A demo runs on Hugging Face Spaces via gradio, but the model itself has zero dependencies and also provides a simple load_model/wang_probabilities API for integration.

The network architecture is character→Embedding(32)→Conv1d(128,k=3)→ReLU→Conv1d(128,k=3)→ReLU→global max pool→Linear(128)→ReLU→Linear(4)→softmax, totaling 80,804 parameters. Evaluated on 486 held-out adjudications it achieves 88.9% accuracy and macro-F1 0.896 (per-class F1: not Numberwang 0.851, Numberwang 0.910, not a number 0.886, Wangernumb 0.937). A known weakness is arithmetic with unseen operands (44-72% accuracy) because the model memorizes common expressions rather than computing; if exact arithmetic matters, evaluate expressions before passing results in. The project is MIT-licensed.

Read on github.com24 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.