← All courses ← Course home

Lesson 05 of 05

Confirm numbers in Instruments

Use the Foundation Models instrument in Xcode 27 to check your clocks. Then write a short speed budget the team can hold.

Agent brief (llms.md)

Your in-app log can drift. Instruments is the check. In Xcode 27 choose Product, then Profile. Pick the Foundation Models template. Record while you exercise the stream.

XcodeProduct → Profile
XcodeProduct → Profile
TemplateFoundation Models
XcodeProduct → Profile
TemplateFoundation Models
ReadTTFT and token rate

WWDC26 session 243 walks the lanes: instructions, model inference, tool calls. Yellow bars are prompt processing. Orange bars are generation. The inspector shows duration and token use. The session names three product metrics: time to first token, tokens per second, and total latency. Streaming lowers what the user feels on total latency. Short prompts lower TTFT.

Trace files can hold prompts and replies. Treat them as sensitive. Do not mail a trace from a customer device. Turn prompt logging off outside a recording.

A simple speed budget

Write four lines the team can review each week:

  1. On-device TTFT for the default profile, on the oldest device you support.
  2. PCC TTFT for the same prompt, on Wi-Fi and on a phone network.
  3. Mean inter-token gap once the first token is on screen.
  4. What you will cut first if TTFT rises: instruction length, tools, or a profile switch.

If TTFT jumps after a Dynamic Profile change, look at instruction length and tool lists before you blame the chip. Trace every step of an AI call shows the hops around the model. Test AI behavior before you ship keeps a shorter prompt from breaking the feature.

Primary sources: Foundation Models, WWDC26 243, and WWDC26 319.

Short form. Stream in the UI. Log TTFT and gaps. Confirm in Instruments. Hold a four-line budget.

Key concepts

  • Use Product, Profile, Foundation Models template in Xcode 27.
  • Trace files hold prompts and replies. Treat them as sensitive.
  • Hold a four-line speed budget: on-device TTFT, PCC TTFT, mean gap, and what to cut first.
  • A TTFT jump after a Dynamic Profile change often means longer instructions or more tools.

Takeaways

  • Stream in the UI, log TTFT and gaps, confirm in Instruments, hold a four-line budget.
  • Use the tracer course for hops around the model.
  • In-app logs can drift. Instruments is the check.