Weights move, they don't vanish
61–77% of customers had too little history for the smoothing signal. Instead of scoring them zero, the missing weight moves to RFM, so the score always sums to one and new customers are not punished for missing data.
Client work · March–April 2026 · Agricultural machinery
For a global agricultural machinery manufacturer's Brazilian dealer network: a weekly ranked list of the customers most likely to buy parts and lubricants in the next 30 days, the best product to offer each one, and a fraud check that holds incentive points until an invoice is trusted.
Dealers sell parts and lubricants to farmers who buy a few times a year. Sales teams called whoever they remembered. The manufacturer wanted each dealer to start the week with a short list: who is about to buy, what to offer, and a ready WhatsApp message.
The same data fed an incentive programme where sellers and customers earn points per invoice. Some sellers registered invoices, collected the points and then cancelled them. Checking every invoice with the tax authority is slow and rate-limited, so the answer had to be preventive.
61–77% of customers had too little history for the smoothing signal. Instead of scoring them zero, the missing weight moves to RFM, so the score always sums to one and new customers are not punished for missing data.
Taking the worst category flagged a healthy customer as churning when one of five product lines paused. Weighting by revenue flipped the signal's correlation with purchases from −0.32 to +0.49.
The same-invoice share was above 100% because numerator and denominator were deduplicated on different keys. After the fix the affinity model went from 15 category pairs to 1.4M part-number pairs.
No model runs on the transactional path. Thresholds are computed overnight per seller and per customer, so the insert stays a single indexed lookup.
Points are held until an invoice passes the risk check. The rate-limited tax-authority lookups are spent on labelling training data, not on policing every invoice.
Every flag carries a plain-language reason, the top SHAP features and a recommended action. People decide; the system prioritises.
| Layer | Choice | Why |
|---|---|---|
| Warehouse | BigQuery · SQL, BQML, JS UDF | Recursive smoothing without recursive CTEs; matrix factorisation in place |
| Cold start | TensorFlow NeuMF on Vertex AI | GMF + MLP with side features; split by machine to avoid leakage |
| Serving | FastAPI on Cloud Run | Three-tier fallback: NeuMF, BQML, standard basket |
| Fraud model | XGBoost + SHAP, SMOTE | Imbalanced labels, explanations per invoice |
| Gate | MySQL | Personalised thresholds, one lookup at insert |
| Reports | Local LLM via Ollama | Investigation write-ups without sending data out |
Built March to April 2026. The fraud model was trained on the first 35 confirmed cases and catches all of them; precision is 0.59, so the plan is to retrain at around 200 confirmed cases.
Open items are documented in the repository: smoothing coverage, unmatched part numbers and a move from weekly full refresh to change data capture.
Client name, dealer names and all personal data are withheld.
Tell us the problem, the data and where it needs to run. We'll come back with an architecture and scope proposal.
Email contato@laloop.ai