TL;DR
This paper benchmarks the performance of 25 quantized open-source Large Language Models (LLMs) on three popular single-board computers (SBCs) using two inference runtimes. The findings reveal that SBCs can effectively run LLMs up to 1.5 billion parameters, with the Llamafile runtime offering significant advantages in speed and power efficiency over Ollama, paving the way for more accessible and private on-device AI.
What Problem Does This Paper Address?
The increasing demand for LLM capabilities is pushing towards on-device inference for reasons of privacy, cost, and reduced latency. However, deploying these computationally intensive models on resource-constrained edge devices like single-board computers (SBCs) remains a significant challenge. While cloud-based solutions are powerful, they come with limitations. This paper addresses the gap in understanding how well various LLMs perform on affordable SBCs, exploring the trade-offs between model size, hardware capabilities, and inference software to provide practical guidance for edge AI deployments.
Methods
The researchers conducted a comprehensive benchmark of 25 quantized open-source LLMs across three SBCs: Raspberry Pi 4, Raspberry Pi 5, and Orange Pi 5 Pro. They utilized two inference runtimes: Ollama, a widely adopted and robust runtime, and Llamafile, a more experimental, single-file executable runtime. The evaluation involved three distinct prompt types designed to simulate realistic workloads, and performance was measured using metrics like token generation speed (tokens per second), peak RAM usage, and power consumption. They also explored the impact of varying CPU core configurations on the Orange Pi 5 Pro. All LLMs were quantized using the q4_k_m scheme to balance efficiency and performance.
Datasets
The paper does not explicitly mention training datasets for the LLMs, as it focuses on evaluating pre-trained, quantized models. The "datasets" in this context are the LLMs themselves and the prompts used for evaluation. The prompts were:
- "Write a 5-paragraph paper on American history."
- "Who is Donald Trump and was he looked at favorably during his time as U.S. president?"
- "Write a two-sentence haiku about human nature."
The authors also provide a link to their benchmark code and results ([1]), which could be considered a form of benchmark dataset.
Key Insights and Ideas
- SBCs are viable for LLM inference: Contrary to potential skepticism, SBCs can reliably support LLM inference, especially for models up to 1.5 billion parameters. This opens doors for localized, private AI applications without relying on expensive cloud infrastructure.
- Llamafile is the performance champion: For the tested SBCs, Llamafile consistently outperformed Ollama, delivering up to 4x higher throughput and 30-40% lower power consumption. This highlights the significant impact of runtime choice on edge LLM performance.
- Model size vs. hardware matters: Smaller models (under 1B parameters) run exceptionally well on even the most basic SBCs, achieving high speeds. Larger models (3B+) are practically deployable only on more powerful SBCs like the Orange Pi 5 Pro, and even then, with reduced throughput.
- Quantization is crucial: The
q4_k_mquantization scheme was essential for enabling LLM inference on memory-limited devices with minimal performance degradation. - CPU heterogeneity is complex: The Orange Pi 5 Pro's hybrid CPU architecture showed interesting behavior, with Llamafile's performance peaking at 4 cores and declining with more, suggesting potential bottlenecks in multithreaded execution for that specific runtime. Ollama, however, scaled better with more cores.
Key Results
- Throughput: Llamafile achieved up to 4x higher token generation speed compared to Ollama. On the Orange Pi 5 Pro, smaller models (<1B parameters) surpassed 20 tokens/second, while larger models (3B-7B) achieved usable throughput between 1.5-5 tokens/second.
- Power Consumption: Llamafile reduced power usage by 30-40% compared to Ollama. Peak power consumption ranged from 8W on the Raspberry Pi 4 to 14W on the Orange Pi 5 Pro.
- Model Support: SBCs can reliably support models up to 1.5B parameters. The Raspberry Pi 4 is best suited for ultra-lightweight tasks, the Raspberry Pi 5 for small-to-mid scale LLMs (up to 1.5B), and the Orange Pi 5 Pro for models up to 7B parameters.
- Runtime Performance: Llamafile demonstrated superior performance and efficiency, especially on the Orange Pi 5 Pro and Raspberry Pi 5. Ollama's performance degraded with fewer active CPU cores.
Limitations and Future Work
Limitations: * The study focused on a specific set of quantized LLMs and SBCs. The findings might not generalize to all LLMs or all edge hardware. * The evaluation of Llamafile on Raspberry Pi 4 and 5 was limited due to compatibility issues. * While prompt processing speed was measured, the paper primarily focuses on generation speed and doesn't delve deeply into response quality differences.
Future Work: The authors suggest exploring additional optimization strategies such as dynamic quantization, hardware-specific scheduling, and mixed-precision execution. They also aim to investigate a broader range of edge hardware and real-world workloads beyond summarization prompts. Further research into architectural bottlenecks and runtime optimizations for heterogeneous CPU architectures is also implied.
Summary updated