← Back to list

Running Large Language Models Locally Without a GPU

Talib · 2024-06-09 15:21 · 69 claps · 3.0 min read paywalled
#generative-ai #ollama #local-llm #llm-on-cpu #llm
Open on Medium ↗
Wiki topics: LLM · Large Language Models OPS · LLMOps & Inference AI · AI · General 🏃 · Running & Endurance

Running Large Language Models Locally Without a GPU

Artificial intelligence (AI) and natural language processing (NLP) have seen revolutionary changes in recent years due to the development of large language models, or LLMs. Some models, such GPT-3, LLaMA, and PaLM, have shown to be remarkably adept at understanding and generating text that resembles that of a human. But in order to run these models, you usually need advanced hardware, especially GPUs, which can be costly and out of reach for many researchers and developers. Thankfully, new developments allow LLMs to be executed locally without the need for a GPU. We’ll look at how to do this with tools like ollama and local-llm in this blog article.

The Challenge of Running LLMs

Because LLMs involve a lot of calculation, they demand a lot of memory and processing power. GPUs have historically been the preferred hardware because of their capacity for parallel processing while running these models. High-end GPUs aren’t available to everyone, and cloud-based solutions might be expensive. This has made it more difficult for many people to use or experiment with LLMs.

To tackle this difficulty, local-llm and ollama have developed as two useful tools. These tools make LLM creation more affordable and accessible by allowing you to execute LLMs on your local computer utilising just your CPU and RAM.

Local-llm

Developed by Google, local-llm is a tool designed to run LLMs on local machines or cloud workstations using CPU and memory instead of GPUs. It supports various models, including LLaMA and PaLM. By using CPU and memory, local-llm makes LLM development more accessible to a broader audience.

Ollama

Another tool that lets you execute LLMs locally on your CPU without a GPU is called Ollama. It is compatible with multiple models, such as GPT-J and LLaMA. On systems with enough RAM, the tool can execute models with up to 13B parameters. For instance, it suggests that 3B models have 8GB of RAM, 7B models have 16GB, and 13B models have 32GB. Because ollama is user-friendly, setting up and running LLMs on your local computer is a breeze.

Practical Considerations

Although it is feasible to execute LLMs on a CPU, there are a few practical things to keep in mind:

  1. Choose the Right Model: Choose models with CPU usage optimisation. CPU performance can be increased by using quantised copies of larger models or by using smaller models like Llama2–7B.
  2. Performance: Generally speaking, using a GPU outperforms a CPU while running LLMs. In particular, this applies to larger models. For CPU-only inference, smaller models such as the 3B or 7B are more appropriate.
  3. System Requirements: The amount of RAM in your computer determines the largest model size you can use. Make sure your memory can support the model you want to run.
  4. CPU Architecture: The speed of RAM (DDR5 is better), CPU architecture (AVX512 capabilities, for example), and core/thread count can all affect how well CPU-based LLM inference performs.
  5. Employ Specific Tools: To run LLMs on CPUs, tools like ollama and local-llm are made. Utilising software optimisations, these tools enhance performance and facilitate the deployment of models on cloud workstations or locally on workstations without GPUs 3.
  6. Experiment and Benchmark: To measure how well your models perform on CPUs, run experiments. This will help you understand the trade-offs and identify areas for further optimisation. For example, theMind’s experiment showed that LLMs running on CPUs achieved comparable accuracy to GPU versions, though with longer training times.

Getting Started

To get started with local-llm or ollama, follow these steps:

  1. Install the Tool: Download and install local-llm or ollama on your local machine.
  2. Download the Model: Choose the LLM you want to run and download the model files.
  3. Configure the Tool: Configure the tool to use your CPU and RAM for inference.
  4. Run the Model: Start the model and begin experimenting with LLMs on your local machine.

Running Large Language Models locally without a GPU is now a reality, thanks to tools like local-llm and ollama. These tools leverage your CPU and RAM, making LLM development more accessible and cost-effective. While there are some performance trade-offs, the ability to run LLMs on local machines opens up new possibilities for developers and researchers. Whether you’re experimenting with smaller models or deploying LLMs in resource-constrained environments, local-llm and ollama provide valuable solutions for running LLMs without the need for a dedicated GPU.


메타데이터
post_id
2c4cc0791908
slug
running-large-language-models-locally-without-a-gpu-2c4cc0791908
url
https://medium.com/@talibilat/running-large-language-models-locally-without-a-gpu-2c4cc0791908
canonical_url
https://medium.com/@talibilat/running-large-language-models-locally-without-a-gpu-2c4cc0791908
author_url
https://medium.com/@talibilat
status
ok
fetched_at
2026-08-29 02:25:44