1. Design for Transparency, Not Magic
Early prototypes hid the AI completely—type a description, get a form. User testing revealed a problem: users didn't trust it. When the AI misunderstood, they had no way to correct it. When it worked, they didn't know why it worked.
Solution: Show the AI's interpretation before generation. Display parsed fields, validation rules, and conditional logic as structured previews. Let users edit the interpretation, not just the prompt. This creates a feedback loop: users learn how to write better prompts, and the system learns what users expect.
2. Escape Hatches at Every Level
AI-generated forms are starting points, not final products. Every element must be editable through both natural language and direct manipulation. Users can:
- Refine prompts to adjust the entire form
- Click individual fields to edit properties directly
- Export to code (React, Vue, HTML) for full customization
- Import existing forms to iterate with AI assistance
This prevents AI lock-in. Users never feel trapped by what the AI generated. If the AI can't do something, the user can.
3. Progressive Complexity
Simple forms ("contact form with name, email, message") work instantly. Complex forms (multi-step flows, conditional logic, custom validation) require more detailed prompts or manual refinement.
Key decision: We don't try to infer complex logic from vague prompts. Instead, we make complexity explicit. "Show field B only if field A is 'yes'" maps directly to readable conditional logic. This makes the system predictable: users understand what the AI can parse and what requires manual specification.
4. Architecture: Constrained Generation
Technical approach: Fine-tuned LLM generates structured JSON (field definitions, validation schemas, logic rules), not HTML/code directly. This JSON feeds into a React renderer with pre-built, accessible components.
Why constrained? Unconstrained code generation produces inconsistent output, accessibility issues, and security risks. Structured generation ensures every form follows best practices: proper ARIA labels, keyboard navigation, validation feedback, responsive layouts.
Model choice: Started with GPT-4, moved to fine-tuned GPT-3.5 for cost/latency. Fine-tuning on form-description pairs dramatically improved accuracy while reducing inference time from 8s to 2s.