ISS
← Field Notes
AI & AGENTS
November 30, 2025 · AI & Agents · 2 min read

Rewriting an Android Keyboard in Kotlin With On-Device Neural Swipe

A ground-up Kotlin rewrite of Unexpected Keyboard that adds swipe typing powered by ONNX models running entirely on the device.

NeuralKeys, which the codebase calls CleverKeys, is a complete Kotlin rewrite of the Unexpected Keyboard project with neural swipe typing bolted into the core. The pitch is simple to state and hard to build: swipe a path across the keys and get fast, accurate word predictions, with the model running entirely on your device rather than phoning anything home.

Why Rewrite Instead of Extend

Taking an existing keyboard and grafting neural prediction onto it sounds like the cheaper path, but a swipe gesture touches almost everything. It changes how touch input is interpreted, how candidates are generated and ranked, and how the prediction path performs under your thumb in real time. Trying to weave that through code that never anticipated it tends to produce a fragile seam. A clean Kotlin rewrite meant the gesture pipeline and the neural inference could be first-class from the start instead of an afterthought layered on.

The result is a large codebase, 183 Kotlin files, which is itself a signal of how much of a keyboard you end up reinventing once prediction quality becomes the point rather than a bonus.

On-Device Inference With ONNX

The prediction engine runs ONNX models locally. That choice carries real weight for a keyboard specifically: it is the component that sees every character you type, so keeping inference on the device rather than in a service is the difference between a private tool and a surveillance one. The v106 models the project ships report 73.37% accuracy, and the loading path was tuned with a model cache that the notes credit with fifty to eighty percent faster load times.

Those caching and hardware-acceleration details are not incidental. A keyboard has a brutal latency budget, because any lag between gesture and word is felt immediately. Getting the model to load fast and run accelerated is what keeps neural prediction from feeling slower than the dictionary it replaced.

The lesson I take from this one is that when a feature reshapes the core interaction, a rewrite is often cheaper than the retrofit it saves you from. Building the gesture and inference paths in from the ground meant performance and privacy were design constraints, not patches applied after the fact.

Have something that needs building, or stabilizing?

These notes are the work log. The paid work runs through Moonshine Labs, my product and engineering studio. Tell us what you're building, or grab a call.

Work with us →
the studio: moonshinelabs.io