← 所有文章

Evaluations:衡量模型质量的 XCTest(iOS 27)

一般的单元测试会断言 add(2, 2) 返回 4,若非如此,构建就会亮红灯。AI 功能在第一行就打破了这个契约,因为同一段 prompt 每次运行都可能产生不同的句子,而“不同”并不等于“错误”。你无法针对模型写出 #expect(summary == "预期的摘要"),因为根本不存在唯一的预期字符串。你能衡量的,是输出是否足够好、是否足够频繁地足够好,而衡量的依据是你自己设定的标准。Apple 全新的 Evaluations 框架正是提供了这套衡量机制,配合类型安全的 Swift API,作为开发流程的一环来运行1。它是 27 版的新功能,横跨各个 Apple 平台(iOS、iPadOS、macOS、visionOS 与 watchOS):这是一项你在测试时运行的开发者工具,通常跑在你的 Mac 上,而非你打包进 app 内发布的运行时功能1

如果你写过测试,这套结构会让你倍感熟悉。你定义数据集、生成模型响应、应用度量,再汇总结果,接着便能看出哪种做法表现最佳,以及个别响应在哪里不如预期1。它的心智模型就是模型质量版的 XCTest:相同的循环(安排一个用例、运行、断言某件事),只是断言的方式不同(用打过分的度量,而非相等比对)。

在第 298 场议程中,Apple 如此界定核心问题:生成式 AI 功能打破了软件测试的一项根本契约,因为同一组输入可能产生不同的输出,这使得单元测试力有未逮25

Watch on Apple Developer ↗
为何相等断言会在 AI 功能上失灵:同一组输入可能产生不同的输出。

TL;DR / 重点摘要

  • Evaluations 框架是 27 版在所有 Apple 平台(iOS、iPadOS、macOS、visionOS、watchOS)上的新功能,是一层用来衡量智能驱动功能的开发者工具,作为测试流程的一环来运行(通常在 Mac 上)1
  • Evaluator 是你直接内嵌编写、以 closure 为基础的评估器;Evaluation 协议则是你实现的类型,用来让被测系统针对数据集运行,并应用各个评估器23
  • Metric 通过工厂方法(passingfailingscoringignore)携带一个具名结果,而 ScoreDimension 则为“以模型当裁判”的评估器命名一条评分轴45
  • ModelSample 是通用型的评估样本;SampleGenerator 是一个 actor,会以异步流的方式从语言模型生成样本;结果会落入一个具有类型化列的 DataFrame,其中包含一个 responseColumn678
  • ToolCallEvaluator 会比对智能体式工具调用与 TrajectoryExpectation,并由 ArgumentMatcher 定义每个参数的验证方式91011
  • EvaluationTrait 会在一个测试内运行评估,并将结果记录为附件,这正是接入 Swift Testing 运行的桥梁12

本文逐一走过 API 表面、说明每个组件存在的原因,并把它们系回它所评分的 Foundation Models 工具调用工作。凡是我展示某个 Apple 尚未公布确切签名的调用,我都会标注为示意用途,并提醒你务必对照官方文档确认。

Evaluator 模型

框架的核心问题是“这次输出有多好”,而它用一套精简的词汇来回答:评估器负责判定、度量负责记录、评分维度负责打分,结果则负责汇总。

Evaluation 协议是你实现来定义一次评估的类型,它会让被测系统针对数据集运行,并应用各个评估器来衡量表现3。其声明极为精简:

// 27.0 beta (all Apple platforms)
protocol Evaluation : Sendable

这个协议之所以是 Sendable,是因为评估属于并发作业:众多样本并行运行,正如 Swift Testing 默认会并行运行测试用例一样13。当你想要一个可复用、具名的评估时,便实现这个协议。当你想要快速搞定时,则改用 Evaluator,Apple 将它描述为以 closure 为基础、可内嵌使用而无须定义自定义类型的评估器2

