We use cookies to make your experience better. By using xero.com, you accept our cookie notice terms.

Brought to you by

Teaching a robot accounting

Posted 6 years ago in Product by Xero
Posted by Xero

Today we’re trying something a bit different. So often in release announcements we talk about something we’ve added, but this time we’re taking something away. Starting today, a pilot group of customers no longer have to code their invoices. Our hope is that they’ll never again have to see this message:

Machine learning - account code validation error Account code validation error

It goes a little deeper than that, though. If you’re accounting-savvy, you could always enter the account codes yourself. The trouble is that small businesses are working so frenetically on their business, that they sometimes get their coding wrong. Even if it’s right, it’s still manual and time-consuming. The only semi-automated option is to set up defaults for your inventory or contacts:

machine learning - contact account code default Contact account code default
machine learning inventory account code default Inventory account code default

To us, these defaults are still a clunky solution. They’re high maintenance and only cater for the simplest of circumstances. It also became very clear to us that they don’t make any use of the expertise of your accountant or bookkeeper! We looked at Find and Recode data to get an idea of common mistakes, and saw millions of problems. Three million, to be exact. Every one of those mistakes represents wasted time, and a missed opportunity.

If we were to fulfill the original vision of Xero, we needed to do better.

“Most of all, we’re just hoping to give you back some hours in your week.”

Rod Drury, Welcome to Xero (2007)

This lofty goal kicked off over a year of intense analysis, research and development. We soon realised the scale of what we were doing. Our customers may all use the same basic accounting system, but each has a unique setup and business process. There are more than ten million different account codes in active use by Xero customers!

Before we could make use of machine learning, we had to get inside your heads. What mental processes do you yourselves use to code? Is the decision based on the contact? The item description? The number of line items? We had to give the machine a place to start, or the answers it gave would not match reality. In ML terms, this process is ‘fitting’. We quickly found that there could be no single model that fit everyone.

Our solution is a tuned machine learning model for every single individual customer. This model learns your invoice coding behaviors. It notes any mistakes recognized by accountants or bookkeepers, and includes corrections. Suggestions and predictions derive from what the model has learned. This approach was 15-20% more accurate than the best ‘rule of thumb’ models we came up with. It reaches 80% accuracy after learning from only four invoices.

Graph of prediction performance by invoices in the training set

Even with this level of confidence, we were concerned. Accurate coding is at the heart of double-entry accounting. It has a financial and reporting impact on a business which we must respect. That’s why for some months now, we’ve been been quietly testing the models against what you’ve been entering. Eight hundred thousand invisible robot assistants have been diligently learning how you do business. We’re finally ready for them to start helping you out.


Mike Porter
March 14, 2017 at 7.10 pm

Thanks Luke
It’s a brave new world, love the theory but interested in how it works in practice, given a 10% error rate. Is it a coding assistant, so the user can correct easily if it’s clearly not right. Or is the user not aware of code and it’s now in the background.? Which sounds cool but might infuriate the diligent bookkeeper!

Over thousands of annual transactions there would be a lot of corrective work. In turn does the AI learn from a financial advisor recoding? Further reducing error rates…

Will AI struggle with unusual transactions, one offs etc, what happens with these?

Luke Gumbley in reply to Mike Porter
March 14, 2017 at 10.09 pm

Hi Mike, great questions! It’s an assistant, as you guessed. Suggestions are made in the current UI, very similar to the way defaults work at the moment. The user can easily correct it if it’s wrong. We have some alternate UIs in the works with a lowered emphasis on the coding, but that’s dependent on success here.

That 10% figure doesn’t necessarily represent errors – just times when what the customer chose was different to what the model predicted. That could be an error on either side! One reason we’re being cautious with the rollout is that by actually showing suggestions we will affect customer behaviour. We’re watching very closely the rate that customers actively disagree with suggestions by choosing something else, and the rate of later recodes of suggested accounts.

On recodes, the system absolutely learns from those. It’s part of the basic idea – it only knows what it’s been taught. If it learns from correct accounts, the suggestions will be correct.

We have some really, really interesting options for unusual or one-off transactions… but before we get too fancy, we’re keen to see how a more basic approach works out (relatively speaking!) For an unusual transaction right now, the suggested code would probably be wrong and you’d need to correct it.

