Kartik Vij

Why we moved identity checks onto the customer's phone

Every identity check at customer onboarding was a paid vendor service. Most of them now run on the customer's phone. The one that needs a large model runs on our own server.

Kartik Vij,

Customer onboarding in a regulated business runs on identity documents. A customer photographs their ID, takes a selfie, and a chain of checks runs before anything is stored: is the photo usable, what does it say, which parts must be hidden, is the person real, and is it the same person as on the document.

When I arrived, every link in that chain was a vendor service: one for blur detection, one for text recognition, one for masking, one to confirm a live person was present, and one for face matching. Each was billed per use, so the cost of onboarding grew with every customer, and a cost like that should not grow with the business.

The question was not whether these checks could be done without vendors. It was which of them could be done on the device the customer is already holding. The answer turned out to be most of them.

Blur detection is a simple calculation on the image. It runs on the phone in milliseconds and stops a bad photo before it is uploaded, which also saves the round trip to the server.

Text recognition on identity documents is a solved problem on a phone. The standard mobile toolkits read the fields well, and a small model trained to pick out the handful of fields we care about finds the right ones. Masking follows from recognition. Once you know where the digits are, covering the ones you must not keep is a matter of drawing a rectangle. Watermarking marks the digits that may be kept.

The check that a live person is present was the surprising one. The vendor approach is passive: analyse the selfie for signs of a screen or a printout. We replaced it with an active check. The app asks for something random, such as turn your head left, now blink, now look right, and captures the frame at the moment the person has just complied. It is harder to fake, it needs no model, and it gives the next step a better photo.

Background removal for that selfie, so that the stored photo is on plain white, runs on the phone as well.

Then comes face matching, which is the one step that needs a large model. Comparing a selfie with the photo on an identity document, across differences in lighting, age and camera quality, is not something a low-end phone does well. So it stayed on a server, but not a vendor's server. A face-recognition model, tuned on the kinds of documents we actually see, runs on machines the company already pays for. The cost of a match became the cost of the server, which does not change when the hundredth customer becomes the thousandth.

We learned a few things along the way.

The cheapest phones set the limit. Everything had to run on the cheapest Android phone the customer base uses, which ruled out anything heavy. That constraint made the design better rather than worse.

Masking follows rules, not preferences. Which digits of a national identity number may be stored is defined, so the masking had to be exact. Approximate was not an option.

Measure against the vendor from the first week. The one thing I would change is that the accuracy comparison came later than it should have. Each component should carry its own proof on the day it is proposed, on the same test set as the service it replaces, so that switching the vendor off is a decision backed by evidence.

The chain is being switched off one link at a time, as each on-device component proves itself. The per-call bill is heading to zero for everything except the one step that genuinely needs a model, and that step costs a server.

The rule we arrived at is simple. If a check is a calculation or a small model, it belongs on the phone. If it needs a large model, it belongs on your own server. It belongs with a vendor only when neither of those is possible.

If your business has a problem like this

Somewhere in most businesses there is a process that takes far too long, or a bill that nobody can explain. Write to me with the details. Within two working days I will tell you whether it is worth fixing, and what the smallest system to fix it would be.