Lab 15: Open Source vs Closed AI — Hugging Face, Ollama, Local LLMs

Objective

Navigate the open vs. closed AI ecosystem. By the end you will be able to:

  • Explain the spectrum from fully open to fully proprietary AI

  • Set up and run local LLMs with Ollama

  • Use Hugging Face to find, download, and deploy open models

  • Make informed decisions about when to use open vs. closed models


The Spectrum of Openness

"Open source AI" is not binary — it's a spectrum:

MOST OPEN                                           MOST CLOSED
    │                                                    │
    ▼                                                    ▼
Open         Open         Open          Open         Proprietary
weights    weights +    weights +      API +         API only
+ code +   training     code only    no weights
training   data                                      
data
    │           │             │            │              │
TinyLlama   Llama 3 *    Mistral *     Gemini       GPT-4 / Claude
                                       Flash         / Gemini Ultra

*Llama and Mistral use "open weights" licences — you can download and modify the weights, but with restrictions (no commercial use above certain scale, no redistribution).

True open source (OSI definition) requires open training data too. Almost no major LLM qualifies because training data includes copyrighted content.


The Case for Closed AI

Why pay for GPT-4 or Claude when open models are free?

Advantage
Detail

Quality

GPT-4o and Claude 3.5 Sonnet still outperform all open models on hard reasoning tasks (2025)

No infrastructure

No GPU, no serving cost, no maintenance

Multimodal

Vision + audio capabilities require frontier models

Safety

Commercially deployed models have more safety testing

Legal clarity

Using the API is lower risk than using training data of unclear provenance

Reliability

99.9% SLA; managed scaling


The Case for Open Models

Advantage
Detail

Privacy

Data never leaves your infrastructure

Cost at scale

$0 per token once hardware is acquired

No rate limits

Run as many requests as your hardware supports

Customisation

Fine-tune on your proprietary data

Offline

Works without internet access

No vendor lock-in

Not dependent on one company's pricing/policy

Transparency

Some open models release training details


Running Local LLMs with Ollama

Ollama is the simplest way to run LLMs locally. It handles model downloads, serving, and a simple API.

Installation and Quick Start

Hardware Requirements

Model Size
RAM Required
GPU (recommended)
Quality

3B–7B

8GB RAM

4GB VRAM

Good for simple tasks

13B

16GB RAM

8GB VRAM

Good for most tasks

30B–34B

32GB RAM

24GB VRAM

Near GPT-3.5 quality

70B

64GB RAM

48GB VRAM (2×24GB)

Near GPT-4 quality

Ollama REST API


Hugging Face: The GitHub of AI

Hugging Face hosts 400,000+ models, 100,000+ datasets, and provides the most widely used ML library (transformers). It is the central hub of the open AI ecosystem.

Using the Transformers Library

Searching for the Right Model


Top Open Models (2025)

Text Generation

Model
Params
Licence
Strengths

Llama 3.1 (Meta)

8B–405B

Llama Community

Best overall open model

Mistral 7B / Mixtral 8×7B

7B / 47B

Apache 2.0

Fast, efficient, truly open

Phi-3.5-mini (Microsoft)

3.8B

MIT

Tiny but surprisingly capable

Gemma 2 (Google)

2B–27B

Gemma

Strong coding, safe

DeepSeek-V3

685B (MoE)

MIT

Frontier quality, open weights

Qwen 2.5 (Alibaba)

7B–72B

Apache 2.0

Excellent multilingual

Coding

Model
Notes

CodeLlama

Meta; optimised for code generation

DeepSeek-Coder-V2

State-of-the-art open coding model

Starcoder 2

BigCode; trained on 600+ programming languages

Embeddings (for RAG, search, similarity)


Fine-Tuning Open Models

Open weights = you can train further on your own data:


When to Use Which


Further Reading

Last updated