Proof-of-Concept Implementation
This repository contains a proof-of-concept system demonstrating the feasibility of using Large Language Models (LLMs) to dynamically generate user interfaces for Internet of Things (IoT) devices at runtime. The system ingests Web of Things (WoT) Thing Descriptions, aggregates device capabilities, and employs a requirements-aware LLM pipeline with schema enforcement to produce context-appropriate interfaces delivered to heterogeneous client devices in real time.
This implementation accompanies the associated scientific paper and serves as its reference implementation.
- Research Context
- System Overview
- Architecture
- Key Contributions
- Installation
- Usage
- Configuration
- Evaluation
- Project Structure
- Troubleshooting
- License
- Citation
Traditional IoT interfaces are either statically designed or require manual configuration for each device type. This proof-of-concept explores an alternative approach where:
- Device capabilities are discovered automatically via standardized Thing Descriptions (W3C Web of Things)
- User interfaces are generated dynamically by an LLM that reasons about available actions, device form factors, and contextual requirements
- Schema enforcement ensures validity through constrained generation and automatic retry mechanisms
- Real-time delivery enables immediate interface updates as the IoT environment changes
The system addresses the research question: Can LLM-driven UI generation provide a viable alternative to static interface design for heterogeneous IoT environments?
The system implements a microkernel architecture where a central orchestration service coordinates between:
- Thing providers exposing IoT device capabilities via WoT Thing Descriptions
- Capability modules providing contextual data (e.g., user activity recognition)
- A knowledge base managing requirements documents and LLM interactions
- Client devices rendering generated interfaces across different form factors
The LLM receives a structured prompt containing available actions, device capabilities, and contextual constraints, then produces a schema-conformant UI specification that clients render natively.
┌─────────────────────────────────────────────────────────────────────────┐
│ Core System (3001) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌───────────────┐ │
│ │ Service │ │ Thing │ │ Action │ │ Orchestrator │ │
│ │ Registry │ │ Ingestion │ │ Registry │ │ │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └───────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────┐ ┌──────────────────┐ │
│ │ WebSocket │ │ REST API │ │
│ │ Server │ │ Endpoints │ │
│ └─────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────────┐ ┌─────────────────┐ ┌──────────────────────┐
│ Knowledge Base │ │ Client Devices │ │ Thing Providers │
│ (3005) │ │ │ │ (3006) │
│ ┌────────────┐ │ │ ┌───────────┐ │ │ ┌────────────────┐ │
│ │ RAG │ │ │ │Smartphone │ │ │ │ Light Switch │ │
│ │ Service │ │ │ │ (5173) │ │ │ │ │ │
│ ├────────────┤ │ │ ├───────────┤ │ │ ├────────────────┤ │
│ │ Guardrails │ │ │ │ Tablet │ │ │ │ TractorBot │ │
│ │ Engine │ │ │ │ (5174) │ │ │ │ │ │
│ ├────────────┤ │ │ ├───────────┤ │ │ └────────────────┘ │
│ │ LLM │ │ │ │ Voice │ │ └──────────────────────┘
│ │ Interface │ │ │ │ Device │ │
│ └────────────┘ │ │ └───────────┘ │ ┌──────────────────────┐
└──────────────────┘ └─────────────────┘ │ Capability Modules │
│ (3003) │
│ ┌────────────────┐ │
│ │ Activity │ │
│ │ Recognition │ │
│ └────────────────┘ │
└──────────────────────┘
| Component | Port | Description |
|---|---|---|
| Core System | 3001 | Central orchestration service managing device/Thing registration, action aggregation, and UI generation coordination |
| Service Registry | 3000 | Maintains registry of all connected services, devices, and capabilities |
| Knowledge Base | 3005 | RAG-enabled service handling requirement documents, LLM guardrails, and schema-enforced generation |
| Things Service | 3006 | Simulates WoT-compliant IoT devices (light switch, robotic arm) |
| Activity Recognition | 3003 | Example capability module providing user activity context |
| Smartphone Device | 5173/3002 | Mobile form factor client with touch-optimized rendering |
| Tablet Device | 5174/3012 | Large-format client with 12-column grid layout system |
| Voice Device | — | Audio-first client for hands-free interaction |
This proof-of-concept demonstrates several aspects:
A single client device can control multiple IoT Things simultaneously. The core system aggregates action catalogs from all registered Things, and the LLM generates unified interfaces with proper thingId attribution.
The knowledge base injects strict constraints preventing the LLM from hallucinating non-existent actions:
- Only registered action IDs may appear in generated UIs
- JSON Schema validation ensures structural conformance
- Automatic retry mechanisms handle generation failures
Thing Descriptions are automatically parsed into a normalized action registry, abstracting transport-layer details (HTTP, CoAP, etc.) from the UI generation process.
External services register as "capabilities" exposing JSON Tool APIs. The LLM can invoke these during generation to incorporate real-time contextual data (e.g., user activity state).
WebSocket connections maintain persistent channels between the core and client devices. Generated UIs are broadcast immediately and cached per-device for reconnection scenarios.
The system generates device-neutral UI specifications that clients interpret according to their form factor, enabling the same logical interface to render appropriately on smartphones, tablets, or voice devices.
- Docker and Docker Compose (recommended)
- Node.js 18+ and npm (for local development)
- Access to an LLM endpoint (local or cloud-based)
# Clone the repository
git clone https://github.com/[repository-url]/IMP.git
cd IMP
# Configure LLM endpoint (optional - defaults to local endpoint)
export LLM_ENDPOINT="http://localhost:1234/v1/chat/completions"
# Build and start all services
docker compose up --buildThe first build may take several minutes. Subsequent starts reuse cached layers.
# Install dependencies (workspaces handle sub-packages)
npm install
# Start services individually
npm run dev --workspace packages/core-system
npm run dev --workspace packages/knowledge-base
npm run dev --workspace packages/things
npm run dev --workspace packages/device
npm run dev --workspace packages/tablet-device
npm run dev --workspace packages/activity-recognitionOnce running, services are accessible at:
| Service | URL |
|---|---|
| Service Registry API | http://localhost:3000 |
| Core System API | http://localhost:3001 |
| Knowledge Base | http://localhost:3005 |
| Activity Recognition | http://localhost:3003 |
| Smartphone UI | http://localhost:5173 |
| Tablet UI | http://localhost:5174 |
# Check registered devices, Things, and capabilities
curl http://localhost:3001/registry
# View available actions from all Things
curl http://localhost:3001/actions
# Manually trigger UI generation
curl -X POST http://localhost:3001/generate-ui- Registration Phase: Devices and Things register with the core system
- Discovery Phase: Core aggregates Thing actions and device capabilities
- Generation Phase: Knowledge base constructs LLM prompt with guardrails
- Delivery Phase: Generated UI broadcasts to target devices via WebSocket
- Interaction Phase: User actions route through core to appropriate Things
| Variable | Description | Default |
|---|---|---|
LLM_ENDPOINT |
Chat completions API URL | http://localhost:1234/v1/chat/completions |
LLM_MODEL |
Model identifier for local endpoints | — |
OPENROUTER_API_KEY |
API key for OpenRouter (if used) | — |
OPENROUTER_MODEL |
Model identifier for OpenRouter | — |
A Docker volume knowledge-base-data persists requirement documents across restarts. To reset:
docker volume rm imp_knowledge-base-dataThe repository includes an evaluation harness for systematic testing:
cd packages/eval-harness
# Direct LLM evaluation
npm run eval -- --mode chat --prompt "Generate a light control UI"
# Full pipeline evaluation
npm run eval -- --mode kb --prompt "Generate a light control UI"Results are saved as timestamped JSON transcripts with heuristic failure detection for regression analysis.
IMP/
├── packages/
│ ├── core-system/ # Orchestration and registry services
│ │ ├── src/
│ │ │ ├── services/ # registry.js, orchestrator.js
│ │ │ ├── transport/ # websocket.js
│ │ │ └── routes.js
│ │ └── action-registry.js
│ ├── knowledge-base/ # RAG and LLM interface
│ │ └── src/
│ │ ├── llm.js # LLM calls with guardrails
│ │ ├── rag.js # Document retrieval
│ │ └── store.js # Requirement storage
│ ├── device/ # Smartphone client
│ │ └── src/
│ │ ├── App.jsx # React UI shell
│ │ └── api.js # Device registration
│ ├── tablet-device/ # Tablet client with grid layout
│ │ └── schema.json # 12-column grid schema
│ ├── voice-device/ # Voice-first client
│ ├── things/ # WoT Thing simulators
│ ├── activity-recognition/ # Capability module example
│ └── eval-harness/ # Evaluation tooling
├── docker-compose.yml # Full stack orchestration
├── architecture.md # Detailed design document
└── .env # Configuration
| Issue | Solution |
|---|---|
| LLM generates invalid actions | Verify Thing registration at /registry; ensure knowledge-base has latest guardrails |
| No UI appears on devices | Check device registration and WebSocket logs: docker compose logs device-api -f |
| Capability errors | Verify capability module registration at /registry |
| Schema validation failures | Check LLM output format; the system retries automatically but persistent failures indicate prompt issues |
This project is released under the MIT License. See LICENSE for details.
If you use this proof-of-concept in your research, please cite:
@software{imp_2025,
author = {[Author Name]},
title = {{IMP}: {LLM}-Driven Dynamic User Interface Generation for {IoT} Environments},
year = {2025},
url = {https://github.com/[repository-url]/IMP}
}Note: This repository serves as the reference implementation for the accompanying scientific paper. For theoretical foundations, experimental methodology, and detailed evaluation results, please refer to the publication.