How to Override Detected Hardware Specs in llmfit: A Complete Guide
You can override llmfit's automatic hardware detection using the --ram, --memory, and --cpu-cores command-line flags to simulate any system configuration for model fit testing.
llmfit automatically probes your system's available RAM, GPU VRAM, and CPU core count to determine which LLM models will fit within your hardware constraints. However, when you need to test deployment scenarios against target infrastructure or work around autodetection failures, you can manually override any detected metric. This guide explains how to use the override system implemented in AlexsJones/llmfit and how the tool applies your custom values during the hardware detection workflow.
Command-Line Flags for Hardware Overrides
The tool exposes three explicit flags that replace automatically discovered values:
--ram– Sets the system RAM capacity (e.g.,64Gor128G). On Apple Silicon, this also initializes the GPU VRAM to the same value due to unified memory architecture.--memory– Sets the GPU VRAM capacity independently of system RAM (e.g.,32G). Use this after--ramon Apple Silicon to decouple the values.--cpu-cores– Sets the available CPU core count (e.g.,16or32).
These flags are defined in llmfit-tui/src/main.rs at lines 106-108 and are stored in the HardwareOverrides struct (lines 50-56) before being applied to the baseline detection results.
How the Override System Works Internally
The override mechanism follows a clear pipeline from CLI argument to modified system specification.
CLI Parsing and Structure Definition
When you invoke llmfit, the command-line parser captures your override values into the HardwareOverrides struct. This struct holds optional values for RAM, GPU memory, and CPU cores, providing a type-safe container that travels through the application startup sequence.
Detection Routine and Baseline Creation
The detect_specs() function (located in llmfit-tui/src/main.rs, lines 57-92) first establishes a baseline by calling SystemSpecs::detect(). This baseline reflects your actual hardware: physical RAM installed, GPU VRAM available, and active CPU cores detected by the system.
Applying Overrides to SystemSpecs
After establishing the baseline, detect_specs() conditionally applies your overrides by calling specific mutation methods on the SystemSpecs instance:
with_ram_override()– Implemented inllmfit-core/src/hardware.rs(lines 22-35), this method updates the internal RAM value and, on Apple Silicon systems, synchronizes the GPU VRAM to match.with_cpu_core_override()– Found inllmfit-core/src/hardware.rs(lines 38-41), this replaces the detected core count with your specified value.with_gpu_memory_override()– Updates the GPU VRAM independently, allowing fine-grained control over graphics memory regardless of system RAM settings.
Unified Memory Handling on Apple Silicon
On Apple Silicon Macs, system RAM and GPU VRAM share the same physical pool. When you specify --ram, the tool automatically sets the GPU VRAM value to match, ensuring the unified memory model remains consistent. If you need to simulate asymmetric memory allocation (for example, reserving some RAM for the OS while dedicating the rest to GPU tasks), simply add --memory after --ram to override the VRAM independently.
Practical Usage Examples
Override individual metrics to test specific constraints:
# Simulate a machine with 64 GiB of system RAM
llmfit fit --ram 64G
# Override GPU VRAM when autodetection fails or for discrete GPUs
llmfit fit --memory 32G
# Limit the CPU core count to simulate a slower processor
llmfit fit --cpu-cores 16
Combine multiple flags to create complete hypothetical environments:
# Simulate a high-end deployment server
llmfit fit --ram 128G --memory 48G --cpu-cores 32
On Apple Silicon, set total unified memory then adjust the GPU allocation:
# Total pool is 64G, but only 32G allocated to GPU
llmfit fit --ram 64G --memory 32G
Summary
- Use
--ram,--memory, and--cpu-coresto replace autodetected hardware metrics in llmfit. - The
HardwareOverridesstruct inllmfit-tui/src/main.rs(lines 50-56) stores your CLI values before application. - The
detect_specs()function (lines 57-92) applies overrides viawith_ram_override(),with_gpu_memory_override(), andwith_cpu_core_override()defined inllmfit-core/src/hardware.rs. - On Apple Silicon,
--ramsets both system and GPU memory; use--memoryafterward to adjust VRAM independently. - This system enables "what-if" analysis against target deployment hardware without physical hardware changes.
Frequently Asked Questions
What command-line flags does llmfit provide to override detected hardware specs?
llmfit provides three flags: --ram for system memory, --memory for GPU VRAM, and --cpu-cores for CPU thread count. You can specify values like 64G for memory flags or integers like 16 for core counts. These flags are parsed in llmfit-tui/src/main.rs and stored in the HardwareOverrides struct before being applied to the baseline system detection.
How does llmfit handle RAM overrides on Apple Silicon machines?
On Apple Silicon, the with_ram_override() method in llmfit-core/src/hardware.rs (lines 22-35) automatically synchronizes the GPU VRAM value to match the RAM override, reflecting the unified memory architecture. If you need different values for RAM and VRAM, specify --memory after --ram in your command, which will invoke with_gpu_memory_override() to set the VRAM independently.
Where is the hardware override logic implemented in the source code?
The override logic spans two crates. The CLI flag definitions and HardwareOverrides struct reside in llmfit-tui/src/main.rs (lines 50-56 and 106-108). The actual mutation methods that modify SystemSpecs are implemented in llmfit-core/src/hardware.rs, specifically with_ram_override() at lines 22-35 and with_cpu_core_override() at lines 38-41.
Can I override multiple hardware specs simultaneously in a single command?
Yes, you can combine all three flags in one invocation. For example, llmfit fit --ram 128G --memory 48G --cpu-cores 32 creates a complete hypothetical hardware profile. The detect_specs() function processes each override sequentially, ensuring all your specified values replace the autodetected baseline before the model fit calculation begins.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →