{"slug": "introducing-prompt-jev-bringing-jev-to-motherduck-sql", "title": "Introducing prompt_jev(): bringing Jev to Motherduck SQL", "summary": "MotherDuck shipped prompt_jev(), an integration with TypeSafe AI's Jev model, which classified 100,000 AG News articles in 40 seconds at 89% accuracy for $0.50, versus $37.58 and 31 minutes 59 seconds for gpt-5.6-terra at 88% accuracy. MotherDuck reported Jev ran at 2,484 rows per second, more than 25x better than the compared LLMs across cost, accuracy and speed, and is invoked as a SQL scalar function returning labels, scores or yes/no decisions with confidence. The company said the speed and cost make table-scale text classification viable where LLM prompting or fine-tuning an encoder like BERT was previously impractical.", "body_md": "# Introducing prompt_jev(): bringing Jev to Motherduck SQL\n\n- 5 min read\n\nText classification in MotherDuck just got about 50x faster at about 1% of the cost. Today we're shipping an integration with [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev), a new kind of AI model from TypeSafe AI. On a 100,000-row benchmark it matched frontier LLM accuracy in 40 seconds for fifty cents. The comparable LLM took more than half an hour and cost $37. When price gets that low and performance is this good, entire tables that were too expensive to handle are easily within reach.\n\nTypeSafe describes the state of AI today as \"databases before SQL”, where we first need to understand the database before we can build the universal language on top. Their pitch for Jev is a frontier-intelligence function call: unstructured state goes in, typed probabilistic decisions come out. We read that and thought, well, this fits right into the universal language of SQL. It can be framed as a function that takes a text column and hands back a label, a score, or a yes/no with a confidence score - exactly how scalar functions today. There is no need to parse the response, and so it's immediately ready to filter, join, and aggregate in the same statement.\n\nThis combination of speed, accuracy, and cost together is what makes new workloads viable. LLMs can already classify text, but running it across a million rows is slow enough and expensive enough it is hard to see the value. The alternative, training an encoder like BERT, means collecting labeled examples and maintaining your own model. This is a big bet for something that may not work until it’s close to prod ready. `prompt_jev()` is configured with a few sentences, runs at analytics speed, and is extremely cost effective for the rows it labels. Below, it pulls the main complaint out of a table of support transcripts:\n\n```\nSELECT\n    conversation_id,\n    prompt_jev(\n        transcript,\n        'Identify the customer''s main complaint',\n        choice := [\n{label: 'billing', description: 'Payments, invoices, and refunds'},\n{label: 'technical', description: 'Errors, outages, and integrations'},\n{label: 'sales', description: 'Pricing and upgrades'},\n{label: 'account', description: 'Cancellations and account administration'}\n\t  ]\n    ) AS classification\nFROM customer_conversations;\n```\n\nWe think this is a very big deal for analytics. A database is, after all, an excellent place to store your million customer conversations. But it’s still really hard to figure out what your customers are complaining about. Before you can track which problems are getting worse, someone or something has to read those conversations and label them. Encoder models like BERT can efficiently classify over a large dataset, but first you have to collect labeled examples, fine-tune the model, and improve the model as new data comes in. This takes patience and expertise. On the other hand, LLMs enable you to just prompt for what you want instead, but running one across a meaningfully large dataset is slow, expensive, and error-prone.\n\n`prompt_jev()` gives you LLM-style ergonomics with encoder-style efficiency, all at analytics scale. Here are some comparisons that made us excited:\n\n| model | rows/s | accuracy | Retail cost/100k | wall time at 100k rows | \n|---|---|---|---|---|\n| **Jev** | **2,484** | **89%** | **$0.50** | **40s** | \n| gpt-4o-mini | 84 | 80% | $1.93 | 19m 45s | \n| gpt-5-nano | 94 | 83% | $1.58 | 17m 49s | \n| gpt-5.6-luna | 61 | 84% | $3.53 | 27m 25s | \n| gpt-5.6-terra | 52 | 88% | $37.58 | 31m 59s | \n\n*We benchmarked on 100,000 articles sampled from the training split of [AG News](https://huggingface.co/datasets/fancyzhx/ag_news), the four-class news topic dataset introduced by [Zhang, Zhao & LeCun (2015)](https://arxiv.org/abs/1509.01626), scoring each model against the ground truth.*\n\nWhat really excited us was that it exceed existing models by >25x across cost, accuracy, and speed dimensions. Furthermore, tests at 1m and 10m rows yielded similar performance (and in some cases even faster than our baseline presented above).\n\n`prompt_jev()` is available on all paid MotherDuck plans. Pick a question you’ve been putting off and try it on your own data!\n\n## Dive into Jev\n\nUse [our guide to learn how to use MotherDuck and Jev together](https://motherduck.com/docs/key-tasks/ai-and-motherduck/classify-text-with-prompt-jev/) for classifying text. Or play around with the Dive below to see what is possible.\n\n## Further Reading\n\n##    And if you need some inspiration - run the benchmark yourself!\n\n```\n-- 1) Load AG News (train split) straight from Hugging Face and draw the 100k sample\nCREATE TABLE ag_train AS\nSELECT row_number() OVER () AS id, text, label\nFROM 'hf://datasets/fancyzhx/ag_news/data/train-00000-of-00001.parquet';\n\nCREATE TABLE sample_100k AS\nSELECT * FROM ag_train USING SAMPLE 100000 ROWS (reservoir, 43);\n\n-- 2) Classify every row with prompt_jev\nCREATE TABLE preds AS\nSELECT id, label,\n       prompt_jev(text,\n                  'Classify the topic of this news article.',\n                  choice := ['World', 'Sports', 'Business', 'Sci/Tech']) AS result\nFROM sample_100k;\n\n-- 3) Score against the dataset labels\nCREATE MACRO ag_name(l) AS ['World', 'Sports', 'Business', 'Sci/Tech'][l + 1];\n\n-- overall accuracy (NULLs reported separately, never scored as wrong)\nSELECT count(*)                                              AS n,\n       count(*) FILTER (WHERE result.choice IS NULL)         AS nulls,\n       round(avg((result.choice = ag_name(label))::INT), 4)  AS accuracy,\n       round(avg(result.confidence), 3)                      AS mean_confidence\nFROM preds;\n\n-- per-class precision, recall, F1\nWITH c AS (\n  SELECT ag_name(label) AS truth, result.choice AS pred FROM preds WHERE result.choice IS NOT NULL\n), k AS (SELECT unnest(['World', 'Sports', 'Business', 'Sci/Tech']) AS class)\nSELECT class,\n       count(*) FILTER (WHERE truth = class AND pred = class) AS tp,\n       count(*) FILTER (WHERE truth <> class AND pred = class) AS fp,\n       count(*) FILTER (WHERE truth = class AND pred <> class) AS fn,\n       round(tp / (tp + fp), 4) AS \"precision\",\n       round(tp / (tp + fn), 4) AS recall,\n       round(2 * tp / (2 * tp + fp + fn), 4) AS f1\nFROM k CROSS JOIN c GROUP BY class ORDER BY class;\n\n-- confusion matrix\nPIVOT (SELECT ag_name(label) AS truth, result.choice AS pred FROM preds)\nON pred USING count(*) GROUP BY truth ORDER BY truth;\n```\n\nTable of contents\n\nRead Next", "url": "https://wpnews.pro/news/introducing-prompt-jev-bringing-jev-to-motherduck-sql", "canonical_source": "https://motherduck.com/blog/motherduck-supports-jev", "published_at": "2026-09-21 00:00:00+00:00", "updated_at": "2026-10-05 19:47:01.394895+00:00", "lang": "en", "topics": ["ai-products", "ai-tools", "large-language-models", "artificial-intelligence", "developer-tools"], "entities": ["MotherDuck", "Jev", "TypeSafe AI", "prompt_jev()", "gpt-4o-mini", "gpt-5-nano", "gpt-5.6-luna", "gpt-5.6-terra"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/introducing-prompt-jev-bringing-jev-to-motherduck-sql", "markdown": "https://wpnews.pro/news/introducing-prompt-jev-bringing-jev-to-motherduck-sql.md", "text": "https://wpnews.pro/news/introducing-prompt-jev-bringing-jev-to-motherduck-sql.txt", "jsonld": "https://wpnews.pro/news/introducing-prompt-jev-bringing-jev-to-motherduck-sql.jsonld"}}