liveBook · Manning

Ollama

As explained in Build a Large Language Model (From Scratch)

A local application and serving wrapper for running large language models for inference through a command line or API.

Ollama is a local application and serving wrapper for running large language models during inference. It wraps llama.cpp and supports command-line or API-based text generation, but not training or fine-tuning. section 7.8

A typical local workflow is:

  • Start the application or run ollama serve in a separate terminal. section 7.8
  • Download and run Llama 3 with ollama run llama3. section 7.8
  • Send prompts through the local API at http://localhost:11434/api/chat, configuring the model, seed, temperature, and context length. section 7.8
  • Use the model to score generated responses automatically against reference outputs. section 7.8

Automated evaluation

A Python workflow queries the local Llama 3 model with a prompt containing the instruction, correct output, and generated response, then requests an integer score from 0 to 100. The scores can be averaged across a test set. section 7.8

Figure 7.20 Two options for running Ollama. The left panel illustrates starting Ollama using ollama serve. The right panel shows a second option in macOS, running the Ollama application in the background instead of using the ollama serve command to start the application.
figure

Compares starting Ollama with ollama serve and running the macOS application in the background. section 7.8

How Build a Large Language Model (From Scratch) covers it

How deep it goes
Explains startup, model execution, API requests, and scoring code, while stopping short of training or fine-tuning internals.
Examples
Uses ollama run llama3, a llama prompt, Python API queries, and automated scores over 110 test entries.
What it assumes
Assumes installation for the operating system and a running Ollama application or ollama serve process.
What you can do after
Operate/configure a local Llama 3 service and query it from Python for text generation or response scoring.
How it connects
Connects local inference with Llama 3, llama.cpp, APIs, and instruction fine-tuning.

Also explained in

Compare how 8 books explain Ollama →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Large Language Model (From Scratch). The section links point to the parts of the book it draws on.