PromptDash
A 9B model fine-tuned to build full dashboards and charts from one prompt. Your data never leaves your device.
Code that ran and drew a chart
300 chart questions it never saw in training
Before is the base Qwen3.5-9B with thinking off. After is my fine-tune, lora-v2. Both ran 4-bit on a Mac. All the results
Three prompts, three dashboards
Each dashboard below came out of one run of PromptDash. The model planned every chart and wrote the code that drew it, and I edited nothing by hand.
Excel + CSVAirbnb Dashboard
“thinking of renting out my flat in edinburgh on airbnb. which neighbourhoods charge the most per night, entire place vs private room, and how many reviews do guests leave each month?”
Open the dashboard
PostgresShop Dashboard
“how is my shop doing? revenue by month, which product categories sell best, and which customer regions spend the most”
Open the dashboard
CSVNetflix Dashboard
“how has netflix changed over the years? movies vs tv shows, and the most common ratings”
Open the dashboard
The problem
Analysing sensitive or classified data with a cloud-hosted model, such as Claude or GPT, means sending that data off your machine to someone else's servers.
I wanted to know whether a small model that runs locally could do the analysis instead. As it ships, Qwen3.5-9B could not.
Thinking on, as it ships
16-bit weights, on a rented GPU
Both cards show the base model with no fine-tuning, scored on the same chart questions.
Most of the gap between the two cards is the thinking. With it on, the model writes out its reasoning before any code, and the app cannot run prose. With it off, most of its code ran, but it drew the right kind of chart less than half the time. Fine-tuning had to teach it to choose and build the right chart.
Fine-tuning Qwen3.5-9B
So I fine-tuned Qwen3.5-9B to write chart code in Plotly, a Python charting library.
I trained LoRA adapters with Hugging Face's PEFT library. A LoRA adapter is a small set of extra weights that leaves the base model unchanged. They run on a Mac through MLX at 4-bit; the Training section has the steps.
I made two versions. lora-v1 learned only chart code. lora-v2 is one adapter for three jobs: the analyst, the planner and the chartist.
The base model
From chartist-finetune/README.md and cloud/README.md.
Results
| Measure | Base | lora-v1 | lora-v2 |
|---|---|---|---|
| 300 chart questions | |||
| Code that ran and drew a chart | 68.7% | 89.3% | 94.3% |
| Charts of the right kind | 46.3% | 76.3% | 82.3% |
| 120 dashboard requests | |||
| Plans that needed another try | not run | 54.2% | 12.5% |
| Code that ran and drew a chart | not run | 86.4% | 98.9% |
| Charts of the kind planned | not run | 84.9% | 98.9% |
Every test in this table used data the models never saw in training.
1. How the data was gathered
The first training data came from Plotly's own documentation, a Scrapy crawl of plotly.com/python. Those examples are written for people reading the docs. Almost all of them show the chart on screen, and none prints it as JSON, the only form the app can read.
I distilled new training data from Claude instead, and kept only what passed the app's own checks. Part of the crawl stayed too, rewritten to pass them.
- Claude Haiku
- Wrote business table schemas, each backed by a real CSV, and the questions a person might ask of them.
- Claude Sonnet
- Answered each training question with Plotly code. An answer stayed only if it ran against its CSV in a sandbox that mirrors the app's, and passed the app's checks.
- Claude Opus
- Wrote the planning examples: the analyst's directions and the planner's chart plans. Each one passes the app's plan check against its real table.
- Held-out tests
- Two test sets, one of chart questions and one of dashboard requests, use tables that never appear in training. The script that builds the training data stops if a row comes from one of them.
One adapter, three jobs
- Analyst
- Reads: A profile of the tables and the request
- Writes: Directions worth charting
- Examples written by: Claude Opus
- Planner
- Reads: The profile and the analyst's directions
- Writes: A plan for every chart
- Examples written by: Claude Opus
- Chartist
- Reads: A question or a chart plan, and the table's columns
- Writes: Plotly code, ending in
print(fig.to_json()) - Examples written by: Claude Sonnet, and the rewritten docs
2. Training
Training on my Mac ran out of memory. Qwen3.5's linear-attention layers keep a running state for every token, and training needed far more than the Mac's GPU could hold.
I trained each adapter instead on a single A100 GPU rented on Runpod, with LoRA and PEFT. Training writes a PEFT adapter, which mlx_lm cannot load, so a script converts it to MLX. On the Mac, mlx_lm's server runs the 4-bit base model with the adapter on top.
LoRA training
an A100 rented on Runpod
PEFT adapter
what the training writes
MLX adapter
converted by
cloud/peft_to_mlx.pymlx_lm server
the 4-bit base model with the adapter, on the Mac
3. Harness
This is the code around the model. It builds the prompts, and it checks the plans and the charts against the real data.
Planning
Profile
The app describes each table from a sample of rows spread across it, read from the values alone.
Explore
The model checks up to three facts with its tools, and what they find goes on as a short note.
Analyst
Proposes what is worth charting, from the profiles, the note and the request.
Planner
Writes the plan for every chart in one reply: kind, columns, grouping, aggregation, sort and title.
Plan checks
Code tests every column against the real tables, then the data: too many bars or slices, or a line that would run back and forth. Problems go back to the planner in plain words, for up to three tries.
Drawing each chart
Chartist
Writes the Plotly code for one plan.
Sandbox
Runs the code on the real table.
Drawing check
Code reads the finished figure and sends back a line that runs back and forth, or bars that stack raw rows.
No hardcoded charts. A broken chart goes back to the model with its own code and what went wrong, at most twice. If it still fails, the app reports it as failed, with the reason.
Tool calling
By default, an explore step before the analyst offers the model four tools. The other mode, PLANNER_TOOLS=planner, drops that step: the planner drafts with no tools, then a separate checking turn holds five and sends back only the plans that need a change.
Explore step, the default
find_columns- Columns, in any table, that match a word by name or by their values
inspect_column- Facts about one column, read on the full table
relationship- How two columns relate
preview- What a chart over some columns would show on the real data
Checking turn, PLANNER_TOOLS=planner
row_grain- Which columns identify one row
preview_chart- What the draft plans would draw, with any problem the plan check would raise
find_columns, inspect_column, relationship- The same three as in the explore step
Keeping the prompts short
- Tool results are cut to a fixed size and marked where they were cut.
- The analyst and the planner see only a short note of what the tools found.
- One reply plans every chart on the dashboard.
- Thinking is off for the analyst and the planner, so a reply is the answer alone, with no reasoning written out first.
- A fix sends back the model's own code and what went wrong, in plain words.
Run it on your Mac
The model runs on the Mac itself with mlx_lm, which needs Apple Silicon, and the app runs in Docker beside it.
The README walks through the setup: the model's Python environment, the base model, and where a trained adapter goes. The adapter's weights are not in the repository; they come from a training run, which the Training section describes. Once it is set up, make serve-model starts the model, make up starts the app on localhost:3000, and make smoke checks the whole stack by drawing one real chart.
Dashboards are built by the local model, so your data stays on your machine. The optional Compare models page sends Claude the question the app wrote for each chart, the column names and types, and a few sample rows, to compare its charts with the local model's. When Claude's code fails, that code goes back to Claude with the error.
AGENTS.md has the measured decisions behind it.
make serve-model # terminal 1
make up # terminal 2
make smoke