Spaces:
Sleeping
title: UI Layout Optimizer
emoji: ๐จ
colorFrom: indigo
colorTo: purple
sdk: docker
pinned: false
UI Layout Optimizer: Adaptive UI Optimization Environment (OpenEnv)
๐ Motivation
In modern digital products, static A/B testing often fails to capture the nuance of diverse user behaviors. The UI Layout Optimizer is an OpenEnv-compliant environment designed to train agents that dynamically adapt layout configurationsโsuch as button sizes, form lengths, and wizard stepsโto maximize conversion rates and user satisfaction in real-time.
By simulating various user personas (impatient, careful, new users) and their psychological responses to UI friction, this environment provides a standardized benchmark for autonomous UI optimization agents.
๐ ๏ธ Environment Specification
Action Space
The agent can manipulate the UI layout through seven distinct actions:
| Action | Description |
|---|---|
increase_button |
Increments the button size multiplier. |
decrease_form |
Reduces the number of form fields to lower friction. |
increase_steps |
Adds a step to the checkout flow/wizard. |
decrease_steps |
Removes a step to streamline the completion flow. |
reorder_sections |
Optimizes the component arrangement. |
set_button_size |
Continuously tunes the button size (0.5 - 2.0). |
noop |
Maintains the current layout state. |
Observation Space
At each step, the agent receives an Observation containing:
- Device:
mobileordesktop(affects user tolerance thresholds). - Layout: Current
button_size,form_length, and number ofsteps. - Progress: A scalar value (0.0 to 1.0) representing task completion.
- Last Action: Feedback on the previous operation.
Task Descriptions
Evaluation is conducted across three difficulty tiers:
- Easy: Discrete actions only, stable user types, and low noise levels.
- Medium: Mixed user personas with stochastic drop-off rates.
- Hard: Hidden user types, continuous action tuning, and highly noisy feedback.
๐ป Usage
Prerequisites
- Python 3.10+
- Hugging Face API Token (for LLM-based agents)
Local Execution
- Install dependencies:
pip install -r requirements.txt - Run the baseline evaluation:
export HF_TOKEN="your_token_here" python baseline.py
Running with Docker
- Build the image:
docker build -t ui-optimizer . - Run the container:
docker run -e HF_TOKEN="your_token_here" ui-optimizer
โ๏ธ Deployment to Hugging Face Spaces
This project is optimized for deployment as a Docker Space.
- Create a new Space on Hugging Face.
- Select Docker as the SDK.
- In the Space Settings, add your
HF_TOKENas a Secret. - Push the project files (including
Dockerfileandrequirements.txt) to the Space repository. - Hugging Face will automatically build and deploy the container.
๐ Baseline Results (Example)
Evaluation results using the provided baseline.py hybrid agent:
| Task | Avg Reward | Completion Rate | Final Score |
|---|---|---|---|
| Easy | 1.8450 | 92.0% | 0.8931 |
| Medium | 1.4210 | 78.0% | 0.7323 |
| Hard | 0.9820 | 54.0% | 0.5126 |
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.