# Optimization [← Home](../README.md) ## Power tweaking LLM token generation is mostly **memory-bandwidth bound**, so lowering the power limit often costs little speed while saving a lot of watts and heat. Prompt processing and image generation are more compute bound and react more to power limits. ### Linux Power limits are exposed via hwmon (values in microwatts): ```bash # find the card's hwmon ls /sys/class/drm/card*/device/hwmon/ cat /sys/class/drm/card0/device/hwmon/hwmon*/power1_max # current limit echo 150000000 | sudo tee /sys/class/drm/card0/device/hwmon/hwmon*/power1_max # 150 W ``` - Attribute names differ between `i915` and `xe` drivers — TODO: document both. - `xpu-smi` can also set limits on supported cards. ### Windows - Intel Graphics Software / Arc Control: power limit slider, voltage, frequency offset. ### Measurements TODO: tokens/s vs. power limit curve per card (see [Benchmarks](benchmarks.md)). ## Idle power Arc cards are known for high idle draw. Mitigations: - Enable **PCIe ASPM** (L1) in BIOS. - Linux: `pcie_aspm=force` / `pcie_aspm.policy=powersupersave` kernel parameter (test carefully). - Windows: Power plan → PCI Express → Link State Power Management → Maximum power savings. TODO: measured idle values before/after. ## Clocks & fans TODO: frequency limits (`/sys/class/drm/card*/gt_max_freq_mhz` on i915), fan curves. ## Memory / model side - Pick a quantization that fits fully in VRAM — offloading to CPU kills performance. - KV-cache quantization (e.g. llama.cpp `--cache-type-k q8_0`) to fit longer contexts. - Flash attention where supported. - Reduce context length to what you need. ## Runtime-specific tuning TODO: llama.cpp SYCL env vars, OpenVINO hints (`PERFORMANCE_HINT`, `KV_CACHE_PRECISION`), vLLM settings.