From Edge Devices to Workstations: Choosing and Deploying Open-Source LLMs
This guide explains how to choose and deploy open-source large language models across edge devices, workstations, and cloud clusters. It covers how deployment constraints shape model selection, how dense and Mixture of Experts models differ, what small on-device models can handle, how to estimate memory, which quantization formats and runtimes to consider, and how to define latency measurements.
1. Define the Scenario First, Then Choose a Model
The first step in model selection is to define three things: where the model will run, what it will be used for, and how much response latency is acceptable. A model that performs well on a workstation may be unusable on a phone. This guide therefore divides deployment environments into three tiers: on-device hardware (phones, Raspberry Pi-class development boards, and thin-and-light laptops), mid-tier workstations (one or two consumer GPUs, or a Mac with high memory), and cloud clusters. Each tier has different memory limits, power budgets, and latency requirements. Selection should start from these constraints before comparing model capabilities.
2. Dense Models vs. Mixture of Experts Models
Dense models activate all parameters on every inference pass. Their output behavior is relatively predictable, and repeated runs on the same input vary less. This suits scenarios that need a stable baseline, such as automated regression testing, structured information extraction, and long-document analysis. The cost is that compute scales with parameter count. The larger the model, the longer each token takes to process.
Mixture of Experts (MoE) models split the network into multiple experts, and each token is routed to only a few of them. Fewer parameters are active per token, so computation per token is lower. Throughput is usually higher than that of a dense model with the same total parameter count. Two points are easy to overlook:
- All expert weights must stay resident in memory, so VRAM or RAM usage depends on total parameters, not active parameters.
- Routing introduces some output variability, and quantization affects MoE models more strongly. Use quantized versions that the model authors or the community have publicly validated.
The decision rule is simple. If memory capacity is the bottleneck, plan for both dense and MoE models based on total parameters. If compute speed is the bottleneck and memory is sufficient, MoE has the advantage.
3. Capability Limits of Small On-Device Models
1. Image and Video Input
Many on-device models accept image input, and some also accept video. Check the model card to confirm which input types a model supports, rather than relying on marketing descriptions. Two parameters need close attention:
- Image resolution: Variable resolution lets an application adjust the number of visual tokens to suit the task. Higher resolution captures more detail but increases time to first token and memory usage. Simple classification or text recognition tasks can usually use a lower resolution.
- Video input method: Video is typically sampled at fixed intervals and fed to the model as a sequence of images. Confirm the frame sampling rate, maximum frame count, and total duration limit. Otherwise, long videos may be truncated silently.
2. Native Audio Input
A traditional voice interaction pipeline runs microphone, ASR model, text LLM, and TTS. This pipeline needs two models, which doubles memory usage, and ASR errors pass directly into the LLM. Some on-device models accept audio directly, which shortens the pipeline to microphone, multimodal model, and output. This removes one model call and avoids cascading recognition errors.
This approach has trade-offs. Audio input usually has a duration limit, and sample rate, channel count, and encoding format requirements must be checked one by one before integration. With direct audio input, the intermediate transcript is not visible, which makes debugging harder than with an ASR pipeline. Keep a standalone offline transcription tool available for troubleshooting.
Privacy matters because recordings are sensitive data. Applications should clearly tell users that recording is taking place, obtain their consent, and prefer on-device processing. If audio must be uploaded, state how long it will be retained and what it will be used for.
4. Hardware Estimation Before Deployment
1. Estimating VRAM or Memory
You can roughly estimate weight memory with this formula:
Weight memory (GB) ≈ parameters (billions) × bits per parameter ÷ 8
For example, a 4B-parameter model quantized to 4 bits needs about 2 GB for its weights. Actual usage also includes the KV cache and runtime overhead. The KV cache grows with context length, layer count, number of attention heads, and data type. For long-context workloads, it can exceed the size of the weights. As a rule of thumb, reserve about 20% headroom, and measure peak memory on the target device.
2. Quantization Formats
Common quantization formats include:
- GGUF (such as Q4_K_M and Q8_0): Used by llama.cpp and its ecosystem. It supports CPUs and multiple GPU backends, and it suits local and edge devices.
- MLX format: Designed for Apple Silicon, with high efficiency on its unified memory architecture.
- AWQ and GPTQ: Commonly used for GPU inference services with frameworks such as vLLM.
- FP8: Requires support from both the hardware and the framework. The benefit depends on the specific platform.
Lower bit widths save more memory but cause greater accuracy loss. Compare at least 4-bit and 8-bit results, and confirm on your own evaluation set whether the gap is acceptable.
3. Choosing a Runtime
- llama.cpp: Lightweight and suited to CPUs, consumer GPUs, and embedded devices. It can provide an HTTP interface through llama-server.
- Ollama: Built on llama.cpp and suited to quickly validating models locally and calling their interfaces.
- MLX: Suited to local development and inference on Mac.
- vLLM: Targets GPU servers, supports batching and high concurrency, and suits internal team services.
To start a local service on a workstation, you can use the command below. Adjust the model path to match your actual file.
llama-server -m ./model-Q4_K_M.gguf -c 4096 -ngl 99 --port 8080
-c sets the context length, and -ngl specifies how many layers to offload to the GPU. The longer the context, the larger the KV cache.
4. Defining How to Measure Performance
The same model can produce very different numbers depending on how it is measured, so define the method before testing:
- Time to first token (TTFT): The time from sending a request to receiving the first output token, which should
