Skip to content

← All writing

· 3 min read

Constrain the model, not the question

Why I think the safest way to let an LLM near a warehouse is to take away its ability to improvise, and why that moves the hard work somewhere else.

  • LLM
  • Data governance
  • MCP

A wrong number that looks right is the worst thing a data tool can produce. People act on it, and nobody checks it. It’s the risk I keep coming back to as my team works on letting people ask questions of our warehouse from their own AI tools.

This isn’t a results post. The work is still pre-launch, so I have no numbers yet. It’s the reasoning behind a design choice I think is right, written down so I can be held to it.

How a model gets a number wrong

It rarely invents a fact from nothing. The failure is quieter: the model writes a perfectly plausible query that answers a slightly different question from the one you asked.

  • It picks one of two similarly named tables, and one of them is stale or partial.
  • It joins in a way that repeats rows, so totals are double-counted.
  • It filters on a column whose name matches your wording but whose meaning doesn’t match the business’s definition.
  • It aggregates at the wrong grain, per order when you meant per customer.

In every case the query runs, a number comes back, and it looks reasonable. Nothing errors, which is exactly what makes it dangerous.

Three ways to put a model near a warehouse

Approach What the model can do How it fails What you have to trust
Raw tables and text-to-SQL Write any query Plausible but wrong, silently Every query, one at a time
A semantic layer Choose from defined metrics and dimensions Asks for a combination that makes no sense The layer’s definitions
Governed views behind a narrow tool interface Call named views, nothing else “I can’t answer that”, more often The views, which people already agreed on

These aren’t exclusive. What I’m helping build is the third, sitting on a governed view layer that already existed, so the AI inherits definitions that were agreed before it arrived.

What I mean by constrained

These are the principles I’m pushing for. The details of our implementation are still moving.

  • The model never sees raw tables. It can only reach what has been deliberately exposed.
  • Each metric has one home. A single, versioned view. If two people want different definitions, that is a conversation for people, not a choice the model makes.
  • The interface explains itself. What each view means, what one row represents, and its known caveats, so an answer can quote the definition it used.
  • Declining is a feature. If a question falls outside what’s exposed, the right response is to say so and point to an analyst, not to improvise.

The cost is real. A constrained tool will say “I can’t answer that” more often than a free one, and people may read that as it being less capable. I think that’s the right trade at the start, and I’ll be watching to see whether it holds up.

The model was never the hard part

The hardest work isn’t wiring a model to a warehouse. It’s getting a definition that is true.

In a data-quality workstream I found that a flag documented as covering all active prospects covered about 42% of them (the write-up is here). A model asked for “qualified prospects” would have used that flag with total confidence. The risk was never the model. It was a definition that didn’t mean what everyone thought it meant, and a fast, fluent system spreads that kind of mistake further and quicker than any dashboard.

That is why I think the order of the work matters: settle what the words mean first, then let the model use them.

What I don’t know yet

We haven’t launched, so I can’t say whether this shortens the wait for ad-hoc answers, which is the goal. What I plan to watch:

  • Whether answers state the definition they used, and whether people read it.
  • How often the tool declines, and whether those declines are the right ones.
  • Whether the queue of one-off requests actually shrinks.
  • Whether people trust a “no” as much as a “yes”.

I’ll come back and update this post with what I find, including the parts that don’t go the way I expect.

If you’re building something similar and disagree with the trade, I’d like to hear why. You can reach me here.