Kasikornbank's Responsive Natural-Language Transaction Search in Flutter with Local RAG
Original post Responsive Natural-Language Transaction Search in Flutter with Local RAG
Article Summary
Amorn Apichattanakul from KBTG built a natural-language transaction search engine that runs entirely on-device in Flutter. His surprising finding: the 2.59 GB on-device LLM was slower and less accurate than simple Dart rules.
Most RAG tutorials focus on cloud-based LLMs, but Amorn wanted to know what RAG could actually do inside a mobile app. He built a Flutter demo with 5,500 synthetic transactions, testing both traditional search algorithms (BM25, vector embeddings, HNSW) and an optional on-device Gemma 4 E2B model to see where each approach wins.
Key Takeaways
- SQL-first filtering (2ms) beats RAG-only search which can't handle exclusions or math
- Gemma 4 E2B took 6 seconds per query with 50% accuracy vs Dart rules at <1ms with 100%
- Indexing 550 memo transactions takes 1.5 minutes; full 5,500 rows need 17.6 minutes
- Standard search (SQL + vectors) completes in 130ms vs 6,849ms with LLM reasoning
- Gemma's real value: multimodal bridge turning receipt photos into searchable text
On-device RAG works brilliantly for mobile search when you use deterministic code for filtering and save the LLM exclusively for multimodal tasks like image-to-text conversion.
Continue reading
What This Article Covers
Amorn found that Google's on-device ML Kit entity extractor misread the shop name "7-11" as July 2011, and it missed fractional amounts like "3,000.50 baht" entirely.
He wrote deterministic Dart rules that claim sentence spans in strict order: shops, people, memos, amounts, then dates. ML Kit gets demoted to a fallback for whatever text is left over.
Disabling ML Kit completely (NoEntitySource) still scored 31 out of 31 on query plans. The pure Dart rules ran in under 1 millisecond.
This page summarizes “Responsive Natural-Language Transaction Search in Flutter with Local RAG” by Kasikornbank, published Nov 2, 2026. All credit for the original work goes to the authors.