{"slug": "one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers", "title": "One Local Model Nearly Matched the Cloud. The Rest Couldn’t Count Customers.", "summary": "In a five-run test of ten plain-English data questions against a fictional three-store coffee chain's January–March 2026 sales workbook, only one locally runnable open model came close to OpenAI's cheapest GPT-6 tier, GPT-6 Luna, according to the open-source desktop analysis app Ternlux, which ran all 250 chats through OpenRouter. The four open models tested were Qwen 3.8 27B, Gemma 4 31B, Gemma 4 26B-A4B and Qwen 3.6 35B-A3B, each requiring roughly 16–20 GB of memory at 4-bit quantization; Ternlux noted OpenRouter served them at full precision, so local 4-bit results may differ slightly. The hardest question, counting customers who ordered more than once, had a correct answer of 567, and Ternlux said the misses mattered more than the scores.", "body_md": "We gave four open models you can run on your own computer, and OpenAI’s cheapest GPT-6 model, the same coffee shop data and the same ten questions, five times each. Nobody got a second chance. Here’s who got it right, and why the misses matter more than the scores.\n\n## Why test this at all\n\nEvery time you ask a cloud AI about your sales, your customers or your finances, that data leaves your building. Local models fix that: the model runs on your own machine, and nothing goes anywhere. The question is whether they’re good enough to trust with real analysis.\n\nBenchmarks usually answer that with coding puzzles. We wanted something closer to a normal Tuesday: a small business’s sales data, plain-English questions, and an assistant that has to write the SQL, run it, and give back a number you’d actually act on.\n\n## The setup\n\nEvery test ran through [Ternlux](https://www.ternlux.com/), a free, open-source desktop app for data analysis and workflows. You ask in plain English; it writes and runs the SQL against your data, or builds a reusable workflow you can run again later. It works with cloud models or local ones through Ollama and LM Studio.\n\n### The data: Bean & Brew\n\nA made-up coffee chain with three stores, January to March 2026, in one ordinary Excel workbook. Three sheets: `orders` (5,518 rows), `menu` (14 items with prices) and `stores`. It’s small on purpose, and it’s built like real data is built, which is where it gets interesting.\n\n### The models\n\n| Model | Type | What you’d need to run it | \n|---|---|---|\n| GPT-6 Luna | OpenAI’s cheapest GPT-6 tier | Cloud only (the baseline) | \n| Qwen 3.8 27B | Dense, 27B parameters | ~17 GB at 4-bit; a 32 GB Mac or 24 GB GPU | \n| Gemma 4 31B | Dense, 31B | ~19 GB at 4-bit; a 32 GB Mac or 24 GB GPU | \n| Gemma 4 26B-A4B | Mixture-of-experts, 4B active | Fits a 16 GB laptop | \n| Qwen 3.6 35B-A3B | Mixture-of-experts, 3B active | ~20 GB at 4-bit; a 32 GB computer | \n\n### The rules\n\n- **Every try was a brand-new chat** on an empty workspace: no memory of earlier attempts, no leftover workflows.\n- **Each question ran five times per model.** One lucky answer proves nothing; five shows you whether you can rely on it.\n- **Nobody corrected anything.** If a model asked a question, it got the same reply every time: “Use your best judgment and go ahead.” A wrong answer stayed wrong.\n- **Workflows had to actually work.** Every plan was accepted, built and run, and the table it wrote was checked row by row against the right answer.\n\n**How the models were served.** To run 250 chats in a reasonable time, every model was called through OpenRouter. The four open models are the same ones you can download and run yourself, and Ternlux talked to them exactly the way it talks to Ollama or LM Studio. One difference: OpenRouter runs them at full precision, while a typical local download is compressed to 4-bit, which can cost a little accuracy. Expect your own results to be similar, not identical.\n\n## The ten questions\n\nFive are questions you’d type into a chat. Five ask the assistant to build a workflow: a saved pipeline that writes a table you can reuse. We rated each by how much it takes to get right, not by how long the SQL is.\n\n| # | Question | Level | Right answer | What makes it tricky | \n|---|---|---|---|---|\n| A1 | What was our total revenue in March 2026? | Low | $14,563.40 | Prices are on another sheet, so it needs a join. | \n| A2 | What are our top 3 best-selling items by quantity sold? | Low | Latte, Cold Brew, Cappuccino | A straight sum and sort. | \n| A3 | What is our average order value? | Medium | $9.19 | One order spans several rows; averaging rows gives $6.15. | \n| A4 | Which store has the highest average daily revenue? | Medium | Riverside, $196.68 a day | Riverside opened in February; divide by 90 days and Downtown wins. | \n| A5 | How many customers have ordered from us more than once? | High | 567 | Rows vs. orders, and walk-ins with no customer ID. | \n| W1 | Build a workflow that saves daily revenue for each store. | Medium | 231 rows | Joins all three sheets, groups by day and store. | \n| W2 | Build a workflow that saves monthly sales for each menu item. | Low | 42 rows (14 items × 3 months) | A join and a group by month. | \n| W3 | Build a workflow that saves a customer summary: orders, total spend, last order date, without walk-ins. | High | 674 rows | Must count distinct orders and drop blank IDs. | \n| W4 | Build a workflow that saves each store’s revenue by category and its share of the store’s total. | High | 12 rows | Totals per group, then a share within each store. | \n| W5 | Build a workflow that saves the best-selling item at each store. | Medium | 3 rows | Picking the top item within each store. | \n\n## The results\n\nStart with the big picture: answering questions versus building workflows.\n\nTwo things jump out. First, **Qwen 3.8 27B is genuinely close to the cloud model**: 23 of 25 answers and 24 of 25 workflows. Second, look at the purple. In chat, not a single model ever failed to finish, because when a model’s SQL errors, Ternlux shows it the error and it tries again. When building workflows, the weaker models produced SQL that crashed the moment it ran: 10 times for Gemma 4 31B and 15 for Qwen 3.6.\n\n### Harder questions, wider gaps\n\nGrouping the questions by level shows where each model runs out of road.\n\n## The question that broke almost everyone\n\n“How many customers have ordered from us more than once?”\n\nIt sounds like the easiest question on the list. The answer is **567**. Here’s how the models answered it, across all 25 tries:\n\n| Model | What it said | Right | \n|---|---|---|\n| GPT-6 Luna | 567 four times, 568 once | 5 / 5* | \n| Qwen 3.8 27B | 567, 568, 568, 602, 603 | 3 / 5* | \n| Gemma 4 31B | 603, five times | 0 / 5 | \n| Gemma 4 26B-A4B | 603, five times | 0 / 5 | \n| Qwen 3.6 35B-A3B | 602 or 603, every time | 0 / 5 | \n\nGo back to the sample rows. Two details make this hard:\n\n- **One order is several rows.** Count rows instead of distinct orders, and someone who bought a latte and a croissant once looks like a repeat customer.\n- **Walk-ins have no customer ID.** Forget to leave out the blanks, and 2,262 anonymous rows become one very loyal “customer”.\n\nHere’s the query both Gemmas wrote, give or take a column alias, ten times out of ten:\n\n```\nSELECT COUNT(*) FROM (\n  SELECT customer_id FROM orders\n  GROUP BY customer_id\n  HAVING COUNT(*) > 1    -- counts rows, not orders\n)                        -- and the blank ID counts as a customer\n```\n\nAnd the version that gets it right:\n\n```\nSELECT COUNT(*) FROM (\n  SELECT customer_id FROM orders\n  WHERE customer_id IS NOT NULL\n  GROUP BY customer_id\n  HAVING COUNT(DISTINCT order_id) > 1\n)\n```\n\nThe scary part isn’t the mistake. It’s the delivery. Every wrong answer came back just as confident as a right one: “**603 customers** have ordered from you more than once.” Nothing in the reply tells you to double-check. One Qwen 3.8 try did notice the blank IDs and corrected itself, from 603 to 602, but it still counted rows.\n\n## How the others went wrong\n\nAcross 250 chats, the failures fell into a few clear patterns.\n\n### 1. SQL that crashes when the workflow runs\n\nThe biggest single cause of lost points. Qwen 3.6 wrote joins that kept the `item_id` column from both tables, and the database refused to create a table with two columns of the same name. Same mistake, 12 times. Gemma 4 31B leaned on a DuckDB shortcut, `GROUP BY ALL`, and paired it with features DuckDB can’t combine it with. Its best-seller-per-store workflow failed all five times; in four of them the logic was right, and a plain `GROUP BY store_name, item_name` would have worked.\n\n### 2. “Revenue” that was really the number of items sold\n\nWhen a workflow step lost track of the price, some models quietly used quantity instead and still called the column `revenue`. Gemma 4 26B once reported a store’s average daily revenue as **$40.45**. The real figure is $196.68; $40.45 is the number of drinks and pastries sold per day, with a dollar sign in front.\n\n### 3. Counting rows as orders, again\n\nThe customer-summary workflow (orders and spend per customer) tripped Gemma 4 26B four times out of five, for the same reason as the repeat-customer question. A few tries also reported “total spend” as items bought rather than money.\n\n### 4. Claiming work that never happened\n\nTwice, a model told the user it had built the workflow, “I have submitted the build request”, when no plan existed at all.\n\n### What didn’t go wrong\n\nEvery model got March revenue ($14,563.40) and the top three items (Latte, Cold Brew, Cappuccino) right in all five tries. Joining two sheets to answer a simple question is a solved problem, even for a model that fits on a 16 GB laptop.\n\n## Bigger isn’t automatically better\n\nGemma 4 31B is the full-size version of the 26B-A4B model. It’s slower, needs more memory, and scored exactly the same: 33 out of 50. It answered questions better (20 vs. 17) but built workflows worse (13 vs. 16), mostly through SQL that wouldn’t run. Among the two dense models of about the same size, only Qwen 3.8 came close to the cloud. Which model you pick matters more than how big it is.\n\n## Most of these mistakes are catchable\n\nThe failures split into two kinds, and both have fixes that don’t need a smarter model:\n\n- **Crashing SQL can be caught before you ever see it.** In chat, models fix their own SQL errors when they see them, which is why no chat answer ever failed to finish. Workflows don’t get that loop yet. Running each step’s SQL, including the table it creates, against empty copies of the tables before saving catches every crash type we saw, in milliseconds. We tested it on the failing SQL from this run: it flagged all six kinds of crash, and passed the corrected version.\n- **Counting mistakes need the model to see the data’s shape.** If the assistant is told up front that`orders` has 5,518 rows but only 3,693 distinct order IDs, and that 2,262 rows have no customer ID, the trap stops being a trap. Strong models work it out themselves; smaller ones need it handed to them.\n\n## What it takes to run the winner\n\nQwen 3.8 27B needs about 17 GB just for the model at 4-bit, plus room for the long prompts a data assistant sends. A 16 GB laptop can’t run it well. Realistic options, at late-2026 prices:\n\n| Setup | Approx. cost | Good for | \n|---|---|---|\n| Mac mini M5 Pro, 48 GB | $2,600–2,900 | Quiet, simple, runs in LM Studio or Ollama | \n| MacBook Pro 16″ M5 Pro, 48 GB | $2,900–3,100 | The same, on a laptop | \n| PC with a used RTX 3090 (24 GB) | $2,000–2,500 | Fastest for the money, louder | \n\nIf you only have a 16 GB laptop, Gemma 4 26B-A4B fits. It’s reliable for straightforward questions, but check anything that involves counting customers or orders.\n\n## The takeaway\n\n1. **Local AI is ready for real analysis, with the right model.** Qwen 3.8 27B scored 47 of 50 against the cloud model’s 50, without your data ever leaving your machine.\n2. **Pick the model by testing it, not by its size.** Two similar-sized dense models landed 14 points apart, and the bigger Gemma did no better than the smaller one.\n3. **Simple questions are solved; “what does one row mean” is not.** Every model nailed revenue and top sellers. Only the cloud model reliably handled orders spread over several rows and customers with no ID.\n4. **Wrong answers look exactly like right ones.** Use a tool that shows you the SQL behind every answer, and glance at it for the questions that matter.\n\nThe gap between local and cloud is no longer about whether a local model can write SQL. It’s about whether it understands what’s in your data, and whether your tools catch it when it doesn’t. The first is getting better with every model release. The second you can fix today.\n\n## The data behind this post\n\nEverything above comes from these numbers. Each model answered each question five times in a fresh chat.\n\n| Model | Questions (25) | Workflows (25) | Total, exact | Total, 568 counted | Crashed or unfinished | Median time, question | Median time, workflow | \n|---|---|---|---|---|---|---|---|\n| GPT-6 Luna | 24 (25) | 25 | 49 | 50 | 0 | 20 s | 93 s | \n| Qwen 3.8 27B | 21 (23) | 24 | 45 | 47 | 0 | 18 s | 216 s | \n| Gemma 4 31B | 20 | 13 | 33 | 33 | 10 | 15 s | 68 s | \n| Gemma 4 26B-A4B | 17 | 16 | 33 | 33 | 2 | 26 s | 82 s | \n| Qwen 3.6 35B-A3B | 20 | 9 | 29 | 29 | 15 | 31 s | 250 s | \n\n### How answers were graded\n\n- Answer keys were computed directly from the data with DuckDB. Money had to match to the cent.\n- For workflows, the plan was accepted and run, and the table it wrote was compared row by row with the expected table.\n- A table with the right numbers in a slightly different format (a 0–1 fraction instead of a percent, or a different column or table name) counted as correct, as did one answer that named a store by its ID (S3) instead of its name. This happened 10 times across all models.\n- An answer within 1% of the right number counted as correct in the scores above. Only three answers needed this, all “568” instead of 567.\n- Provider hiccups such as rate limits and timeouts were retried and never scored.\n- Times are from OpenRouter’s servers. A local 4-bit model will be slower.\n- A fifth open model, gpt-oss-20b, was dropped: the provider returned errors for most of its turns, so it couldn’t be tested fairly.", "url": "https://wpnews.pro/news/one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers", "canonical_source": "https://www.ternlux.com/blog/local-ai-vs-cloud-sql-test/", "published_at": "2026-11-05 22:41:12+00:00", "updated_at": "2026-11-05 22:51:42.461741+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "ai-research", "artificial-intelligence"], "entities": ["Ternlux", "OpenAI", "GPT-6 Luna", "Qwen 3.8 27B", "Gemma 4 31B", "Gemma 4 26B-A4B", "Qwen 3.6 35B-A3B", "OpenRouter"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers", "markdown": "https://wpnews.pro/news/one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers.md", "text": "https://wpnews.pro/news/one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers.txt", "jsonld": "https://wpnews.pro/news/one-local-model-nearly-matched-the-cloud-the-rest-couldnt-count-customers.jsonld"}}