Building JobLit · Interactive field notes
Training a small model to understand job-site commands
A sentence, 4,608 numbers, and six possible answers. How I narrowed a voice feature down to a model that runs in the browser.
Try the actual model ↓“Add an expense for $85 at Home Depot for the Town Hall job.”
I wanted JobLit, my job expense tracker, to turn a spoken command into a prefilled form. The device handles speech recognition. Here’s what happens to the text.
A smaller problem than I expected
I first considered sending the text to an LLM for structured data. Then I explored running an LLM on the device. Both felt like too much machinery for opening a form. Splitting the task made it simpler:
A trained classifier scores six possible actions.
A registry identifies the page or form.
Rules read values and match workspace names.
Only the first part is learned. We train the model to recognize commands, including when to leave ordinary conversation alone.
Six answers, no hidden layers
The model is multinomial logistic regression, trained with scikit-learn and NumPy in Python. Each of 4,608 inputs connects directly to six outputs: open, add, edit, clock in, clock out, and unknown.
Each output is a weighted sum plus a bias; calibrated softmax converts the scores to probabilities. That’s 27,648 learned coefficients and six biases. The exported vocabulary and weights occupy roughly 230 KB and run in JavaScript in the browser.
What we train on
We write sentence templates, fill them with varied names and values, then add fillers, repeated or missing words, and recognition mistakes. Roughly 30% of generated examples are noncommands.
add an expense for {amount} at {vendor}add an expense for $85 at Home Depot
label: addThe 8,416 training examples include 16 feedback corrections. We split templates before generating examples, so testing isn’t just the same sentence with a different dollar amount. Vocabulary statistics come only from training data.
We compare twelve combinations of vocabulary size and regularization using validation macro F1. Half the validation data selects the model; the other half calibrates its probabilities. Test and challenge sets remain separate.
Words become 4,608 numbers
Lowercase the text, simplify punctuation, and replace numbers with #. Collect 2,048 word features, 2,048 character features, and 512 features from the start of the command. Word pairs capture short phrases; character fragments help imperfect words share evidence.
Each pattern has a fixed slot. Matching patterns get a TF-IDF weight based on frequency and distinctiveness; absent patterns stay zero. We normalize the start features and the other features separately. The original text remains available for extracting exact amounts.
Take the model apart.
Type a command. Inspect its numbers, prediction, and the form it would open. This is the exported model from the app, running in your browser.
Where the other details come from
The model predicts “add.” The registry connects “expense” to a form. Extraction rules then read the amount, vendor, job, and description from the original text.
One sentence, six different jobs
Select a colored phrase to trace how it is read.
The extractor reads the original dollar amount as a number. It can also read number words, such as “eighty five dollars.”
entities.amount: 85Rules mark consumed spans so later rules cannot reuse them or read across them. With the amount, job, and vendor removed, the description rule can read the final “for” phrase.
Name matching tolerates small differences: “Homer Depot” matches “Home Depot” in our example workspace. An unfamiliar “Acme Supply” can still be extracted from “at Acme Supply” and passed along as a new vendor name. Neither requires training the action model on that vendor.
Turn the fields into a form
The engine returns an action, intent, and extracted fields. A pure planner resolves names to record IDs and returns a route with prefill values, a choice between matches, or “unknown.”
action: "add"
intent: "create_expense"
amount: 85
jobName: "Town Hall"kind: "open"
url: "/expenses/add/"
project_id: "1"
amount: "85"Expense · $85
Town Hall
Two Miller jobs? Ask which one. Conflicting amounts? Ask for clarification. Cancellation and multiple-command guards can stop a command; when the model disagrees with the action-word rules, it needs at least 80% confidence, and remark rules can still block it.
The router opens the existing page or form. The person reviews and saves. Voice does not create a record on its own.
Check the whole path
| What was checked | Result |
|---|---|
| Correct action | 1,218 / 1,265 · 96% |
| Action-word rules alone | 1,174 / 1,265 · 93% |
| Right form or thing | 557 / 587 · 95% |
| Details reaching the form | 698 / 741 · 94% |
| Correct navigation page | 50 / 50 |
These are saved text tests. Form and detail scores cover their own subsets, including only correctly read actions. They don’t measure microphone accuracy or guarantee unfamiliar phrasing will work.
When something fails, we check whether the fix belongs in training, extraction, or planning. A better action classifier won’t fix a dropped vendor field. Keeping those responsibilities explicit makes this small, local system easier to improve.