Edge Multimodal Visual Drift Automation Harness
Generate Python and ADB shell automation scripts to evaluate visual drift, prompt compliance, and thermal throttling on device fleets.
Use this template when setting up automated regression and benchmarking pipelines for on-device generative image models running across varied Android test devices. It creates a complete CLI benchmarking harness script.
Role: Staff Android Test & Hardware Reliability Engineer specializing in edge AI benchmarking.
Context
- Physical device matrix: {{device_farm_matrix}}
- Visual alignment threshold: {{clip_similarity_threshold}}
- Batch execution size: {{test_batch_size}}
- Thermal stabilization interval: {{thermal_cooldown_period_s}}
- Diagnostic metrics gathered: {{adb_profiling_metrics}}
- Output analytics format: {{export_report_format}}
Task
Generate a standalone Python automation script utilizing ADB, UI Automator, and image quality evaluators to execute batch multimodal image generation across {{device_farm_matrix}}, compute visual alignment against reference text prompts, and monitor thermal throttling effects.
Method
- Initialize ADB socket connections and verify device battery levels, thermal zones, and background process states across {{device_farm_matrix}}.
- Dispatch automated multimodal prompt test vectors in iterations of {{test_batch_size}} via Android broadcast intents or instrumentation commands.
- Pull generated artifact bitmaps from internal app storage to the host environment using authenticated ADB streaming.
- Calculate cosine similarity between input prompts and generated output embeddings, validating compliance against {{clip_similarity_threshold}}.
- Poll hardware sensors via
dumpsys batteryandcat /sys/class/thermal/to log {{adb_profiling_metrics}} during sustained inference. - Insert an automated sleep loop for {{thermal_cooldown_period_s}} between batches when thermal thresholds are breached.
- Aggregate memory footprint, token generation speed, and image quality metrics into a formatted file matching {{export_report_format}}.
Constraints
- The script MUST execute concurrently across multiple connected Android serial targets without cross-thread collisions.
- MUST NOT fail silently when an ADB command drops; robust socket reconnection logic is mandatory.
- Thermal recovery pauses MUST dynamically extend if the device battery temperature exceeds 42°C.
- Image evaluation routines must run locally without leaking target images to public cloud APIs.
Output format
Test Environment Config: Dependencies and CLI argument parser definition.Core Test Runner (Python): Full ADB orchestration, prompt injection, and artifact retrieval script.Evaluation & Drift Engine: Python routines calculating embedding similarity and metric logging.Execution CLI Instructions: Command examples targeting multiple ADB device serials.
Self-review
- Ensure device metrics capture runs on a non-blocking daemon thread during inference.
- Validate that all ADB shell processes close standard input/output file descriptors properly.
- Confirm the output format strictly complies with {{export_report_format}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.