|
| 1 | +--- |
| 2 | +title: Understand the agent and the CPU/GPU split |
| 3 | +weight: 2 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## What you'll build |
| 10 | + |
| 11 | +In this Learning Path, you'll build and run a *local concierge agent*: a terminal application that answers research-style questions, such as finding restaurants, comparing products, or summarizing a topic, by searching the web, reading multiple pages, and writing a fact-checked summary. |
| 12 | + |
| 13 | +Everything runs on your own Arm machine. The agent uses a large language model (LLM) served locally by [Ollama](https://ollama.com/), so your prompts and the pages you browse never leave the device. The same code runs on an Apple silicon MacBook, an Arm Linux laptop, or an NVIDIA DGX Spark. |
| 14 | + |
| 15 | +The agent is interesting not just because it runs locally, but because of *how the work is divided*. A common assumption is that an AI agent is "just the model." In practice, the model is only one stage in a longer pipeline, and most of the surrounding work runs on the CPU. |
| 16 | + |
| 17 | +## The agentic loop |
| 18 | + |
| 19 | +Each time you ask the agent a question, it runs through a chain of steps rather than a single model call: |
| 20 | + |
| 21 | +```text |
| 22 | +Your question |
| 23 | + -> Decide what to search for (GPU: model reasoning) |
| 24 | + -> Expand into several search queries (CPU: orchestration) |
| 25 | + -> Run web searches in parallel (CPU: network I/O) |
| 26 | + -> Choose which pages to open (GPU: model reasoning) |
| 27 | + -> Scrape those pages in parallel (CPU: network I/O) |
| 28 | + -> Rank, deduplicate, extract data (CPU: text processing) |
| 29 | + -> Write a fact-checked summary (GPU: model reasoning) |
| 30 | +``` |
| 31 | + |
| 32 | +The model is called several times, but between every model call the CPU does a large amount of orchestration: generating query variants, dispatching parallel network requests, merging and deduplicating results, scoring pages for relevance, and extracting structured data such as phone numbers and opening hours. |
| 33 | + |
| 34 | +## Why the CPU matters in an agentic workflow |
| 35 | + |
| 36 | +It's easy to focus only on token generation, because that's the visible "thinking" part. But in an agent, the CPU is responsible for turning a single user request into useful, structured context for the model: |
| 37 | + |
| 38 | +| Stage | Runs on | Example work | |
| 39 | +|---|---|---| |
| 40 | +| Reasoning and summarization | GPU | Choosing search terms, selecting URLs, writing the final answer | |
| 41 | +| Orchestration | CPU | Expanding queries, scheduling parallel tasks, merging results | |
| 42 | +| Web I/O | CPU | Calling the search API, downloading and parsing web pages | |
| 43 | +| Text processing | CPU | TF-IDF ranking, deduplication, entity extraction, indexing | |
| 44 | + |
| 45 | +This division is a natural fit for Arm platforms. On an Apple silicon MacBook or an Arm Linux machine, the CPU handles all orchestration and I/O while the GPU accelerates the model. On an NVIDIA DGX Spark, the Arm CPU coordinates the workflow while the GPU runs inference. In every case, the model is only as good as the context the CPU prepares for it. |
| 46 | + |
| 47 | +## How the agent shows you the split |
| 48 | + |
| 49 | +The program is instrumented so you can see this division directly. As it runs, it prints: |
| 50 | + |
| 51 | +- `[CPU]` log lines (in cyan) for every orchestration and processing step |
| 52 | +- `[GPU]` log lines (in yellow) for every model call |
| 53 | +- A timing breakdown of CPU time versus GPU input-token processing and token generation |
| 54 | +- A text-based timeline that visualizes when the CPU and GPU are each active |
| 55 | + |
| 56 | +By the end of this Learning Path, you'll be able to look at a single query and see exactly how much of the work happened on the CPU before and after the model produced its answer. |
| 57 | + |
| 58 | +## What's next |
| 59 | + |
| 60 | +In the next section, you'll set up your environment: create a Python virtual environment, install the required packages, and get a Serper API key for web search. |
0 commit comments