跟讀練習: WWDC26: Run local agentic AI on the Mac using MLX | Apple - 通過影片學習英語口語
選擇練習模式
每種模式都會開啟全屏練習室。
144 句
如果句子過短或過長,請點選 Edit 進行調整。
1
Hi, I'm Angelos, an engineer on the MLX team.
2
Today I'm going to show you how to build and run agentic AI workflows entirely on your Mac using MLX.
3
No cloud, no API keys, just your hardware doing the work.
4
Over the past year, AI agents have gone from research prototypes to everyday productivity tools.
5
But before we talk about agents, let's look at what we had before.
6
Here's the chat experience you're familiar with.
7
You send a prompt to the language model.
8
The model sends a response back.
9
If you need to act on that response, run a command, check a file, or fix an error, that's on you.
10
But now you're talking to an agent.
11
The agent talks to the model to decide what to do.
12
Then it calls tools to actually do it: running commands, reading files, hitting APIs — It observes the results and goes back to the model to figure out the next step.
13
User to agent.
14
Agent to model.
15
Agent to tools.
16
This is the agentic loop.
17
And it keeps cycling until your task is done.
18
What makes this particularly exciting on Apple silicon is that the entire loop can run locally.
19
Your data stays on your machine; AI is available anywhere at any time and there are no usage costs.
20
Let me now show you what this looks like in practice.
21
Here I have an agent running locally on my Mac.
22
On my screen you can see the setup: on the left, MLX running the model, and on the right the OpenCode agent I am interacting with.
23
I asked it to fetch the recent pull requests from our MLX repository, summarize the changes, and identify anything that needs my attention.
24
The model reasons about the request, calls the GitHub CLI to fetch PR data, reads through the diffs, and produces a concise summary.
25
All of this is happening locally, the model runs on my hardware and only the git commands reach the network.
26
Well it seems like I have a lot of work to do after finishing this video.
27
Now that you've seen what's possible, let me walk you through how we'll get there today.
28
We'll start by introducing the local agentic AI stack, the four layers that make all of this work, from MLX at the foundation all the way up to the agent.
29
Then I'll show you step-by-step how to set up your own local agent.
30
After that, we'll look at how MLX gets the most out of your hardware to make agents fast.
31
And finally, we'll go through more live demos, including building a SwiftUI app from scratch and fixing a bug in Xcode.
32
Let's start with the stack.
33
The stack that powers local agentic AI on the Mac has four layers.
34
Let me walk you through each one, starting from the bottom.
35
At the bottom is MLX, our open-source array framework purpose-built for Apple silicon.
36
It handles all the low-level computation, Metal acceleration, and memory management.
37
This is the foundation everything else is built on.
38
One level up, we have the language model layer.
39
MLX-LM provides everything you need to load, run, quantize, and fine-tune large language models.
40
It supports thousands of models from HuggingFace and gives you both CLI tools and a Python API.
41
If you saw our sessions last year, this is what we covered in depth.
42
But to serve an agent, we need something more: a persistent server with a standard API.
43
That's where MLX-LM Server comes in.
44
This is an OpenAI-compatible HTTP server that exposes your local model through a standard API.
45
It supports structured tool calling so the model can invoke functions reliably, and reasoning models that can analyze complex problems step-by-step before responding.
46
It's a drop-in replacement for any cloud LLM API.
47
And at the top of the stack, we have the agent itself.
48
This can be any framework or tool that speaks the OpenAI chat completions protocol: Xcode, OpenCode, Pi agent, a custom script, or anything else.
49
Because MLX-LM Server provides a standard interface, any agent framework works out of the box.
50
And it's not just us building on this stack.
51
Several popular apps and tools build on MLX and MLX-LM.
52
Ollama, LM Studio, and vLLM are just a few of the most popular ones.
53
The ecosystem is broad and growing, and if you're using one of these tools, chances are you're already running on MLX.
54
So that's the stack.
55
Let me now show you how to set everything up yourself.
56
It only takes three steps to go from zero to a fully local agentic workflow.
57
Step one: install MLX-LM.
58
A single pip install gets you everything you need.
59
Step two: start the server.
60
Run mlx_lm.server with a model that supports tool calling.
61
Starting with a small model to test your set-up is always a good idea.
62
The server starts up, loads the model, and is ready to accept requests on local host.
63
Step three: point your agent at the local server.
64
In most agent frameworks, you just set the base URL to your local server's address and you're done.
65
The agent doesn't know or care that the model is running on your Mac rather than in the cloud.
66
Let me show you a concrete example.
67
Here's the configuration for OpenCode.
68
We define a local provider.
69
In particular, we set the URL to local host and set the model name the server expects.
70
We also tell OpenCode to use this local model for everything.
71
That's it. Now every interaction runs through your local model.
72
Now that we have an agent talking to MLX, let's look at how MLX gets the most out of your hardware and addresses the key challenges of running agents locally.
73
The first challenge is prompt processing.
74
In an agentic workflow, every time the model receives tool output, it has to process all that new context before it can reason about the next step.
75
This happens over and over throughout the agentic loop, and it adds up fast.
76
Agentic sessions usually comprise hundreds of thousands of tokens and most of those are not generated.
77
The M5 chip introduces dedicated Neural Accelerators, and MLX can target them for exactly this kind of work.
78
Specifically, Neural Accelerators make matrix multiplication four times faster on M5 compared to M4.
79
And with the specialized multiplication and attention kernels in MLX this translates almost exactly to prompt processing speedup.
80
Reducing prompt processing time means your agents can read your codebase or process tool results almost four times faster.
81
And the best part?
82
Taking advantage of Neural Accelerators requires no special arguments or code changes on your part, MLX selects the best kernel for the available hardware and it just works.
83
Let's now talk about the second challenge, concurrency.
84
In practice, agents rarely work alone.
85
A common pattern is for an agent to spawn several subagents, each tackling a different part of the problem in parallel.
86
One might be reading documentation, another searching code, and a third writing tests; all at the same time.
87
That means multiple requests hitting your local model simultaneously.
88
MLX-LM Server handles this with continuous batching.
89
Instead of processing requests one at a time, it dynamically groups incoming requests into batches and processes them together on the GPU.
90
New requests can join a batch in progress without waiting for the current one to finish.
91
The result is that your subagents don't stall waiting in a queue.
92
They all get served concurrently, which keeps the entire agentic workflow moving.
93
Finally, the third challenge is model size.
94
Sometimes a single machine, even one with 512GB of RAM, just isn't enough because the model is too large to fit in memory.
95
The most recent DeepSeek model for instance has a whopping 1.6 trillion parameters and requires more than 800GB of memory just for the weights.
96
MLX's distributed support lets you spread a model across multiple Macs connected over Thunderbolt or Ethernet.
97
For agents, this is powerful in two ways.
98
First, it lets you run much larger, more capable models that wouldn't fit on a single machine.
99
Second, it parallelizes prompt processing across devices, which directly speeds up the agentic loop since the model can process tool results faster.
100
Setting up distributed inference with MLX-LM Server is fairly straightforward.
101
You launch the server using mlx.launch and a hostfile that contains information about the nodes and the type of connection.
102
The model is automatically sharded across all available devices and everything else just works.
103
Starting with macOS 26.2, we have support for Thunderbolt RDMA, which provides low-latency, high-bandwidth communication over Thunderbolt.
104
As a result, distributed inference with MLX has seen significant speed-ups: up to three times with four nodes.
105
To learn how to set up your Macs for distributed inference with MLX, check out our session "Explore distributed inference and training with MLX".
106
Remember our PR summary demo from earlier?
107
That was a simple read-and-report task.
108
Let's now push things further and see what happens when we ask an agent to write an entire project from scratch and then fix a bug in an existing one.
109
In this demo, I'm going to ask the agent to build a small SwiftUI application from scratch.
110
I have started with a blank Xcode project and I am asking the agent to build a drawing app for the iPad.
111
And off it goes.
112
The agent first looks at the current directory to find out the existing project structure, makes a plan to guide its implementation, and gets on to writing the code.
113
Using an agent means we don't need to copy anything or even build the project.
114
The agent writes the file then builds the app, fixing any errors it encounters along the way.
115
And here we are: the model is done, it only took a couple of minutes to create the first version of the app.
116
At the same time, I have the project open in Xcode and I am launching the app in the simulator.
117
Let's have a look at what the agent created.
118
It seems that we have a fully functional drawing app.
119
That's really nice for something that was built in 2 minutes.
120
With agentic coding, however, we can keep iterating until we are happy with the result.
121
For instance, I prefer rounded end caps.
122
I think they look much better.
123
Let's ask the agent to add them.
124
The agent will edit the code and recompile the app until it compiles without errors.
125
Let's test the new version.
126
We now have rounded end caps.
127
This is cool indeed.
128
It is even more cool that all of this happened locally, the model ran through MLX-LM server on this Mac and the agent used standard development tools like xcodebuild to verify and build its work.
129
For our final demo, let's look at something that integrates directly with your development environment.
130
Here I have the same drawing app project open in Xcode.
131
Let's connect Xcode to our already running MLX server.
132
We open the settings and navigate to the Intelligence tab.
133
We click on Add Chat Provider... and select a Locally Hosted provider.
134
We set the Port to 8080 or whichever port we selected when launching our MLX server and we're done.
135
Now Xcode can talk to our local model.
136
I have introduced a bug to our previously working app and now we can ask the model to fix it.
137
Within seconds, it identifies the bug and inspects the code around it.
138
Finally, it writes a fix and we can now build and run our app.
139
This shows how a locally running agent can integrate with your existing development workflow in Xcode, reading project files, understanding build errors, and making targeted fixes.
140
Local AI means your code never leaves your Mac.
141
Today, we showed you the full stack for running agentic AI locally on your Mac, from MLX all the way up to the agent, and how Neural Accelerators, continuous batching, and distributed inference make it fast.
142
To get started, install MLX-LM, launch the server, and point your favorite agent at it.
143
Everything we showed today is open-source and available right now.
144
Thank you for watching and I'm excited to see what you build with local agentic AI on the Mac.
同頻道
FOR YOU
推薦影片
背景與上下文
在這段影片中,Angelos 是來自 MLX 團隊的工程師,介紹瞭如何利用 MLX 在 Mac 上構建和執行代理 AI 工作流。通過這個影片,學習者可以瞭解代理 AI 的工作原理,以及如何在本地裝置上利用這些技術來提升日常工作效率。Angelos 儘可能簡潔地解釋了代理 AI 與傳統語言模型的區別,強調了資料隱私和使用成本等優勢。
日常交流的五個關鍵短語
- 執行代理 AI 工作流 - 通過這個短語,學習者能夠理解代理 AI 的功能。
- 從研究原型到生產力工具 - 此短語有助於學習 AI 在實際應用中的演變。
- 使用者到代理,代理到模型 - 強調了代理的中介作用。
- 呼叫工具並觀察結果 - 介紹如何執行命令並獲取反饋。
- 實現任務的關鍵步驟 - 引導學習者理解完成特定任務的過程。
逐步跟讀指導
為了更好地應對這段影片內容帶來的挑戰,以下是一些具體的步驟:
- 選擇關鍵詞: 從影片中提取並標記出重要的關鍵詞,比如“代理 AI”,“本地執行”,“模型呼叫”等。
- 逐句模仿: 通過影子跟讀(shadow speak)的方式,逐句模仿Angelos 的講解,注意語音的語調和節奏。
- 理解語境: 在每個短語後,嘗試用自己的話解釋這個短語的意思,以加深理解。
- 複述內容: 完成一次影子跟讀後,嘗試不看影片複述內容。檢視是否能選用剛才學習的短語。
- 應用實踐: 將所學的短語應用到自己的日常交流中,提升自身的英語口語水平。
通過這些步驟,學習者可以有效地利用這個英語影子跟讀(英語影子跟讀)的方法,提升自己的聽說能力。無論是進行日常對話還是專業交流,這種與影片內容的結合練習,都會極大促進學習效果。
影片中的語法
說話人最常用的結構,並附上影片中的原話:
| 結構 | 影片中的用法 |
|---|---|
| 現在完成時 have/has + 過去分詞 — 過去發生但與現在仍有關聯的事 | have gone · you've seen · has seen |
| 被動語態 be + 過去分詞 — 強調發生了什麼,而不是誰做的 | is built · are not generated · is automatically sharded |
什麼是跟讀法?
跟讀法 (Shadowing) 是一種有科學依據的語言學習技巧,最初開發用於專業口譯員的培訓,並由多語言者Alexander Arguelles博士普及。這個方法簡單而強大:您在聽英語母語原聲的同時立即大聲重複——就像是一個延遲1-2秒緊跟說話者的影子。與被動聽力或語法練習不同,跟讀法強迫您的大腦和口腔肌肉同時處理並模模擬實的講話模式。研究表明它能顯著提高發音準確性,語調,節奏,連讀,聽力理解和口語流利度——使其成為雅思口語備考和真實英語交流最有效的方法之一。












