liveBook · Manning

Large language model

As explained in Build Applications with Local AI Models on a Mac

A machine-learning model trained on large amounts of text to process and generate language.

A large language model (LLM) is an AI model trained on enormous amounts of text to generate language. It can answer questions, summarize documents, translate, and write code. A prompt is the question, instruction, or other text you give it. section 1.4

Training adjusts numerical patterns in the model; it does not give the model human understanding. To produce a response, the model predicts one piece of text after another—rather like completing “Once upon a ...” with “time.” That approach can also produce a confident but inaccurate answer, called a hallucination. Verify important results. section 1.4

You can run an LLM locally with Ollama, which downloads and serves models but is not itself the model. Local use keeps conversations on your machine rather than sending them to a cloud service. Model size and recency are tradeoffs to consider. section 1.0 section 3.6

An LLM does not remember earlier API calls. For a chat to feel continuous, the application sends relevant previous messages with each new prompt. The model can process only a limited amount of text per request—its context window—so a long conversation may need its sent history trimmed. Stored chat history is application memory, not model memory. section 11.1 section 11.9

stream = ollama.chat(
    model=model,
    messages=st.session_state.messages,
    stream=True,
    options={"temperature": temperature}
)

In this Ollama chat call, messages supplies the history stored by Streamlit; stream=True lets the response appear as it is generated. section 11.3 section 11.7

How Build Applications with Local AI Models on a Mac covers it

How deep it goes
Explains training patterns, sequential prediction, hallucinations, stateless calls, and context limits without detailing model internals.
Examples
Uses “Once upon a ...” to illustrate prediction and an Ollama chat call to show how conversation history is supplied.
What it assumes
Starts terminal and AI concepts from the ground up; treats basic Python as helpful when coding begins.
What you can do after
Build it from scratch as a local voice-enabled chatbot, then compare models and manage chat history.
How it connects
Connects prompts, the Ollama API, speech recognition, Streamlit session state, and context-window management.

Also explained in

Compare how 2 books explain large language model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Applications with Local AI Models on a Mac. The section links point to the parts of the book it draws on.