Skip to content
Three forbidden lines of generative UI

The three forbidden lines of generative UI, and which layer I stopped at

In internal data tools, you can try letting the model output the interface directly. The user types something like “returns for a certain region in a certain time period” into the input box, the model returns a JSON blob, and the frontend renders it into filters plus charts according to the schema. Demos like this often look good, and live feedback is usually positive.

Three weeks later, this entry point had basically degraded into an ordinary query box. People still clicked dates manually, and the reason was consistent: “It gives something different every time; it’s faster to just fill it in myself.”

After that, I split this feature apart. There was nothing much wrong with the model itself; the problem was elsewhere: the nature of interfaces inherently conflicts with dynamic generation. Below are the lines I drew afterward.

Every time the interface changes, users have to relearn it

I did a very unscientific comparison in my own tool: for the same admin panel’s filters, when the positions were fixed, I stopped looking at them after about two or three days and just clicked by hand; when the positions were random, two weeks later I still had to scan first to find them. The difference is not the ten percent in efficiency; it is “whether you have to think.”

This is not a new discovery; almost every GUI design principle states it. But the narrative around generative UI often ignores it, because what it sells is “the most suitable thing for you every time.” The problem is that “most suitable” starts from the model’s judgment, not from the habits users have already formed. Habits accumulate slowly and are reset to zero once broken.

Learnability can be measured: completion time for the same task, first-attempt success rate, number of help requests, error rate. The benefit of generative interfaces appears in the long tail (the ten-thousandth type of query), and the cost appears on high-frequency paths (the ten-thousandth query). Subsidizing high-frequency costs with long-tail benefits is a hard account to balance.

There is also a more hidden cost. New users enjoy it the first time because they have no old habits to break; but products are not used by new users, they are used by people who have used them for three months. People who build demos and people who use something every day often have completely opposite evaluations of the same interface. This is especially easy to overlook in review meetings, because everyone sitting in the review meeting is seeing it for the first time.

“Generate or not” is also not binary; there are at least several levels in between:

  • Fixed structure, generated content (list items, summaries, chart type selection)
  • Fixed fields, generated order and visibility
  • Fixed skeleton, generated copy
  • Fully generated

I now accept only the first two levels; the third depends on the scenario; the fourth I have seen work well only in demo videos. Everyone is discussing “whether to use generative UI”; I think what is more worth discussing is “which layer to generate at.” Choosing the wrong granularity is harder to fix than choosing the wrong direction: the latter is one decision to tear down and rebuild, while the former is rework across dozens of pages.

Where the cost of error is asymmetric, don’t let the model touch it

A correct generation saves ten seconds; a wrong generation may take half an hour to investigate, and the wrong result may even be used as a conclusion. This asymmetry determines one thing: some interfaces should not be generated even if the generation success rate reaches 95%.

Do the math and it is clear. 95% sounds high, but if half of the remaining 5% of users do not notice on the spot, you are effectively trading 5% silent errors for 95% of ten seconds. This trade only holds when errors can be discovered immediately, and the interface is precisely the layer least likely to be suspected.

I generally divide things into three categories.

The first is irreversible operations: deletion, transfers, publishing, permission changes. These are always static, always require secondary confirmation, and always use explicit action words. Generative UI can handle navigating the user to this static interface, but not drawing the interface itself.

The second is places where users cannot perceive errors. The model quietly changes filter conditions, default values, or time ranges, and what users see is just “why did the data change”; they will not suspect the interface. These errors are the hardest to investigate, because the problem report is one layer removed from the real cause.

The third is interfaces that need to be “pointed at.” During collaboration, “click that export button in the upper right” fails if everyone’s upper right is different. This is rarely mentioned, but it is a hard flaw in team tools. Collaboration presupposes that everyone sees the same thing, and dynamic generation is precisely undermining that premise.

There is also accessibility. Tab order, focus management, and screen reader labels in generated structures basically depend on luck. This is not something to “patch later”; it is structural. You cannot write aria specifications for a DOM that is different every time.

If it cannot be reproduced, it cannot be maintained

The ticket says “that gray button.” You cannot reproduce it.

My minimum requirements for generative UI are three: the same input can produce structurally equivalent output (copy differences allowed, structural differences not allowed); every generation is archived, including prompt, schema, renderer version, and component mapping table; and when something goes wrong, you can roll back to the previous version with one click.

