{"course":{"slug":"building-with-ai","title":"Building with AI","url":"https://addaly.com/learn/building-with-ai","level":"intermediate","track":"build"},"lesson":{"slug":"a-model-on-your-own-machine","title":"Running a model on a laptop with no GPU","url":"https://addaly.com/learn/building-with-ai/a-model-on-your-own-machine","position":9,"of":80,"minutes":10,"answer":"A local model needs a verified data path, measured runtime memory and task-specific evaluation. Artifact size and an API-compatible endpoint do not establish those properties by themselves.","keyIdea":"A local model needs a verified data path, measured runtime memory and task-specific evaluation. Artifact size and an API-compatible endpoint do not establish those properties by themselves."},"body":{"format":"markdown","text":"## Why run a model locally?\n\nA local model can give you control over where inference runs, allow offline experiments after setup, and make memory use and generation speed easier to observe.\n\nFor sensitive material, verify the whole data path. A downloaded model running locally can process prompts on the machine, while cloud models, connected tools, telemetry and integrations may send data elsewhere. Ollama also offers cloud models, so a local app address alone does not prove that generation stays local. Check the selected model and integrations before using restricted data. [Ollama local and cloud behavior](https://docs.ollama.com/cloud).\n\nLocal inference has hardware, energy and maintenance costs. It can avoid a provider's per-generation charge, subject to the model's license and the software you use. Installation and model downloads can still require network access.\n\n## Estimating memory\n\nAs nominal weight arithmetic, seven billion parameters stored at two bytes each require about 14 GB. At four bits each they require about 3.5 GB. Actual files include scales, metadata and tensors that may use different precision. Running a model also needs memory for its context cache, intermediate data and the runtime, alongside other applications.\n\nQuantization reduces the precision used to store some model data. Its effect on memory, speed and answer quality depends on the method, model, hardware and task. Compare the actual artifact and evaluate it on representative examples. [Quantization overview](https://huggingface.co/docs/transformers/quantization/overview).\n\nGGUF names such as `Q4_K_M` describe a quantization scheme and variant. A mixed-precision variant need not store every tensor at exactly four bits. Check the artifact size and the runtime's quantization documentation. [llama.cpp quantization](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md).\n\nThe `qwen2.5:7b` artifact used below is listed by Ollama as a 7.62B-parameter Q4_K_M model with a 4.7 GB download. That file size does not establish total runtime memory. Start with a context size and concurrent load your machine can support, then measure peak memory and tokens per second. [Exact model tag](https://ollama.com/library/qwen2.5:7b).\n\n## A local example\n\nOllama's installer supports macOS and Linux. Review the installation instructions for your operating system, then download the named model.\n\n```bash\ncurl -fsSL https://ollama.com/install.sh | sh\nollama run qwen2.5:7b\n```\n\nOllama exposes a subset of the OpenAI API on its local server. With that local model available, the following example uses the OpenAI Python client against `localhost:11434`. The placeholder API key is required by the client and ignored by the local server. [Supported API behavior](https://docs.ollama.com/api/openai-compatibility).\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http://localhost:11434/v1\",\n    api_key=\"ollama\",\n)\ntext = \"The meeting moved to Friday. Please confirm attendance.\"\nr = client.chat.completions.create(\n    model=\"qwen2.5:7b\",\n    messages=[{\n        \"role\": \"user\",\n        \"content\": \"Summarise this in three bullets:\\n\" + text,\n    }],\n    temperature=0,\n)\nchoice = r.choices[0]\nanswer = choice.message.content\nif choice.finish_reason != \"stop\" or not answer:\n    raise ValueError(\"No complete text answer was returned\")\nprint(answer)\n```\n\nKeep provider-specific handling in the adapter. Supported parameters, tools, output formats and retry behavior can differ even when endpoints share a request shape. Test those features when changing the base URL or model.\n\nOther local runtimes and applications include llama.cpp, LM Studio and GPT4All. For server workloads, vLLM is another option. Check each tool's hardware requirements, licenses and supported models before selecting it.\n\n## Evaluate the chosen model and runtime\n\nTry the tasks your application needs, including difficult examples and failure cases. A model that performs well on ticket labels may still struggle with planning, arithmetic, a complex schema or tool use. That result needs investigation of the model, prompt, quantization and runtime settings.\n\nUse the model's documented chat template. A mismatched template can change behavior, so verify it when bypassing a high-level runtime. Measure memory with the actual context length and concurrency. Compare a local candidate with any hosted alternative using the same quality, privacy and latency requirements."},"check":{"question":"A local quantized model tags support tickets well but performs poorly on a planning test. What is the justified next step?","options":[{"text":"Assume that moving to eight-bit weights will solve the planning errors.","correct":false,"tempting":"Quantization can affect quality, but the observed difference does not identify it as the cause."},{"text":"Assume that the chat template is wrong because one task performs poorly.","correct":false,"tempting":"Verify the template, but the two task scores alone do not prove a template problem."},{"text":"Evaluate representative cases and check the model, template, quantization and runtime before deciding which tasks it can handle.","correct":true},{"text":"Assume that a larger context window will solve the planning errors.","correct":false,"tempting":"Context capacity is one limit to check. It does not by itself establish reasoning accuracy."}]},"prev":{"slug":"choosing-a-model","title":"Choosing a model, and designing so you can change your mind","url":"https://addaly.com/learn/building-with-ai/choosing-a-model"},"next":{"slug":"images-files-and-audio-in","title":"Sending images, PDFs and audio, and what they cost","url":"https://addaly.com/learn/building-with-ai/images-files-and-audio-in"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Running a model on a laptop with no GPU', in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/a-model-on-your-own-machine (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Running a model on a laptop with no GPU","courseTitle":"Building with AI","module":{"index":1,"slug":"the-call-underneath-everything","title":"The call underneath everything"},"answer":null,"keyIdea":"A local model needs a verified data path, measured runtime memory and task-specific evaluation. Artifact size and an API-compatible endpoint do not establish those properties by themselves.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"why-run-a-model-locally","runs":[{"text":"Why run a model locally?"}]},{"t":"p","runs":[{"text":"A local model can give you control over where inference runs, allow offline experiments after setup, and make memory use and generation speed easier to observe."}]},{"t":"p","runs":[{"text":"For sensitive material, verify the whole data path. A downloaded model running locally can process prompts on the machine, while cloud models, connected tools, telemetry and integrations may send data elsewhere. Ollama also offers cloud models, so a local app address alone does not prove that generation stays local. Check the selected model and integrations before using restricted data. "},{"text":"Ollama local and cloud behavior","href":"https://docs.ollama.com/cloud"},{"text":"."}]},{"t":"p","runs":[{"text":"Local inference has hardware, energy and maintenance costs. It can avoid a provider’s per-generation charge, subject to the model’s license and the software you use. Installation and model downloads can still require network access."}]},{"t":"h2","id":"estimating-memory","runs":[{"text":"Estimating memory"}]},{"t":"p","runs":[{"text":"As nominal weight arithmetic, seven billion parameters stored at two bytes each require about 14 GB. At four bits each they require about 3.5 GB. Actual files include scales, metadata and tensors that may use different precision. Running a model also needs memory for its context cache, intermediate data and the runtime, alongside other applications."}]},{"t":"p","runs":[{"text":"Quantization reduces the precision used to store some model data. Its effect on memory, speed and answer quality depends on the method, model, hardware and task. Compare the actual artifact and evaluate it on representative examples. "},{"text":"Quantization overview","href":"https://huggingface.co/docs/transformers/quantization/overview"},{"text":"."}]},{"t":"p","runs":[{"text":"GGUF names such as "},{"text":"Q4_K_M","code":true},{"text":" describe a quantization scheme and variant. A mixed-precision variant need not store every tensor at exactly four bits. Check the artifact size and the runtime’s quantization documentation. "},{"text":"llama.cpp quantization","href":"https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md"},{"text":"."}]},{"t":"p","runs":[{"text":"The "},{"text":"qwen2.5:7b","code":true},{"text":" artifact used below is listed by Ollama as a 7.62B-parameter Q4_K_M model with a 4.7 GB download. That file size does not establish total runtime memory. Start with a context size and concurrent load your machine can support, then measure peak memory and tokens per second. "},{"text":"Exact model tag","href":"https://ollama.com/library/qwen2.5:7b"},{"text":"."}]},{"t":"h2","id":"a-local-example","runs":[{"text":"A local example"}]},{"t":"p","runs":[{"text":"Ollama’s installer supports macOS and Linux. Review the installation instructions for your operating system, then download the named model."}]},{"t":"code","lang":"bash","label":"Bash","text":"curl -fsSL https://ollama.com/install.sh | sh\nollama run qwen2.5:7b"},{"t":"p","runs":[{"text":"Ollama exposes a subset of the OpenAI API on its local server. With that local model available, the following example uses the OpenAI Python client against "},{"text":"localhost:11434","code":true},{"text":". The placeholder API key is required by the client and ignored by the local server. "},{"text":"Supported API behavior","href":"https://docs.ollama.com/api/openai-compatibility"},{"text":"."}]},{"t":"code","lang":"python","label":"Python","text":"from openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http://localhost:11434/v1\",\n    api_key=\"ollama\",\n)\ntext = \"The meeting moved to Friday. Please confirm attendance.\"\nr = client.chat.completions.create(\n    model=\"qwen2.5:7b\",\n    messages=[{\n        \"role\": \"user\",\n        \"content\": \"Summarise this in three bullets:\\n\" + text,\n    }],\n    temperature=0,\n)\nchoice = r.choices[0]\nanswer = choice.message.content\nif choice.finish_reason != \"stop\" or not answer:\n    raise ValueError(\"No complete text answer was returned\")\nprint(answer)"},{"t":"p","runs":[{"text":"Keep provider-specific handling in the adapter. Supported parameters, tools, output formats and retry behavior can differ even when endpoints share a request shape. Test those features when changing the base URL or model."}]},{"t":"p","runs":[{"text":"Other local runtimes and applications include llama.cpp, LM Studio and GPT4All. For server workloads, vLLM is another option. Check each tool’s hardware requirements, licenses and supported models before selecting it."}]},{"t":"h2","id":"evaluate-the-chosen-model-and-runtime","runs":[{"text":"Evaluate the chosen model and runtime"}]},{"t":"p","runs":[{"text":"Try the tasks your application needs, including difficult examples and failure cases. A model that performs well on ticket labels may still struggle with planning, arithmetic, a complex schema or tool use. That result needs investigation of the model, prompt, quantization and runtime settings."}]},{"t":"p","runs":[{"text":"Use the model’s documented chat template. A mismatched template can change behavior, so verify it when bypassing a high-level runtime. Measure memory with the actual context length and concurrency. Compare a local candidate with any hosted alternative using the same quality, privacy and latency requirements."}]}],"check":{"question":[{"text":"A local quantized model tags support tickets well but performs poorly on a planning test. What is the justified next step?"}],"options":[{"text":[{"text":"Assume that moving to eight-bit weights will solve the planning errors."}],"correct":false,"tempting":[{"text":"Quantization can affect quality, but the observed difference does not identify it as the cause."}]},{"text":[{"text":"Assume that the chat template is wrong because one task performs poorly."}],"correct":false,"tempting":[{"text":"Verify the template, but the two task scores alone do not prove a template problem."}]},{"text":[{"text":"Evaluate representative cases and check the model, template, quantization and runtime before deciding which tasks it can handle."}],"correct":true,"tempting":null},{"text":[{"text":"Assume that a larger context window will solve the planning errors."}],"correct":false,"tempting":[{"text":"Context capacity is one limit to check. It does not by itself establish reasoning accuracy."}]}],"order":[0,2,1,3],"why":null},"prev":{"slug":"choosing-a-model","title":"Choosing a model, and designing so you can change your mind","minutes":9},"next":{"slug":"images-files-and-audio-in","title":"Sending images, PDFs and audio, and what they cost","minutes":9}}}