"We Need Structured Output": Towards User-centered Constraints on Large Language Model Output

Michael Xieyang Liu, Frederick Liu, Alexander J. Fiannaca, Terry Koo, Lucas Dixon, Michael Terry, Carrie J. Cai

Abstract

While Large Language Models (LLMs) excel at creative generation, their inherent unpredictability poses significant challenges for software integration. This paper investigates the specific constraints industry professionals require—ranging from strict JSON schemas to stylistic personas—and introduces ConstraintMaker, a prototype tool that bridges the gap between natural language prompting and rigid programmatic requirements through a GUI-to-regex pipeline.

Introduction

LLMs are often described as "unbounded," a trait that is beneficial for open-ended tasks but problematic for developers needing predictable, structured data. Integrating an LLM into a software pipeline requires the model to adhere to strict rules; a single formatting error, such as a missing comma in a JSON object or an unwanted conversational preamble, can break downstream systems. Currently, developers rely on "prompt engineering" or complex post-processing "plumbing code" to manage these outputs. This research aims to move toward a more disciplined, user-centered approach by systematically categorizing user needs and providing tools to enforce them.

Methodology

The researchers employed a multi-stage approach to address the "plumbing tax" paid by developers:

  1. User Survey: 51 industry professionals provided 134 real-world use cases detailing their needs for constrained LLM output.
  2. Taxonomy Development: These use cases were analyzed to create a comprehensive taxonomy of constraints, divided into low-level (formatting) and high-level (semantic) categories.
  3. ConstraintMaker Prototype: A web-based tool was developed to allow users to define "constraint primitives" (e.g., JSON objects, multiple-choice lists) via a GUI.
  4. Technical Implementation: The tool converts GUI selections into regular expressions (regex), which then guide a finite-state machine (FSM)-based decoding process. This ensures the model physically cannot generate a token that violates the defined structure.

Taxonomy of Constraints

Analysis of the 134 use cases revealed a clear hierarchy of needs. The researchers identified six primary categories of constraints, ranging from objective formatting to subjective stylistic choices.

Table 1: Taxonomy of constraints identified from 134 industry use cases, showing the prevalence and precision requirements for each category.

As shown in the taxonomy, structured output (26.1%) and multiple-choice selection (23.9%) are the most frequently requested low-level constraints. These require "Exact" precision to be useful in programmatic contexts, highlighting why traditional natural language prompting often fails.

User Preferences and Tooling

A key finding of the study is the "preference split" between different input modalities. Users overwhelmingly prefer graphical user interfaces (GUIs) for objective, quantifiable constraints like JSON schemas or word counts. In contrast, they prefer natural language for subjective or nuanced constraints, such as mimicking a specific persona or tone.

Figure 1: User preference for Natural Language (NL) versus Graphical User Interface (GUI) across different constraint types. Objective constraints show a strong preference for GUI.

By separating the task (what the model should do) from the format (how the result should look), ConstraintMaker allows for cleaner prompts and higher reliability. Early testers reported that the tool made the model feel "less like a black box" and provided a "heightened sense of assurance" that the output would be valid for downstream execution.

Discussion and Future Work

While the FSM-based approach is highly effective for "hard" constraints (like JSON), enforcing "soft" semantic constraints (e.g., "don't be offensive") remains a challenge for regex-based systems. Future work includes exploring ways to automatically infer constraints from user prompts, suggesting appropriate primitives (like a "List" constraint) as the user types to proactively help structure the output.

Summary updated

BibTeX
@inproceedings{liu2024we,
  author = {Michael Xieyang Liu and Frederick Liu and Alexander J. Fiannaca and Terry Koo and Lucas Dixon and Michael Terry and Carrie J. Cai},
  title = {{"We Need Structured Output": Towards User-centered Constraints on Large Language Model Output}},
  booktitle = {CHI Extended Abstracts},
  year = {2024},
  doi = {10.1145/3613905.3650756},
}
Figure