Technically it works like this: the generated result first passes the schema, then the component whitelist, and only then enters the renderer:

TS15 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const UiSchema = z.object({
type: z.enum(["form", "table", "chart"]),
fields: z
.array(
z.object({
name: z.string().regex(/^[a-z_]{2,24}$/),
kind: z.enum(["text", "number", "date", "select"]),
})
)
.min(1)
.max(8),
});

// 白名单之外的意图不硬渲染,降级到最近的静态模板
const FALLBACK = { form: FormTemplate, table: TableTemplate, chart: ChartTemplate };

I keep the whitelist to within a dozen or so components. At first I wanted it broader, but later I found that each additional component means validating styles, keyboard operations, and edge cases one more time, and maintenance cost multiplies.

By the way, the value of this schema is not just validation. It is actually your public commitment to “what this product can generate”: only what can be written into the schema can be generated, and what cannot be written in automatically falls back. Many teams treat it as a technical detail and hand it to the frontend; I tend to maintain it as a product-boundary document.

Then there is consistency testing. Sample the same prompt 20 times and compare structural fingerprints:

TS7 lines
1
2
3
4
5
6
7
// 指纹只取字段名和类型,忽略文案
const fp = (s) =>
s.fields.map((f) => `${f.name}:${f.kind}`).sort().join("|");

const samples = await Promise.all(Array.from({ length: 20 }, () => generate(prompt)));
const kinds = new Set(samples.map(fp)).size;
// 20 次里出现超过 2 种结构,我当它还不稳定

Lowering the temperature is not enough; it only reduces variance, not eliminates it. With 20 samples, if more than 2 structures appear, it is judged unstable. This threshold is my own guess, not an industry standard, but at least it gives the discussion a landing point instead of stopping at “feels okay.”

Another easily overlooked point: the fallback on failure must be static. When the model times out, do not show “try again”; that is the worst intermediate state, where users neither get the interface nor know what to do next. Falling back to a default static filter, even if it is not the most suitable, is better than a spinning blank.

Generate offline, fix online

Let me say something positive. The usage I currently approve of most is letting the model participate at build time and exit at runtime.

The process is roughly: first sample real user queries from logs; run a batch offline to generate candidate interface structures; review manually and pick out the ones worth solidifying and write them as components; at runtime, route by intent to static components, and route misses to a generic query interface as fallback.

In this way, every landing point has been seen by a human: reviewable, testable, rollbackable, and with controllable accessibility. The cost is that new intents have to wait for a release cycle, so the fallback path must be solid; about 80% of long-tail queries will land on that generic interface. This is entirely acceptable, because the remaining 20% of high-frequency ones have already been solidified.

The real bottleneck in this model is not technical; it is human. The middle “manual review” step needs a clear owner, and ideally someone who understands both the business and the data; otherwise what gets reviewed is a bunch of components that look reasonable but nobody uses. I have seen several teams like this; they get stuck at this step not because they cannot build it, but because nobody is willing to do this work long term: it is neither as exciting as tuning models nor as rewarding as shipping new features. I do not have a good solution yet; for now I can only keep the volume small and review once a week in a batch, rather than expecting it to become a real-time pipeline.

What this pattern sacrifices is “instant adaptation” in exchange for “predictability.” In most products, predictability is worth more than instant adaptation. For scenarios that genuinely require instant adaptation, I can currently think of only three: developers’ own debugging panels, one-off data exploration, and empty states and onboarding copy. What they have in common is that it doesn’t matter if they’re wrong—you just restart, or no one looks at them a second time anyway.

So my criterion ultimately boils down to one sentence: if the same user sees an interface for the same intent for the third time within a week, it should be fixed. The threshold of 3 is my guess—it could be 5, it could be 7—but having a number is easier to move forward with than “it depends.”

Next week I plan to dig into the analytics for that internal tool: the repeat render rate for the same user and the same type of intent template. If that number exceeds 30%, it means I’m paying a company-wide cost for a minority of scenarios, and that line needs to be pulled back.

About this Post

This post is written by Lu's Blog, licensed under CC BY-NC 4.0.

#Engineering Judgment #Generative UI #Interaction Design

Comments