View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 转写文稿
  • 代码
  • 通过专用云计算充分利用 Apple Foundation Model

    借助专用云计算,你能够访问功能强大的前沿模型,同时保护用户隐私。了解专用云计算的运行机制,以及如何利用 Foundation Models 框架访问这项功能。探索在你的 App 中检查可用性并平稳地处理回退事件的最佳做法。

    章节

    • 0:00 - Introduction
    • 1:23 - What is Private Cloud Compute
    • 2:43 - Integrating PCC with Foundation Models
    • 4:00 - Deciding between on-device and PCC
    • 4:32 - Reasoning levels and context size
    • 6:15 - Evaluating and combining models
    • 7:10 - Handling usage limits
    • 10:15 - Next steps

    资源

    • Adding server-side intelligence with Private Cloud Compute
      • 高清视频
      • 标清视频
  • 搜索此视频…

    你好 我是Louis 在这个视频中 我将向你展示 如何访问强大的新服务器LLM 在你的App中 使用Private Cloud Compute 去年 我们提供了 强大的设备端LLM访问能力 通过全新的Foundation Models框架 今年 我们让设备端LLM 变得更加出色 它现在支持图像输入 指令跟随能力更强 调用自定义工具也更出色 但我们知道有些更复杂的 使用场景需要 一个更加强大的模型 因此今年我们还将 提供新服务器模型的访问能力 运行在Private Cloud Compute上 有了这个模型 你可以在App中 构建复杂的AI功能 例如能够处理大量 用户输入的助手

    或依赖大量工具调用的功能 具有大量输出

    你甚至可以从watchOS 调用Private Cloud Compute

    在本视频中 我们将介绍 什么是Private Cloud Compute 以及如何在你的App中访问它 使用Foundation Models框架 以及如何处理用量限额

    Private Cloud Compute 为我们的系统功能提供支持 将复杂任务发送到Apple的服务器 你的App现在也可以使用这项功能 这意味着你可以访问 强大的服务器LLM 同时不会损害隐私 Private Cloud Compute在设计之初 就以端到端隐私为核心 确保用户数据永不被存储 数据仅用于处理请求 所有这些都已由 研究人员独立验证 而且还有更好的 Private Cloud Compute已集成在系统中 与iCloud协同工作 所以你不必担心 身份验证或API密钥 这是使用服务器模型时通常需要的 你的用户只需要一台 支持Apple Intelligence的设备 无需账户设置 无需身份验证 也无需API密钥 这真的是你用过的 最简单的服务器LLM 更棒的是 对开发者而言 没有Token费用 每个用户有每日限额 用户可以升级到iCloud+ 以获得更高的限额

    此模型适用于下载量 不足200万次的App 你今天就可以在 开发者网站上申请 让我们来看看如何 在你的App中集成这个功能 使用Foundation Models框架 如果你的App已经 使用Foundation Models 你知道只需3行代码 即可向设备端LLM发送提示 你创建一个Session 然后让它响应你的提示 现在只需修改1行代码 即可切换到 PCC上的新服务器模型 仅需那一行 你就可以 与一个更大的模型通信 具有更大的上下文 和更复杂的推理能力 Foundation Models框架 提供了统一的Swift API 无论你与哪种模型通信 使用Generable获取结构化输出 或调用Tools 与PCC模型 的工作方式完全相同 就像使用设备端模型一样

    这让你可以轻松地 在模型之间切换 而无需重写代码

    请记住 就像设备端模型一样 PCC仅在支持Apple Intelligence 的设备上可用 检查可用性API非常重要

    并优雅地处理 Apple Intelligence 在用户设备上不可用的情况 在使用Foundation Models 编写功能时 选择使用哪个模型 是一个重要决策 让我们来看看两者之间的区别 设备端System模型 与PCC模型的对比 它们都提供隐私保护 设备端模型可离线工作 而PCC需要网络连接 设备端模型没有请求限制 而PCC每位用户有每日限额 对于某些功能 上下文大小是另一个重要因素

    设备端模型提供4K PCC则提供32K PCC模型支持推理 那么什么是推理?

    当LLM响应你的提示时 它通常只是读取提示 并生成响应 有了推理功能 模型在 生成响应之前会先思考 这实际上是通过让模型 生成额外的文本来实现的 在转录稿的单独片段中 PCC模型提供 3个推理级别 Light让模型 收集一些额外上下文 Moderate让模型 进行更深入的推理 使用Deep时 推理片段的文本 可能比实际响应还要长

    你可以在Session上调用 respond时设置推理级别

    你的Session转录稿 包含推理片段 你可以观察转录稿 以显示进度 这在使用Deep推理级别时 尤为有用 这可能需要一些时间 但请记住

    推理是模型生成的额外文本 因此会使用Token 这会计入你的上下文大小限制

    说到上下文大小 我们还添加了一个便捷API 让你以编程方式 获取模型的上下文大小 只需访问contextSize属性 在SystemLanguageModel上 或PrivateCloudComputeLanguageModel上 在选择设备端模型 与PCC模型时 或决定使用哪个推理级别时 最好根据数据 来做这个决定 而不仅仅凭感觉 评估可以帮你了解 特定功能的质量 你可能会惊讶于 设备端模型的表现有多好 在某些任务上 尤其是今年更新后的模型 但唯一的判断方式就是通过评估

    这就是我们创建 全新Evaluations框架的原因 这是一个新的Swift框架 可以帮你评估 你的Foundation Models功能 它直接集成在Xcode中 且易于上手 你可以查看"Meet the Evaluations framework"以了解更多

    你甚至可以同时使用 设备端和服务器模型 查看"Build agentic app experiences with Foundation Models" 以了解更多相关内容 在你的App中使用PCC模型时 妥善处理用量限额 非常重要 请求会计入 用户的iCloud账户 你可以针对用户触达限额 的情况来优化你的App 让我们看看如何实现这一点

    这里我有一个使用PCC模型 对文章进行摘要的App 我可以选择一个Markdown文件 我们获取文本和图像 将其传入LanguageModelSession 并生成摘要 这得益于PCC提供的 大上下文大小 但当用户触达限额时 请求会抛出错误 如果这个错误只是显示在界面上 这不是一个好的用户体验 因为它不够实用 为了更好地处理这种情况 你可以检查模型quotaUsage 的isLimitReached 并在你的App中 用自定义界面处理它 这里我在按钮下方 使用了一个Label

    当用户的限额被超出时 你可以显示一个按钮 让用户管理其限额 例如 用户可以升级账户 以获得更高的限额 这样他们就能发出更多请求

    你应该将此功能 与现有界面集成 避免为用量限额 显示弹窗提示 因为这个界面应该持续显示 而不是被关闭 相反 你可以更新 界面的状态 例如禁用发出请求的按钮 在该按钮下方 我显示了一个低调的Label 以及让用户获得 更高限额的按钮 如有需要 你还可以检测 用户即将接近限额的情况 这有助于向用户表明 他们接近每日限额 让他们可以做出明智的决定 选择要发出哪些请求 在Xcode中 我们有 一个便捷的调试选项 来模拟用量限额状态 在你的Scheme中 选择Debug 然后选择Options

    这里有Simulate Apple Foundation Models Availability选项 我们可以选择Quota Usage Limit Reached 来模拟我们刚才 在界面中处理的情况 我们还可以选择 Nearing Usage Limit 来模拟用户 即将达到每日限额的情况

    我们之前已经处理了 isLimitReached情况 在之前的代码中 现在我们也可以 测试belowLimit情况 就像isLimitReached一样 我们可以显示一个简单Label

    在App中 这现在 在请求按钮下方显示Label 同样 这包含了 可操作的按钮 现在用户可以控制其限额 即使尚未达到最大值 这一切只需 几行代码 这就是集成的 快速概述 将Private Cloud Compute 集成到你的App中 如果你想在App中 使用这个新服务器模型 你今天就可以在 开发者网站上申请 我们还有大量其他内容 介绍Foundation Models 及相关框架的新功能 你可以先观看"What's new in the Foundation Models framework" 获取精彩概述 为了更好地了解 模型在运行时的行为 你可以查看"Debug and profile agentic app experiences with Instruments" 感谢观看! 那本书在哪里? 我需要把它拿到图书馆去

    不 真的 那本书在哪里?

    • 2:49 - Prompt the on-device model

      import FoundationModels
      
        let session = LanguageModelSession()
        let response = try await session.respond(to: "Summarize this article: \(article)")
    • 3:02 - Switch to the PCC server model (one-line change)

      import FoundationModels
        
        let session = LanguageModelSession(
            model: PrivateCloudComputeLanguageModel()
        )
        let response = try await session.respond(to: "Summarize this article: \(article)")
    • 3:25 - Structured output and tools work the same

      import FoundationModels
      
        @Generable
        struct ArticleSummary {
            let oneLineSummary: String
            let keyPoints: [String]
        }
      
        struct FindRelatedArticlesTool: Tool {
      
        }
        
        let session = LanguageModelSession(
            model: PrivateCloudComputeLanguageModel(),
            tools: [FindRelatedArticlesTool.self]
        )
      
        let response = try await session.respond(
            to: "Summarize this article: \(article)",
            generating: ArticleSummary.self
        )
    • 3:51 - Check availability

      import FoundationModels
        
        struct ArticleSummarizationView: View {
            private var model = PrivateCloudComputeLanguageModel()
      
            var body: some View {
                if model.isAvailable {
                    // Show UI for making request
                } else {
                    // Fall back
                }
            }
        }
    • 5:26 - Set a reasoning level

      let response = try await session.respond(
            to: prompt,
            contextOptions: ContextOptions(reasoningLevel: .light)
        )
        // Reasoning levels: .light, .moderate, .deep
    • 5:58 - Read the context size

      SystemLanguageModel().contextSize
        // 4096 on 26.0
        // 8192 on 27.0 (newer devices)
      
        PrivateCloudComputeLanguageModel().contextSize
        // 32768
    • 9:41 - Handle usage limits

      struct ArticleSummarizationView: View {
            private var model = PrivateCloudComputeLanguageModel()
      
            var body: some View {
                if case .belowLimit(let info) = model.quotaUsage.status {
                    if info.isApproachingLimit {
                        Text("Nearing usage limit.")
                            .foregroundStyle(Color.orange)
                    }
                }
                if model.quotaUsage.isLimitReached {
                    Text("Usage limit exceeded.")
                        .foregroundStyle(Color.red)
                }
                if let suggestion = model.quotaUsage.limitIncreaseSuggestion {
                    Button("Show options") {
                        suggestion.show()
                    }
                }
            }
        }
    • 0:00 - Introduction
    • Access to a new server LLM via Private Cloud Compute. The on-device model also improves this year (image input, better instruction following and tool calling), but PCC enables more complex features: reasoning over large input, many tool calls with large outputs, even from watchOS.

    • 1:23 - What is Private Cloud Compute
    • PCC delivers a powerful server model without compromising privacy: data is never stored, used only for the request, and independently verified. It's integrated with the OS and iCloud, so there's no authentication or API keys, no token cost to developers, a daily per-user limit (higher with iCloud+), and eligibility for apps under 2M downloads.

    • 2:43 - Integrating PCC with Foundation Models
    • Prompting the on-device model takes three lines; switching to the PCC server model changes just one. The unified Swift API means Generable structured output and tool calling work identically, so you can switch models without rewriting code, and should check the availability API for non-Apple Intelligence devices.

    • 4:00 - Deciding between on-device and PCC
    • Both offer privacy, but the on-device model works offline with no request limits and a 4K context, while PCC needs a connection, has a daily limit, offers a 32K context, and supports reasoning.

    • 4:32 - Reasoning levels and context size
    • Reasoning lets the model think before responding by generating extra transcript text, at three levels (light, moderate, deep). Set it on respond, observe the transcript to show progress, and remember reasoning consumes tokens against the context limit, now readable via the contextSize property.

    • 6:15 - Evaluating and combining models
    • Choose models and reasoning levels based on data, not vibes; the updated on-device model may surprise you. Use the new Evaluations framework (see "Meet the Evaluations framework") and combine on-device and server models together (see "Build agentic app experiences with Foundation Models").

    • 7:10 - Handling usage limits
    • Handle the per-user iCloud quota gracefully: check isLimitReached on the model's quotaUsage and show persistent, actionable UI (such as a disabled button with an upgrade option) rather than an alert. Detect the approaching-limit case too, and use Xcode's Simulate Apple Foundation Models Availability debug option to test both states.

    • 10:15 - Next steps
    • Apply for the server model on the developer website, and explore related content: "What's new in the Foundation Models framework" for an overview and "Debug and profile agentic app experiences with Instruments" for runtime behavior.

Developer Footer

  • 视频
  • WWDC26
  • 通过专用云计算充分利用 Apple Foundation Model
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • Mini Apps Partner Program
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则