How to run LLMs on your laptop

Today we looks at three ways to run Large Language Models on your local machines.

We discuss three methods for running a large language model (LLM) on your local machine, such as a laptop. Typically, running an LLM requires substantial memory and powerful GPUs to handle the intensive calculations involved in generating model outputs from user inputs. These resources can be hard to obtain and expensive. While cloud platforms and APIs like OpenAI provide options, they can also be costly and may have performance limitations. This discussion explores how to run LLMs locally to facilitate testing and development.

Understanding quantization

Before delving into the three methods, it's essential to understand quantization. To make LLMs more memory-efficient, quantization involves converting weights, typically stored as 32-bit floating-point numbers, into lower-resolution representations using fewer bits, like 16-bit or 8-bit. While this reduces memory requirements, it can also result in a loss of output quality, akin to losing image resolution. Striking the right balance between quantization and output quality is crucial.

Method 1: Llama.cpp

  1. Clone the Llama.cpp repository from GitHub.
  2. Build the code using the 'make' command.
  3. Download a .gguf file for the LLM model you want to use.
  4. Move the downloaded .gguf file to the model's directory.
  5. Run Llama.cpp interactively with the desired model using the './main' command.

This method enables you to run an LLM locally without connecting to remote servers or incurring additional costs, provided the model fits within your machine's memory.

Method 2: Ollama

  1. Download Ollama to your local machine.
  2. Run Ollama with the desired model using the './ollama run' command.

Ollama simplifies the process of running LLMs locally by wrapping around Llama.cpp. It offers user-friendly commands and the ability to set various options, making it an accessible choice for local LLM execution.

Method 3: GPT4ALL

  1. Download GPT4ALL from
  2. Start the GPT4ALL application.
  3. Choose a model to use.
  4. Interact with the model through the UI.

GPT4ALL provides a graphical user interface (UI) for running LLMs locally. It offers an easy-to-use interface and allows you to interact with LLMs without an internet connection.

These three methods offer the convenience of running LLMs on your local machine, making development and testing more accessible. While the output quality may not match that of cloud APIs or full-scale models, they provide a useful starting point for development and iteration.

The Airtrain Al Youtube channel

Subscribe now to learn about Large Language Models, stay up to date with Al news, and discover Airtrain Al's product features.

Subscribe now