// 27.0 beta (all Apple platforms)
struct Evaluator<Input> where Input : SampleProtocol,
    Input.ExpectedValue : Decodable,
    Input.ExpectedValue : Encodable,
    Input.ExpectedValue : Sendable

Apple 的说明指出,这个 closure 会接收输入样本与响应,并可同时访问 .value.transcript2.value 是模型的类型化输出;.transcript 则是它如何得出结果的记录。内嵌评估器就是模型质量版的一行式 #expect 代码块:不必创建子类,只要把判断写成一个 closure 即可。以下的调用形式仅供示意;请对照 Apple 文档确认其初始化器:

import Evaluations

// Illustrative call shape — confirm against Apple's docs.
let nonEmpty = Evaluator<ModelSample<String>> { input, response in
    response.value.isEmpty ? .failing("empty output") : .passing()
}

closure 返回的是一个 Metric。Apple 把 Metric 描述为携带结果值的具名度量,并明确点名各个工厂方法:passingfailingscoringignore 各会返回一个内含结果的新 Metric4

// 27.0 beta (all Apple platforms)
struct Metric

这四个工厂方法对应到 AI 功能所需的各种判断类型。摘要工具要么包含必要的事实、要么没有,因此得到 passingfailing。语气评分准则从 1 分到 5 分,因此得到 scoring。某个你想排除于汇总之外的样本(格式错误的输入、已知有问题的测试夹具)则得到 ignore,它会把该行保留在数据集中,又不致污染统计数字。从 passing 到打分式 scoring 的这整段范围,正是框架所承诺的:从简单的通过或失败检查,一路到配合“以模型当裁判”模式的细致打分1

在这段范围的打分端,ScoreDimension 才真正体现价值。Apple 将它定义为“以模型当裁判”评估器的具名评分维度,每个维度都会定义一个名称(用作 DataFrame 列)、一段可选的描述,以及每个分数所代表含义的定义5

// 27.0 beta (all Apple platforms)
struct ScoreDimension

单一输出可能在某条轴上表现良好,在另一条轴上却表现不佳。一封草拟的电子邮件可能内容正确,语气却不对。ScoreDimension 让你分开为这些轴打分(正确性、语气、简洁度),如此汇总结果便能告诉你是哪个维度下滑,而不只是整体质量下滑。维度名称会成为一个列,意味着分数会落入一张可排序、可比较的结构化表格,而非一大片散文。

那张表格就是 EvaluationResult。Apple 把它描述为运行一次模型评估的结果,是一个包含该次评估运行之摘要与详细结果的结构14

// 27.0 beta (all Apple platforms)
struct EvaluationResult

这种两层式结构(摘要加上明细)正是评估得以付诸行动的关键。摘要回答“这段 prompt 是否比上一段表现更好”。明细回答“哪些样本不如预期”,让你能打开最糟的那几行,读出模型究竟产生了什么1

样本与生成

评估需要可供运行的用例,而框架中一个用例的单位就是样本。ModelSample 是通用的那一种。Apple 将它描述为通用型的语言模型评估样本,可接受以字符串为基础的 prompt 与指示6

// 27.0 beta (all Apple platforms)
struct ModelSample<ExpectedValue> where ExpectedValue : Decodable,
    ExpectedValue : Encodable,
    ExpectedValue : Sendable

泛型参数 ExpectedValue 就是类型化的预期值:自由文本任务用字符串,有已知答案的任务则用结构化的 Codable 类型。Codable 加上 Sendable 这两项约束,与 EvaluatorInput.ExpectedValue 相互呼应,因为预期值必须序列化进结果表格,并在并行运行期间跨越并发边界。至于多模态的 prompt,Apple 指出你可以创建自定义的一致性,或改用配合预构建 prompt 的初始化器6

手动编写每个样本并不具备可扩展性,这正是 SampleGenerator 存在的理由,它是一个会运用语言模型生成评估样本的 actor7

// 27.0 beta (all Apple platforms)
actor SampleGenerator<SampleType> where SampleType : ModelSampleProtocol

