Kolaps27/UI-layout-optimizer
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:
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.pyRunning 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:
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
