All writing

Project

Giving Roastbook its own on-device reader

On a Samsung flagship, the only built-in model my coffee app could reach failed to run, so the question became whether the app could carry one of its own.

On a Galaxy S26 Ultra, the first phone I tried that wasn’t a Pixel, Roastbook said it was reading the coffee bag. The fields never filled in, however many times I retried or relaunched.

Roastbook is my coffee journal: photograph a bag, let the phone pull out its details, then record what I thought of the coffee. On my Pixel, Gemini Nano, the model built into the phone, does the reading. The app isn’t on Play yet and hasn’t gone out to testers; a closed test is being set up.

Of the apps I’ve built, Roastbook is one I believe fills a genuine gap, at least on Android, so if I ever hand it to people beyond Pixel owners, it has to read bags on their phones too. I had expected a phone this new and this capable to carry models at least as strong as the Pixel’s, possibly stronger.

My first guess was a Pixel-specific call somewhere in my own code. The logs, which a coding agent pulled from the phone, showed something else. Roastbook reaches Nano through ML Kit’s GenAI API, Google’s cross-manufacturer path, which lists the S26 family as supported. On this phone Nano reported itself available and then failed to load on the phone’s AI accelerator, and the step that prepares the model could sit waiting on a download that never completed. One boundary on that: my unit runs a pre-release build of the system service that hosts Nano, so a phone off the shelf may behave differently. I haven’t been able to check.

Samsung’s own models are reserved for Samsung’s own apps: the permissions that reach them are signature-level, and there is no public SDK. Android’s platform intelligence service is privileged the same way. The one built-in model an app I install can reach is the one Roastbook already used. Whether Samsung’s models are any good I’ll never know, which makes me skeptical of broad claims about AI on smartphones.

If the phone’s model wouldn’t run for the app, the app would have to carry one. I needed something small enough that the download wouldn’t take forever, accurate enough to read a bag, and able to run on the CPU, because plenty of phones have GPUs these runtimes can’t use well. Gemma 4 E2B, run through LiteRT-LM, was the winner.

In late September a coding agent measured Gemma on that Samsung, copying the Pixel’s test: the app’s exact prompt, full-resolution photos and OCR text from four real bags, ten fields per bag, with the Pixel’s own Nano answers as the reference. That reference isn’t ground truth. One disagreement was Gemma reading a 10-ounce bag as 283.5 grams against the Pixel’s 284, so these numbers mean “agrees with the Pixel,” not “correct.” On the S26’s CPU, Gemma matched the Pixel on 33 of 40 fields and on all 12 headline fields (each bag’s roaster, name and origin), and every answer came back as valid JSON. Each bag took 19 to 34 seconds and about 4 GB of memory.

The GPU was faster and unusable. Any configuration that decoded on it dropped digits and scattered commas through the output on prompts this long, which matches an open bug in the runtime, so the GPU stays off until a release fixes it. The lighter options all lost the same thing: the photos. Fed only the OCR text, the same Gemma agreed on 22 of 40 fields, and a 0.6-billion-parameter text model managed 16 and took longer. Without the pictures, the models couldn’t tell the coffee’s name from a tagline, or from the name of the subscription box it arrived in.

I approved the tier, and a coding agent built it overnight. Roastbook still asks Nano first. Where Nano is missing or has failed on that phone, Settings offers an on-device reader: a one-time 2.6 GB download, checksum-verified and over Wi-Fi by default, that runs on the CPU and can finish a read in the background after I save the bag. Phones that report less than 6.5 GiB of memory, which rules out the 6 GB class, are pointed at a cloud key of their own instead.

Ideally, I’d buy one flagship from each major manufacturer and run this same suite on all of them before deciding which tier each one gets. For a side project that isn’t feasible, so the evidence stops at my Pixel and this one Samsung, on its pre-release system software. The reader built into Roastbook has since run end to end on that Samsung, so the app can now read a bag there without a cloud call.