它之所以是 actor,是因为它持有可变的生成状态(已接受与已拒绝的样本),而异步迭代会改动这个状态,actor 隔离正是 Swift 用来防范该状态出现数据竞争的护栏。Apple 的工作流程是:创建一个生成器、配置其属性,再调用它以异步流的方式产出新样本;迭代结束后,你便能获取所有已生成的样本,或任何被验证器拒绝的样本7。被拒绝的那一批是值得停下来细看的细节。一个悄悄丢弃坏样本的生成器,会把自己的失败率藏起来;把这些被拒样本摊开来,能让你像审计手写夹具那样审计数据集。

样本一旦运行完毕,响应便会落入一个带有类型化列描述符的 DataFrame,让你不必靠字符串硬查就能读取表格。Apple 为响应列取了精确的名称:responseColumn,这是详细 DataFrame 中模型响应的类型化列描述符8

// 27.0 beta (all Apple platforms)
var responseColumn: ResultColumn<Self.Subject> { get }

泛型 ResultColumn<Value> 正是让列具备类型的关键:它是 DataFrame 列的描述符,以其所容纳的值来参数化15。除了 responseColumn,框架还提供了对应输入样本的 inputColumn,以及对应预期值的 expectedColumn,每一个都是类型化的 ResultColumn1617。类型化列所秉持的,与 Swift Testing 的表达式捕获是同一种直觉:与其从一个无类型的袋子里掏出某个值、再祈祷类型转换成立,不如通过一个知道自身类型的描述符来读取它。当你把结果喂进 MetricsAggregator 求取平均值、中位数与标准差时,这些列就是你定位数据的途径,无须对键名瞎猜18

工具与轨迹检查

最难测试的 AI 功能就是智能体式的那一种,因为正确与否并非一个字符串,而是一连串动作。当一个 Foundation Models 会话先调用 OCRTool、再调用 BarcodeReaderTool、接着调用你自己的目录查询时,问题不在于“最终那句话是否吻合”,而在于“模型是否走了正确的路径”19ToolCallEvaluator 会直接为那条路径打分。Apple 将它描述为一个会比对智能体式工具调用与预期轨迹的评估器9

// 27.0 beta (all Apple platforms)
struct ToolCallEvaluator<Input> where Input : ModelSampleProtocol,
    Input.Expectation == TrajectoryExpectation

where 子句是承重的部分:输入的预期值必须是一个 TrajectoryExpectation。Apple 把这个类型描述为一次评估所预期的工具调用模式,并沿三条轴来指定10

// 27.0 beta (all Apple platforms)
struct TrajectoryExpectation

Apple 指出 ToolCallEvaluator 支持有序序列、无序预期、不允许工具的检查,以及分组步骤,并能在单次评估流程中同时产出严格与部分两种结果9。每一项都对应到一种真实的智能体失误。有序序列能逮到以错误顺序调用正确工具的模型。无序预期则表示“这些调用都得发生,顺序不限”。不允许工具的检查能逮到伸手去碰它本不该碰的工具的模型(这是安全场景:一个本应保持只读的智能体却去调用了具破坏性的工具)。分组步骤则用来表达“择一即可”,对应到有不止一条路径可被接受的分支情形。

严格加部分这组搭配,贴合智能体质量实际劣化的方式。一段新 prompt 很少会把功能从完美直接拖垮;它通常是把功能从“每次都走对轨迹”拉到“多数时候走对轨迹,但有一个调用顺序颠倒”。只有严格结果会把这种情况报告成一次平板的失败,完全没告诉你模型究竟差了多少。部分结果则量化了这些差之毫厘的情况,而那正是你用来调校的信号。

每次调用的正确性则位于更下一层,落在参数里。模型可能用错误的值去调用正确的工具,而 ArgumentMatcher 会定义每个参数的验证方式。Apple 将它描述为用来定义如何验证工具调用参数的那些值11

// 27.0 beta (all Apple platforms)
enum ArgumentMatcher

