Making-of

The technology behind DrawLa

DrawLa is a fast drawing game — but behind it sits a complete recognition pipeline: a neural network we trained ourselves, a server that returns a prediction eight times per second, and a series of decisions that all served one goal. The recognition has to feel immediate.

The journey of a stroke

What happens when someone draws a line? The path is short, and every stop along it has one job:

  1. The client collects. The interface is built in Flutter and runs from one codebase in the browser, on iOS and on Android. Strokes are kept as lists of points, not as pixels.
  2. Every 120 milliseconds the current state goes out. Over an open WebSocket connection, not as individual HTTP requests — at eight times per second, setting up a connection would cost more than the computation itself.
  3. The server rasterises. The strokes are centred, scaled to a uniform size and drawn into a 96 × 96 greyscale image with a line width of two pixels.
  4. The network judges. ONNX Runtime computes 345 probabilities on the CPU — in single-digit milliseconds.
  5. The best five travel back to every player, who see them as bars.

The whole round trip stays comfortably below the threshold at which people perceive delay. That is why the recognition seems to think along with you rather than trail behind you.

Three decisions that made the difference

Recognition on the server, not on the device. At eight megabytes the model would be small enough to run locally. Fairness argued against it: every player has to see the same verdict, otherwise hardware decides the score. The second reason is maintainability — a new model is rolled out once and takes effect for everyone immediately, with no app update. The case for the opposite approach is covered in Mobile & Edge AI.

A CNN rather than a sequence model. People draw the same cat in completely different orders. An image model is blind to that order — and here that is an advantage, not a loss. The trade-off in detail is in RNN versus CNN.

Smoothed predictions. The first version showed raw output — and flickered between competing words with every stroke. It looked like wild guessing. Exponential smoothing across consecutive predictions fixed it completely without changing accuracy at all. A pure presentation detail that improved how the game feels more than any model improvement since.

The model in numbers

ArchitectureResNet-style CNN, four stages of two residual blocks each
Input96 × 96 pixels, single greyscale channel
Parameters2,004,345 (8.0 MB in fp32)
Classes345
Training40 epochs, AdamW, cosine schedule, label smoothing 0.1
Validation accuracy76.3 % top-1
RuntimeONNX Runtime, CPU, two threads

Seventy-six per cent sounds unremarkable at first. With 345 classes, however, blind guessing lands at 0.29 per cent — the model is roughly 260 times better than chance. And in play the top-5 list is what counts, where the hit rate is considerably higher. A good share of the remaining error cannot be fixed at all: a hurried snail and a hurried seashell are sometimes the same picture.

The game around it

Recognition is only half of it. The server holds the entire game state — rounds, scores, timers, votes — and is the only party allowed to change it. Clients propose actions but decide nothing. That split costs a little latency and saves an entire category of problems that arises when two devices disagree about who won.

Rooms live purely in memory. There is no database and there are no accounts: drawings exist while the game runs and are gone afterwards. That started as a shortcut and turned out to be the better answer — it keeps the privacy policy short and honest.

When players are missing, bots fill in. They replay recorded sketches from the Quick, Draw! dataset stroke by stroke rather than pasting a finished image. That way they pass through the same recognition humans do — including the possibility of not being recognised at all.

RNN vs. CNN

RNNs read strokes as a sequence, CNNs read a sketch as an image — two ways to recognise the same drawing.

Read the comparison →

Quick, Draw! dataset

Google's dataset of 50 million sketches — formats, metadata and the biases worth knowing about.

Dataset explained →

Google QuickDraw on GitHub

Google's archived component repo: web component, data API and self-hosting notes for real doodles.

Put the repo in context →

Mobile & Edge AI

Why small CNNs suit local inference on NPU, GPU or CPU — and when the effort pays off.

Why CNNs fit edge AI →

← Back to the game