<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb" -->

---
title: Agentic SQL for Free with Qwen3.8 27B and DuckDB | daily.dev
description: Running Qwen3.8 27B locally alongside DuckDB can deliver agentic SQL performance rivaling frontier cloud models like GPT 5.6 Luna at a fraction of the cost. On...
canonical: https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Agentic SQL for Free with Qwen3.8 27B and DuckDB | daily.dev
og:description: Running Qwen3.8 27B locally alongside DuckDB can deliver agentic SQL performance rivaling frontier cloud models like GPT 5.6 Luna at a fraction of the cost. On...
og:url: https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb
og:image: https://api.daily.dev/og/posts/ZcF9tQvLb.png
og:image:alt: Agentic SQL for Free with Qwen3.8 27B and DuckDB
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic SQL for Free with Qwen3.8 27B and DuckDB

**[MotherDuck](https://daily.dev/sources/motherduck)** · 12 min read · 14 upvotes · 2 comments

## Summary

Running Qwen3.8 27B locally alongside DuckDB can deliver agentic SQL performance rivaling frontier cloud models like GPT 5.6 Luna at a fraction of the cost. On the DABstep SQL benchmark, Qwen beat Luna for under $0.50 in electricity versus over $8, over 17x cheaper, while Gemini-3-Flash remains the most accurate model overall. The piece walks through hardware requirements (16GB+ RAM, ideally 32GB, Mac preferred), quantization tradeoffs (4bit vs 3bit), multi-token prediction tuning, and setup steps to run this locally, alongside caveats around runtime speed, hardware limitations, and depreciation costs. It closes with a note that Duck Labs, DuckDB's developer, is being acquired by Amazon.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://motherduck.com/blog/Agentic-SQL-for-Free-with-Qwen3.8-27B-and-DuckDB>

## Questions this post answers

### How does Qwen3.8 27B running locally compare in cost to GPT 5.6 Luna on SQL benchmark tasks?

Qwen3.8 27B ran for free or under $0.50 in electricity on a laptop and outperformed GPT 5.6 Luna Max, which cost over $8 for the same DABstep SQL benchmark run, making Qwen more than 17 times cheaper. Gemini-3-Flash scored highest on accuracy overall but cost 2.3x more than Luna.

_Anyone weighing local versus cloud LLM costs for SQL agents can track these tradeoffs as they evolve on daily.dev._

### What hardware do I need to run Qwen3.8 27B locally for agentic SQL work?

A laptop with over 16GB of unified memory or a discrete GPU with 16GB of RAM works, though 32GB helps performance noticeably. Macs, especially MacBook Pros, tend to perform better due to higher GPU memory bandwidth. A 4bit quantized model got 98.6% accuracy on an M5 MacBook Air, while a 3bit quant on an older 16GB M1 Pro MacBook Pro reached 96.4% accuracy at roughly 5 tokens per second.

_Developers setting up local LLM workflows for data tasks can follow hardware and quantization tradeoffs like these on daily.dev._

### What is multi-token prediction (MTP) and does it always speed up local LLM inference?

Multi-token prediction guesses several upcoming tokens in advance and verifies them, similar to branch prediction in CPUs, with no accuracy risk since guesses are checked. On a newer MacBook it gave roughly a 30% speed boost with a draft size of 3, but on an older MacBook Pro it actually slowed inference down because the system bottleneck lay elsewhere, making the extra guessing overhead counterproductive.

_Engineers tuning local model inference settings can compare real-world results like these on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 0 upvotes

> How much of the 98.6 percent survives when schema retrieval and SQL generation are scored separately? I'd rerun the same questions with a local context layer. A stale-schema pass could separate retrieval failures from generation failures.

**@pdfopsdev** · 0 upvotes

> tbh the 17x cost number is less interesting than the 98.6% accuracy at 4-bit quant, that's a MacBook Air pulling maybe 20W under load. narrow structured tasks like SQL generation are exactly where quantization doesn't bite you as hard as it does on open-ended chat.

## Similar posts on daily.dev

- [I run a 24GB GPU instead of paying for Claude or Codex, and Qwen 3.6 keeps up more than I expected](https://daily.dev/posts/i-run-a-24gb-gpu-instead-of-paying-for-claude-or-codex-and-qwen-3-6-keeps-up-more-than-i-expected-t74m2hhbi) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#ai](https://daily.dev/tags/ai), [#sql](https://daily.dev/tags/sql), [#local-ai](https://daily.dev/tags/local-ai), [#duckdb](https://daily.dev/tags/duckdb), [#qwen](https://daily.dev/tags/qwen)

[View this post on daily.dev](https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Agentic SQL for Free with Qwen3.8 27B and DuckDB","url":"https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb"},"datePublished":"2026-09-01T11:41:14.646Z","dateModified":"2026-09-01T11:41:42.855Z","description":"Running Qwen3.8 27B locally alongside DuckDB can deliver agentic SQL performance rivaling frontier cloud models like GPT 5.6 Luna at a fraction of the cost. On...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/40dce6be50eca84bf1a42b7db60a0ebf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/40dce6be50eca84bf1a42b7db60a0ebf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"MotherDuck","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"MotherDuck","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/f084d6835eef4c2b83f889f9a4e85ed6","url":"https://daily.dev/sources/motherduck"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":14},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"ai,sql,local-ai,duckdb,qwen","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"MotherDuck","item":"https://daily.dev/sources/motherduck"},{"@type":"ListItem","position":3,"name":"Agentic SQL for Free with Qwen3.8 27B and DuckDB"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb","comment":[{"@type":"Comment","text":"How much of the 98.6 percent survives when schema retrieval and SQL generation are scored separately? I’d rerun the same questions with a local context layer. A stale-schema pass could separate retrieval failures from generation failures.","datePublished":"2026-09-03T20:57:24.378Z","url":"https://daily.dev/posts/ZcF9tQvLb#c-VPmBme1Yh","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}},{"@type":"Comment","text":"tbh the 17x cost number is less interesting than the 98.6% accuracy at 4-bit quant, that’s a MacBook Air pulling maybe 20W under load. narrow structured tasks like SQL generation are exactly where quantization doesn’t bite you as hard as it does on open-ended chat.","datePublished":"2026-09-02T18:04:55.316Z","url":"https://daily.dev/posts/ZcF9tQvLb#c-ztqTbZ9mx","author":{"@type":"Person","name":"PDFops","url":"https://daily.dev/pdfopsdev","image":"https://media.daily.dev/image/upload/s---8isRBKc--/f_auto/v1782922291/avatars/avatar_orjMeK8QKaaVZwGq7ScPz?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/agentic-sql-for-free-with-qwen3-8-27b-and-duckdb-zcf9tqvlb#faq","mainEntity":[{"@type":"Question","name":"How does Qwen3.8 27B running locally compare in cost to GPT 5.6 Luna on SQL benchmark tasks?","acceptedAnswer":{"@type":"Answer","text":"Qwen3.8 27B ran for free or under $0.50 in electricity on a laptop and outperformed GPT 5.6 Luna Max, which cost over $8 for the same DABstep SQL benchmark run, making Qwen more than 17 times cheaper. Gemini-3-Flash scored highest on accuracy overall but cost 2.3x more than Luna. Anyone weighing local versus cloud LLM costs for SQL agents can track these tradeoffs as they evolve on daily.dev."}},{"@type":"Question","name":"What hardware do I need to run Qwen3.8 27B locally for agentic SQL work?","acceptedAnswer":{"@type":"Answer","text":"A laptop with over 16GB of unified memory or a discrete GPU with 16GB of RAM works, though 32GB helps performance noticeably. Macs, especially MacBook Pros, tend to perform better due to higher GPU memory bandwidth. A 4bit quantized model got 98.6% accuracy on an M5 MacBook Air, while a 3bit quant on an older 16GB M1 Pro MacBook Pro reached 96.4% accuracy at roughly 5 tokens per second. Developers setting up local LLM workflows for data tasks can follow hardware and quantization tradeoffs like these on daily.dev."}},{"@type":"Question","name":"What is multi-token prediction (MTP) and does it always speed up local LLM inference?","acceptedAnswer":{"@type":"Answer","text":"Multi-token prediction guesses several upcoming tokens in advance and verifies them, similar to branch prediction in CPUs, with no accuracy risk since guesses are checked. On a newer MacBook it gave roughly a 30% speed boost with a draft size of 3, but on an older MacBook Pro it actually slowed inference down because the system bottleneck lay elsewhere, making the extra guessing overhead counterproductive. Engineers tuning local model inference settings can compare real-world results like these on daily.dev."}}]}
```