Apple 的说明列出了各项验证规则:要求精确的值、确认键是否存在、检查范围、匹配模式,或运用语言模型进行语义匹配11。语义匹配这一项,正是单纯的相等断言无从表达的。如果某个工具参数是一段自由文本查询,两个不同的字符串可能同样正确,而一般的 == 会让一个明明很好的调用不通过。把那个参数交给“以模型当裁判”的匹配,正是 ScoreDimension 在输出层所提供的同一个逃生口,只是应用在参数层。各个 case 的拼写取自 Apple 的枚举;以下仅供示意,请务必对照文档确认:

import Evaluations

// Illustrative — confirm shapes against Apple's docs.
let expectation = TrajectoryExpectation(/* ordered / unordered / disallowed steps */)
let evaluator = ToolCallEvaluator<ModelSample<String>>(/* expectation */)

这里的智能体循环,正是 Foundation Models 工具调用一文 从运行时那一侧所描述的同一个循环。在那里,GenerationOptions.ToolCallingMode 掌管设备端模型伸手取用工具的积极程度,而框架可在首次调用之后切换模式,借此限定单次请求的工具活动量19ToolCallEvaluator 则是同一个行为的衡量端:你在运行时设定调用姿态,再于测试时为轨迹打分,以确认该姿态确实产出了你所预期的路径。运行时的旋钮与测试时的评估器,是同一项功能的两端。

这如何融入工作流程

评估并不是你每季度才举行一次的独立仪式。它们属于你测试的左邻右舍,待在同一个循环里,跑在同一台 Mac 上。框架接入那个循环的桥梁就是 EvaluationTrait。Apple 将它描述为一个会运行评估并把结果记录为附件的测试 trait12

// 27.0 beta (all Apple platforms)
struct EvaluationTrait

“trait”这个词用得刻意。Swift Testing 整套配置模型,就是应用在 @Test@Suite 声明上的各个 trait:.enabled(if:).disabled(_:).tags(...) 等等13EvaluationTrait 把一次评估嵌入这套词汇,于是评估的运行方式就跟测试一样,落在同一个 swift test 调用之下,享有同样的并行性。把结果记录为附件,沿用的是 Swift Testing 既有的自定义附件机制,因此评估的详细结果会一并搭着测试报告与你收集的 CI 产物前行13。框架还提供了一个 EvaluationContext,让测试范围内的代码能在评估完成后读取结果20

那个 trait 回答了“评估住在哪里”。它们住在你的测试目标里,紧邻你的单元测试,受同一批 trait 所节制。一个 .tags(.evals) 注解能在 prompt 变更后只运行模型质量检查,正如 .tags(.regression) 用来框定一次回归运行13。快速的单元式测试每次编辑都保持绿灯;较慢、由模型驱动的评估,则只跑在那些会触及模型的 prompt 与工具定义上。

评估与测试的这道分界,呼应了 智能体工作流程一文 所谈的运行时与开发工具之分,该文划出了 app 发布的设备端模型,与开发者用来开发 app 的工具模型之间的界线21。Evaluations 站在这道界线的构建那一侧:它是 27 周期的开发者工具,在迭代过程中运行,用来衡量你所发布的运行时功能是否足够好1。你不会把 Evaluations 框架发布给用户,正如你不会发布 XCTest 一样。你发布的是它所产生的那份信心。

框架对于你要评分哪个模型也保持开放。Apple 指出它能配合你代码可取用的任何模型运行,而数据集那一侧则通过 Loader 来供应,这是一个供“能提供数据集的类型”遵循的协议,可使用内置的具体类型,也可为你自己的来源创建自定义的一致性122。在“以模型当裁判”的打分上,ModelJudgeEvaluator 会把查询、响应与可选的参考数据送往一个裁判模型,由它返回一个或多个维度的分数23,而裁判 prompt 可通过 ModelJudgePrompt 配置,它把指示、响应呈现方式与参考数据注入这三者,捆成单一个可组合的值24。如果你的技术栈本就信任 Claude,不妨通过你自己的代码路径把 Claude 拿来当裁判;框架并不会把你绑死在单一模型上。

