Description-Guided Intermediate Representations: Synthesizing Schemas for Smart Home Automation

Hyeongnam JangarXiv 2026

TL;DR

Ask an LLM to write production-grade smart home code directly, and it will likely choke on deeply nested JSON brackets and strict type wrappers. This paper solves that problem by blinding the AI to the ugly target code during the design phase—using plain-English behavior descriptions to invent a clean, flat "middleman" language (Intermediate Representation) instead. Deployed in Samsung’s SmartThings Pet Care Assistant, this approach boosts routine-generation accuracy from 85% to 98% using a fast, lightweight production model.

What Problem Does This Paper Address?

Imagine telling your smart home: "If no motion is detected for 10 minutes, turn off the living-room light, at most once per day." To you, that’s a simple thought. To Samsung’s SmartThings platform, executing that routine requires a rigid, deeply nested JSON payload packed with explicit type declarations and control wrappers.

When lightweight, cost-effective LLMs (the kind you actually want running in production for hundreds of millions of users) try to generate this JSON directly, they frequently fumble the syntax.

A standard software engineering fix is an Intermediate Representation (IR)—a simpler structured format the LLM generates, which deterministic code then compiles into the final ugly JSON. Today, we can even use a heavyweight frontier LLM to automatically design that IR schema and write the translator code.

Here’s the catch: if you show the frontier LLM examples of the final JSON so it knows what to design, structural contamination happens. The LLM accidentally mimics the complex nesting and clunky wrappers of the original JSON in its "simplified" IR, leaving the smaller production LLM struggling with the exact same structural headaches.

Methods

To break this cycle of inherited complexity, Hyeongnam Jang introduces Description-Guided IR alongside an automated pipeline called RoutineGen Refiner.

Instead of feeding raw JSON payloads into the schema-designing LLM (Claude Opus 5.5), the system first translates paired user requests and JSON routines into detailed natural-language routine descriptions. These capture exact logical scopes, durations, and limits while stripping away every trace of JSON field names and nesting. Opus then synthesizes an IR schema purely from user requests and these descriptions. Only after the clean schema is locked in does Opus see the target JSON specification to write the Python-like translator code.

Figure 1: Illustrative comparison for a no-motion routine. The routine payload and Baseline IR nest actions within the daily execution limit; Description-Guided IR separates the limit from the action sequence. Colors mark corre- sponding semantics; ellipses omit metadata and device details.

Because a library designed by a giant model (Opus) might still trip up a smaller Service LLM (like Gemini Flash-Lite), RoutineGen Refiner wraps everything in two feedback loops (without updating model weights):

  1. Automated Refinement Loop: The Service LLM attempts to generate routines on test cases. Opus analyzes any failures and iteratively edits the system prompt, few-shot examples, or translator code.
  2. Human–AI Co-Design Loop: Developers review AI proposals to fix broken test data or clarify ambiguous platform rules before kicking off the next cycle.
Figure 2: The refiner (left) uses the analysis LLM for bootstrapping and refines the library. Service execution (right) shows the main routine-generation path in Pet Care Assistant on SmartThings.

Datasets

Due to user privacy constraints, no production logs were used. Instead, the author used an LLM to synthesize three datasets grounded in SmartThings specifications, covering all 10 supported action types and 8 condition operators:

  • Automated Refinement Dataset (70 cases): Used for bootstrapping and automated prompt/translator edits (45 valid generation requests, 25 refusal cases for unsupported/missing devices).
  • Co-Design Dataset (71 cases): Used for developer review after automated refinement (49 generation, 22 refusal).
  • Final Evaluation Dataset (100 cases): Held-out set for offline testing (78 generation, 22 refusal), with no identical cases shared with the development sets.

Key Insights and Ideas

  • Information hiding improves AI system design: Depriving the schema-design LLM of the target JSON specification is a feature, not a bug. In Figure 1, Baseline IR (which saw the JSON) buried device actions inside a daily execution limit block. Description-Guided IR naturally placed limit and steps side-by-side at the top level, leaving the ugly nesting work to deterministic translator code.
  • You must optimize with the student in the loop: When libraries were built and refined using only Opus, and then handed over to Gemini Flash-Lite at runtime, accuracy dropped by 4 percentage points. Evaluating with the actual Service LLM during refinement exposes small-model quirks (like outputting a raw string "dry" instead of {"text": "dry"}) so the translator can be tweaked to forgive them.
  • Automated loops can’t fix specification bugs: When a prompt said "25 degrees" in a Fahrenheit-display home, the AI proposed converting 25°C to 77°F. Human review caught that device specs strictly dictate default units unless explicitly stated otherwise—proving automated prompt optimizers still need human arbiters for ground-truth conflicts.

Key Results

Evaluated offline across three Gemini service model configurations (3 independent runs each):

  • With the reference Gemini 3.5 Flash-Lite (medium reasoning) model, Description-Guided IR achieved 98.00% mean accuracy, beating Baseline IR (95.00%) and Direct JSON Generation (84.67%).
  • It also slashed latency compared to Direct Generation (4.68s vs. 6.13s per request) and cost 66–69% less per request than Gemini 3.6 Flash alternatives while achieving higher accuracy.
  • Automated refinement proved remarkably resilient: across three Flash-Lite runs, initial bootstrapped accuracy varied wildly from 44% to 95%, yet the refinement loop lifted all three to 97–99%.
Accuracy and latency across models and generation methods

Limitations and Future Work

The quantitative benchmarks only evaluate offline routine generation in specified environments—not generalization to unseen homes, end-to-end user satisfaction in the live Pet Care Assistant, or the isolated impact of the human co-design loop. Furthermore, refusal checks only verify that a request was refused with a non-empty string, not whether the explanation made sense. Looking ahead, the team plans to expand from pet care to general smart home routines, specifically tackling how to modify existing routines rather than just generating new ones from scratch.

Summary updated

BibTeX
@misc{jang2026description,
  author = {Hyeongnam Jang},
  title = {{Description-Guided Intermediate Representations: Synthesizing Schemas for Smart Home Automation}},
  year = {2026},
  eprint = {2611.36829},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.36829},
}
Figure