Watch this space for more. The work certainly doesn’t stop here, this is just the first step.

March 15, 2017 at 12.25 am

Where do I sign up!! Can’t wait to see what that brave new world has to offer.

Luke Gumbley in reply to Colleen
March 17, 2017 at 9.05 am

It’s a bit naughty of me, but why don’t you go see what happens if you try and enter an invoice now, Colleen?

March 15, 2017 at 12.14 pm

How does this fit in with software such as Receiptbank etc?

Luke Gumbley in reply to Nick
March 15, 2017 at 12.51 pm

Hi Nick, this improvement is currently for the Xero invoice entry UI only. We’ll be rolling out suggestions like this gradually across the app, but each document type is a different problem to solve so it’ll take a while.

ReceiptBank is unaffected by the change, as it has its own UI. If there’s enough interest, we could open up the suggestion APIs to developers so they could surface them in their add-ons.

Jan in reply to Luke Gumbley
March 19, 2017 at 2.44 am

That would be great! In Datamolino, we capture invoice descriptions and line item descriptions. That may be a good use case for the suggestions!

Bob Harper
March 17, 2017 at 5.13 am

Hi Luke, is the vision for bills to be emailed/uploaded into Xero and for the AI to do everything in terms of data entry and coding?

You’ve go invoice reminders. Why not have a prompt for the business to pay the bill, when it becomes due?

Luke Gumbley in reply to Bob Harper
March 17, 2017 at 6.59 am

Hi Bob! That’s actually three features in one. First, transcription (automatic data entry) – we probably wouldn’t build this ourselves as OCR is pretty well solved. Like our competitors, we’d probably partner.

Second, coding – the system we’ve build for Invoices won’t work directly with Bills (the coding behaviours are too different), but the payables side is next in the team’s sights. If we’ve automatically entered a bill, we could automatically code it… once we know how you code bills.

Third, due date reminders. This would be pretty straightforward, but actually there’s a whole family of related functionality that work would open up. We have some pretty exciting plans for this (bills are a bit of an odd passion of mine). Stay tuned…

Debbie Severiny
March 21, 2017 at 3.26 pm

Hello Luke,
Im a bit confused on all of this. For instance It is my understanding that as a certified bookkeeper/BAS agent I need to ‘sight’ source documents otherwise I could be liable for claiming gst etc when I should not (as one example)… How then will the ‘bots’ be able to do this. EG: plumber hires a subby who thinks he is registered for GSt and puts that on his invoice, but when checked via ABN lookup he is not… (very common this is). How then will the ‘bots’ work that out? and more so they may have the wrong or expired ABN on there invoices too. Then there is the Importing customs Invoices and the GST quagmire there…. The proverbial list goes on. but you get the picture as to my confusion and question I hope…???

March 22, 2017 at 2.50 am

Hi Debbie I think you have missed the point here. The technology is about learning coding behaviour if you correct the coding these actions will be absorbed into ML. I dont think Luke is suggesting that ML is going to detect physical source document problems more how we handle the approach to their input. What you’re saying would be great but we dont live in a perfect world and one has to walk before they can run.

Luke Gumbley in reply to Todd
March 22, 2017 at 9.09 am

Hi Debbie, Todd’s right! We’ve addressed only the coding problem first. We’ve also done it in more of an assistive way for now, rather than trying to remove coding outright. The system only learns from what’s entered, so in order for it to give the right answers it still needs an expert entering and correcting information. The advance is that instead of that being a constant burden, over time the assistant picks up more and more of the slack.

We are actually working on problems like those you mentioned (GST registration and ABNs) with our new contact and business directory work. Take a look at the ‘next 90 days’ section in the recent February wrap up.

James Moore
March 29, 2017 at 2.47 am

Hey guys,

So for all I bitch and moan about the lack of progress on things like including Sales Orders and not having access to things like Google Drive, Dropbox, etc, this is actually some awesome progress. I complained a ton when I saw the AI Assistant chat bot, but if it’s just an outgrowth of this overall project I’m far more ok with it. This is an awesome thing for you guys to focus on, and I’ll be extremely excited if similar functionality comes to bills as well. Our invoice coding is super simple, but we could really use more help on bills.

This is great work guys, thanks for the update.


Leave a reply

Your email address will not be published. Required fields are marked *