常见问题

Evaluations 框架是什么?它在哪个平台上运行?

Evaluations 框架运用类型安全、能融入你开发流程的 Swift API,来衡量你 app 中智能驱动功能的质量1。它是 27 版在 iOS、iPadOS、macOS、visionOS 与 watchOS 上的新功能:这是一个你在测试时运行的开发者工具框架(通常在 Mac 上),而非打包进 app 内发布的运行时功能1。你定义数据集、生成模型响应、应用度量,再汇总结果,接着便能看出哪种做法表现最佳,以及个别响应在哪里不如预期1

为什么我不能用 XCTest 或 Swift Testing 的相等断言来测 AI 功能?

相等断言需要一个唯一的预期值,而非确定性的模型并没有这种东西:同一段 prompt 每次运行都可能产生一个不同却有效的输出。Evaluations 以打过分的判断取代了相等比对。一个 Metric 会记录 passingfailingscoringignore 的结果,而一个 ScoreDimension 则在一条具名的轴上为输出打分45。你仍然通过 EvaluationTrait 在测试内运行这些评估,因此它们与你其他的测试住在同一个目标、同一个 swift test 循环里12

框架如何评估智能体式的工具调用行为?

通过 ToolCallEvaluator,它会比对智能体式工具调用与一条预期轨迹9。你以 TrajectoryExpectation 沿三条轴描述路径;该评估器支持有序序列、无序预期、不允许工具的检查,以及分组步骤,并能在一次流程中产出严格与部分两种结果910。逐参数的验证则使用 ArgumentMatcher(精确的值、键是否存在、范围、模式,或以模型为基础的语义匹配)11

Evaluator 和 Evaluation 协议有什么区别?

Evaluator 是以 closure 为基础、可内嵌使用而无须定义自定义类型的评估器;它的 closure 会接收输入样本与响应,并可访问 .value.transcript2Evaluation 协议则是你实现的类型,用来定义一个可复用、具名的评估,它会让被测系统针对数据集运行并应用各个评估器3。需要快速内嵌检查时就用 Evaluator,需要结构化、可重复的评估时就用 Evaluation 协议。

生成的样本与结果住在哪里?

SampleGenerator 是一个 actor,会以异步流的方式从语言模型生成样本;迭代结束后,你可读取已接受的样本,或被验证器拒绝的那些7。结果会落入一个带有类型化 ResultColumn 描述符的 DataFrame:responseColumninputColumnexpectedColumn8161715MetricsAggregator 则在这些数据上计算平均值、中位数与标准差18

完整的 Apple Ecosystem 系列:Foundation Models 框架解析运行时 LLM 与开发工具 LLM 之分;本框架所评分的 iOS 27 工具调用控制;以及 Swift Testing 与 XCTest 之比较EvaluationTrait 正是接入了它的 trait 模型。系列总览位于 Apple Ecosystem 系列。若想了解更广泛的“iOS 结合 AI 智能体”脉络,请参阅 iOS 智能体开发指南



  1. Apple Developer, “Evaluations” framework overview. Available iOS 27.0, iPadOS 27.0, Mac Catalyst 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0 (all beta). Abstracted as “measure the quality of your app’s intelligence-powered features.” Apple’s discussion states you define datasets, generate model responses, apply metrics, and aggregate results with type-safe Swift APIs that integrate into your development workflow; the framework evaluates features against metrics from simple pass or fail checks to detailed scoring with model-as-judge patterns, aggregates results into summaries that show which approach performs best and where individual responses fall short, and works with any model available to your code. (iOS 27.0+ beta, all Apple platforms) 

  2. Apple Developer, “Evaluator”. A structure (struct Evaluator<Input> with Input : SampleProtocol and Input.ExpectedValue conforming to Decodable, Encodable, Sendable) abstracted as a closure-based evaluator; Apple’s discussion states the closure receives the input sample and the response, providing access to .value and .transcript. (iOS 27.0+ beta, all Apple platforms) 

  3. Apple Developer, “Evaluation”. A protocol (protocol Evaluation : Sendable) abstracted as a type that defines an evaluation; Apple’s discussion states the evaluation runs your system under test against a dataset and applies evaluators to measure performance. (iOS 27.0+ beta, all Apple platforms) 

  4. Apple Developer, “Metric”. A structure (struct Metric) abstracted as a named metric that carries a result value; Apple’s discussion states the factory methods passing, failing, scoring, and ignore return a new Metric with the result stored inside. (iOS 27.0+ beta, all Apple platforms) 

  5. Apple Developer, “ScoreDimension”. A structure (struct ScoreDimension) abstracted as a named scoring dimension for a model judge evaluator; Apple’s discussion states each dimension defines a name (used as the DataFrame column), an optional description, and a definition of what each score means. (iOS 27.0+ beta, all Apple platforms) 

  6. Apple Developer, “ModelSample”. A structure (struct ModelSample<ExpectedValue> with ExpectedValue conforming to Decodable, Encodable, Sendable) abstracted as a general-purpose language model evaluation sample; Apple’s discussion states it accepts string-based prompts and instructions, and that multimodal prompts use a custom conformance or an initializer with a prebuilt prompt. (iOS 27.0+ beta, all Apple platforms) 

  7. Apple Developer, “SampleGenerator”. Declared actor SampleGenerator<SampleType> with SampleType : ModelSampleProtocol, abstracted as an actor that generates evaluation samples using a language model; Apple’s discussion states you create a generator, configure its properties, then call it to produce new samples as an async stream, after which you access all generated samples or any the validator rejected. (iOS 27.0+ beta, all Apple platforms) 

  8. Apple Developer, “responseColumn”. An instance property (var responseColumn: ResultColumn<Self.Subject> { get }) abstracted as a typed column descriptor for the model responses in the detailed DataFrame. (iOS 27.0+ beta, all Apple platforms) 

  9. Apple Developer, “ToolCallEvaluator”. A structure (struct ToolCallEvaluator<Input> with Input : ModelSampleProtocol and Input.Expectation == TrajectoryExpectation) abstracted as an evaluator that verifies agentic tool calls against an expected trajectory; Apple’s discussion states it produces both a strict and partial result from a single evaluation pass and supports ordered sequences, unordered expectations, disallowed tool checks, and group steps. (iOS 27.0+ beta, all Apple platforms) 

  10. Apple Developer, “TrajectoryExpectation”. A structure (struct TrajectoryExpectation) abstracted as the expected pattern of tool calls for an evaluation; Apple’s discussion states it specifies expected tool-calling behavior across three axes. (iOS 27.0+ beta, all Apple platforms) 

  11. Apple Developer, “ArgumentMatcher”. An enumeration (enum ArgumentMatcher) abstracted as the values that define how to validate a tool-call argument; Apple’s discussion states you can require exact values, verify key presence, check ranges, match patterns, or use a language model for semantic matching. (iOS 27.0+ beta, all Apple platforms) 

  12. Apple Developer, “EvaluationTrait”. A structure (struct EvaluationTrait) abstracted as a test trait that runs an evaluation and records the result as attachments. (iOS 27.0+ beta, all Apple platforms) 

  13. Author’s analysis in Swift Testing: The Framework Replacing XCTest, May 2, 2026, covering @Test, @Suite, #expect, #require, parallel-by-default execution, custom attachments, and the trait vocabulary (.enabled(if:), .disabled(_:), .serialized, .timeLimit(...), .tags(...), .bug(...)) that EvaluationTrait extends, with citations to Apple’s Swift Testing and Trait references. 

  14. Apple Developer, “EvaluationResult”. A structure (struct EvaluationResult) abstracted as the results of running a model evaluation; Apple’s discussion states it contains the summary and detailed results from an evaluation run. (iOS 27.0+ beta, all Apple platforms) 

  15. Apple Developer, “ResultColumn”. A structure (struct ResultColumn<Value>) abstracted as a typed descriptor for a column in an evaluation result DataFrame. (iOS 27.0+ beta, all Apple platforms) 

  16. Apple Developer, “inputColumn”. An instance property (var inputColumn: ResultColumn<Self.Sample> { get }) abstracted as a typed column descriptor for the input samples in the detailed DataFrame. (iOS 27.0+ beta, all Apple platforms) 

  17. Apple Developer, “expectedColumn”. An instance property (var expectedColumn: ResultColumn<Self.Sample.ExpectedValue> { get }) abstracted as a typed column descriptor for the expected values in the detailed DataFrame. (iOS 27.0+ beta, all Apple platforms) 

  18. Apple Developer, “MetricsAggregator”. A structure (struct MetricsAggregator) abstracted as a utility for computing aggregate statistics from evaluation metrics; Apple’s discussion states it calculates summary statistics like mean, median, and standard deviation, processing metric data from a DataFrame to produce aggregated results. (iOS 27.0+ beta, all Apple platforms) 

  19. Author’s analysis in Foundation Models in iOS 27: Tool-Calling Control, June 8, 2026, covering GenerationOptions.ToolCallingMode, the framework’s after-first-call mode shift, and the built-in Vision tools OCRTool and BarcodeReaderTool

  20. Apple Developer, “EvaluationContext”. A structure (struct EvaluationContext) abstracted as a context that provides the evaluation result within a test scope; Apple’s discussion states you access the result after the evaluation completes. (iOS 27.0+ beta, all Apple platforms) 

  21. Author’s analysis in Foundation Models Agentic Workflow: In-App vs Tooling LLM, May 1, 2026, on the runtime/tooling LLM distinction and the trust boundary between the shipped on-device model and the developer’s tooling model. 

  22. Apple Developer, “Loader”. A protocol (protocol Loader<Sample> : Sendable) abstracted as a protocol for types that supply a dataset for evaluation; Apple’s discussion states you use one of the built-in concrete types or implement the protocol directly for custom data sources. (iOS 27.0+ beta, all Apple platforms) 

  23. Apple Developer, “ModelJudgeEvaluator”. A structure (struct ModelJudgeEvaluator<Input> with Input : ModelSampleProtocol) abstracted as an evaluator that uses a language model as a judge to score responses; Apple’s discussion states it sends the query, response, and optional reference data to a judge model that returns scores for one or more dimensions. (iOS 27.0+ beta, all Apple platforms) 

  24. Apple Developer, “ModelJudgePrompt”. A structure (struct ModelJudgePrompt<Input> with Input : ModelSampleProtocol) abstracted as a configuration for how a model-as-judge evaluator constructs its prompt; Apple’s discussion states it bundles the instructions, response presentation, and reference-data injection into a single composable value. (iOS 27.0+ beta, all Apple platforms) 

  25. Apple, WWDC26 session 298, Meet the Evaluations framework. Apple states generative-AI features “break a contract that is fundamental to software testing” because “the same input can produce different outputs,” and concludes that “unit tests are insufficient.” 

相关文章

Swift 新特性(2026):WWDC26 更新解读

来自 WWDC26 的 Swift 6.3 与 6.4:anyAppleOS 可用性、模块选择符、borrow/mutate 访问器、Iterable 协议、Swift Testing 互操作以及 MLX。

5 分钟阅读

Apple 即将开源 Foundation Models 框架

WWDC 2026:Foundation Models 框架将于今夏开源,同一套 Swift API 也能在服务器端运行,同时一个全新的 Skills 包已上线 GitHub。

4 分钟阅读

The Robots Are Taking Exams in My Search Console

First-party GSC data: 91% of 3.8M impressions fail a human-query filter. Exam questions, pasted errors, and agent sweeps…

10 分钟阅读