mcpField
A
axiom-foundation-models-diag

axiom-foundation-models-diag

github.com/charleswiltgen开发1.2k178 次安装今天更新
代码仓库

关于 axiom-foundation-models-diag

面向使用 Apple Foundation Models 的开发者的诊断指南,涵盖可用性、上下文限制、护栏、输出质量与性能问题,并给出检查步骤和处理方案。

主要功能

  1. 01检查模型可用性
  2. 02诊断上下文窗口超限
  3. 03处理护栏与语言错误
  4. 04排查输出质量问题
  5. 05优化生成延迟与界面响应

适用场景

  1. 01调查设备上模型不可用
  2. 02处理长对话导致的上下文错误
  3. 03诊断生成内容不准确或格式异常
  4. 04减少生成等待和界面冻结

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/charleswiltgen/axiom --skill axiom-foundation-models-diag

安装后在 Claude Code 中输入/axiom-foundation-models-diag确认已加载。

详细介绍

基础模型诊断

概述

基础模型问题表现为上下文窗口超限错误、护栏违规、生成速度慢、可用性故障和意外输出。核心原则 80% 的基础模型问题源于对模型能力的误解(设备级模型,参数量为 3B,而非具备世界知识)、对上下文限制(4096 个 token)的误解,或对可用性要求的误解,而非框架缺陷。

危险信号 — 怀疑是基础模型问题

如果你看到以下任意情况,就应怀疑是对基础模型的理解有误,而非框架故障:

  • 生成耗时 >5 秒
  • 错误:exceededContextWindowSize
  • 错误:guardrailViolation
  • 错误:unsupportedLanguageOrLocale
  • 模型给出幻觉内容/错误输出
  • 生成过程中 UI 卡顿
  • 功能在模拟器中正常运行,但在设备上不行
  • ❌ 禁止“基础模型坏了,我们需要换一种 AI”
    • 基础模型为数百万台设备上的 Apple Intelligence 提供支持
    • 输出错误 = 用例不当(需要世界知识,而非摘要)
    • 不要试图为问题找借口——要进行诊断

关键区别 基础模型是设备级模型(参数量为 3B),针对摘要、提取和分类进行了优化——而非用于世界知识或复杂推理。将其用于不适合的任务必然会导致结果不佳。

必须首先执行的步骤

务必先运行这些操作(在更改代码之前):

// 1. Check availability
let availability = SystemLanguageModel.default.availability

switch availability {
case .available:
    print("✅ Available")
case .unavailable(let reason):
    print("❌ Unavailable: \(reason)")
    // Possible reasons:
    // - Device not Apple Intelligence-capable
    // - Region not supported
    // - User not opted in
}

// Record: "Available? Yes/no, reason if not"

// 2. Check supported languages
let supported = SystemLanguageModel.default.supportedLanguages
print("Supported languages: \(supported)")
print("Current locale: \(Locale.current.language)")

if !supported.contains(Locale.current.language) {
    print("⚠️ Current language not supported!")
}

// Record: "Language supported? Yes/no"

// 3. Check context usage
let session = LanguageModelSession()
// After some interactions:
print("Transcript entries: \(session.transcript.entries.count)")

// Rough estimation (not exact):
let transcriptText = session.transcript.entries
    .map { $0.content }
    .joined()
print("Approximate chars: \(transcriptText.count)")
print("Rough token estimate: \(transcriptText.count / 3)")
// 4096 token limit ≈ 12,000 characters

// Record: "Approaching context limit? Yes/no"

// 4. Profile with Instruments
// Run with Foundation Models Instrument template
// Check:
// - Initial model load time
// - Token counts (input/output)
// - Generation time per request
// - Areas for optimization

// Record: "Latency profile: [numbers from Instruments]"

// 5. Inspect transcript for debugging
print("Full transcript:")
for entry in session.transcript.entries {
    print("Entry: \(entry.content.prefix(100))...")
}

// Record: "Any unusual entries? Repeated content?"
这些信息说明了什么
  • 不可用 → 转到模式 1a/1b/1c(可用性问题)
  • 上下文超限 → 转到模式 2a(token 限制)
  • 护栏错误 → 转到模式 2b(内容政策)
  • 语言错误 → 转到模式 2c(不支持的语言)
  • 输出错误 → 转到模式 3a/3b/3c(输出质量)
  • 生成缓慢 → 转到模式 4a/4b/4c/4d(性能)
  • UI 卡住 → 转到模式 5a(阻塞主线程)
必须进行的判断

更改任何代码之前,先确定以下情况中的一项:

  1. 如果 availability = .unavailable → 设备/地区/用户未选择加入的问题(不是代码错误)
  2. 如果错误是 exceededContextWindowSize → token 过多(精简对话记录)
  3. 如果错误是 guardrailViolation → 触发了内容政策(不是模型故障)
  4. 如果错误是 unsupportedLanguageOrLocale → 不支持该语言(检查支持列表)
  5. 如果输出内容存在幻觉 → 用例不当(需要世界知识,而非提取)
  6. 如果生成耗时 >5 秒 → 未使用流式生成,或需要优化
  7. 如果 UI 卡住 → 在主线程上调用(使用 Task {})
如果诊断结果相互矛盾或不明确
  • 停止。暂时不要继续查看模式
  • 为每次 respond() 调用添加详细日志
  • 使用 Instruments Foundation Models 模板运行
  • 确定基准:实际发生了什么,以及你原本假设了什么

决策树

Foundation Models problem?
│
├─ Won't start?
│  ├─ .unavailable → Availability issue
│  │  ├─ Device not capable? → Pattern 1a (device requirement)
│  │  ├─ Region restriction? → Pattern 1b (regional availability)
│  │  └─ User not opted in? → Pattern 1c (Settings check)
│  │
├─ Generation fails?
│  ├─ exceededContextWindowSize → Context limit
│  │  └─ Long conversation or verbose prompts? → Pattern 2a (condense)
│  │
│  ├─ guardrailViolation → Content policy
│  │  └─ Sensitive or inappropriate content? → Pattern 2b (handle gracefully)
│  │
│  ├─ unsupportedLanguageOrLocale → Language issue
│  │  └─ Non-English or unsupported language? → Pattern 2c (language check)
│  │
│  └─ Other error → General error handling
│     └─ Unknown error type? → Pattern 2d (catch-all)
│
├─ Output wrong?
│  ├─ Hallucinated facts → Wrong model use
│  │  └─ Asking for world knowledge? → Pattern 3a (use case mismatch)
│  │
│  ├─ Wrong structure → Parsing issue
│  │  └─ Manual JSON parsing? → Pattern 3b (use @Generable)
│  │
│  ├─ Missing data → Tool needed
│  │  └─ Need external information? → Pattern 3c (tool calling)
│  │
│  └─ Inconsistent output → Sampling issue
│     └─ Different results each time? → Pattern 3d (temperature/greedy)
│
├─ Too slow?
│  ├─ Initial delay (1-2s) → Model loading
│  │  └─ First request slow? → Pattern 4a (prewarm)
│  │
│  ├─ Long wait for results → Not streaming
│  │  └─ User waits 3-5s? → Pattern 4b (streaming)
│  │
│  ├─ Verbose schema → Token overhead
│  │  └─ Large @Generable type? → Pattern 4c (includeSchemaInPrompt)
│  │
│  └─ Complex prompt → Too much processing
│     └─ Massive prompt or task? → Pattern 4d (break down)
│
└─ UI frozen?
   └─ Main thread blocked → Async issue
      └─ App unresponsive during generation? → Pattern 5a (Task {})

诊断模式

模式 1a:设备不支持

症状:

  • SystemLanguageModel.default.availability = .unavailable
  • 原因:设备不支持 Apple Intelligence

诊断:

let availability = SystemLanguageModel.default.availability

switch availability {
case .available:
    print("✅ Available")
case .unavailable(let reason):
    print("❌ Reason: \(reason)")
    // Check if device-related
}

修复:

// ❌ BAD - No availability UI
let session = LanguageModelSession() // Crashes on unsupported devices

// ✅ GOOD - Graceful UI
struct AIFeatureView: View {
    @State private var availability = SystemLanguageModel.default.availability

    var body: some View {
        switch availability {
        case .available:
            AIContentView()
        case .unavailable:
            VStack {
                Image(systemName: "cpu")
                Text("AI features require Apple Intelligence")
                    .font(.headline)
                Text("Available on iPhone 15 Pro and later")
                    .font(.caption)
                    .foregroundColor(.secondary)
            }
        }
    }
}

耗时:添加 UI 需要 5-10 分钟


模式 1b:地区可用性

症状:

  • 功能对部分用户有效,对其他用户无效
  • 因地区限制而不可用

诊断: 基础模型需要:

  • 受支持的地区(例如,最初支持美国、英国、澳大利亚)
  • 支持范围可能会逐步扩大

修复:

// ✅ GOOD - Clear messaging
switch SystemLanguageModel.default.availability {
case .available:
    // proceed
case .unavailable(let reason):
    // Show region-specific message
    Text("AI features not yet available in your region")
    Text("Check Settings → Apple Intelligence for availability")
}

耗时:5 分钟


模式 1c:用户未选择加入

症状:

  • 设备支持,地区受支持
  • 仍然不可用

诊断: 用户必须在“设置”中选择加入 Apple Intelligence

修复:

// ✅ GOOD - Direct user to settings
switch SystemLanguageModel.default.availability {
case .available:
    // proceed
case .unavailable:
    VStack {
        Text("Enable Apple Intelligence")
        Text("Settings → Apple Intelligence → Enable")
        Button("Open Settings") {
            if let url = URL(string: UIApplication.openSettingsURLString) {
                UIApplication.shared.open(url)
            }
        }
    }
}

耗时:10 分钟


模式 2a:上下文窗口超限

症状:

Error: LanguageModelSession.GenerationError.exceededContextWindowSize

诊断:

  • 4096 个 token 限制(输入 + 输出)
  • 长对话会累积 token
  • 冗长的提示词会占用限制额度

修复:

// ❌ BAD - Unhandled error
let response = try await session.respond(to: prompt)
// Crashes after ~10-15 turns

// ✅ GOOD - Condense transcript
var session = LanguageModelSession()

do {
    let response = try await session.respond(to: prompt)
} catch LanguageModelSession.GenerationError.exceededContextWindowSize {
    // Condense and continue
    session = condensedSession(from: session)
    let response = try await session.respond(to: prompt)
}

func condensedSession(from previous: LanguageModelSession) -> LanguageModelSession {
    let entries = previous.transcript.entries

    guard entries.count > 2 else {
        return LanguageModelSession(transcript: previous.transcript)
    }

    // Keep: first (instructions) + last (recent context)
    var condensed = [entries.first!, entries.last!]

    let transcript = Transcript(entries: condensed)
    return LanguageModelSession(transcript: transcript)
}

耗时:实现精简需要 15-20 分钟


模式 2b:护栏违规

症状:

Error: LanguageModelSession.GenerationError.guardrailViolation

诊断:

  • 用户输入触发了内容政策
  • 暴力、仇恨言论、非法活动
  • 模型拒绝生成

修复:

// ✅ GOOD - Graceful handling
do {
    let response = try await session.respond(to: userInput)
    print(response.content)
} catch LanguageModelSession.GenerationError.guardrailViolation {
    // Show user-friendly message
    print("I can't help with that request")
    // Log for review (but don't show user input to avoid storing harmful content)
}

耗时:5-10 分钟


模式 2c:不支持的语言

症状:

Error: LanguageModelSession.GenerationError.unsupportedLanguageOrLocale

诊断: 用户输入的语言不受模型支持

修复:

// ❌ BAD - No language check
let response = try await session.respond(to: userInput)
// Crashes if unsupported language

// ✅ GOOD - Check first
let supported = SystemLanguageModel.default.supportedLanguages

guard supported.contains(Locale.current.language) else {
    // Show disclaimer
    print("Language not supported. Currently supports: \(supported)")
    return
}

// Also handle errors
do {
    let response = try await session.respond(to: userInput)
} catch LanguageModelSession.GenerationError.unsupportedLanguageOrLocale {
    print("Please use English or another supported language")
}

耗时:10 分钟


模式 2d:通用错误处理

症状: 未知错误类型

修复:

// ✅ GOOD - Comprehensive error handling
do {
    let response = try await session.respond(to: prompt)
    print(response.content)
} catch LanguageModelSession.GenerationError.exceededContextWindowSize {
    // Handle context overflow
    session = condensedSession(from: session)
} catch LanguageModelSession.GenerationError.guardrailViolation {
    // Handle content policy
    showMessage("Cannot generate that content")
} catch LanguageModelSession.GenerationError.unsupportedLanguageOrLocale {
    // Handle language issue
    showMessage("Language not supported")
} catch {
    // Catch-all for unexpected errors
    print("Unexpected error: \(error)")
    showMessage("Something went wrong. Please try again.")
}

耗时:10-15 分钟


模式 3a:输出幻觉(用例不当)

症状:

  • 模型给出的答案在事实上不正确
  • 捏造信息

诊断: 将模型用于世界知识(用例不当)

修复:

// ❌ BAD - Wrong use case
let prompt = "Who is the president of France?"
let response = try await session.respond(to: prompt)
// Will hallucinate or give outdated info

// ✅ GOOD - Use server LLM for world knowledge
// Foundation Models is for:
// - Summarization
// - Extraction
// - Classification
// - Content generation

// OR: Use Tool calling with external data source
struct GetFactTool: Tool {
    let name = "getFact"
    let description = "Fetch factual information from verified source"

    @Generable
    struct Arguments {
        let query: String
    }

    func call(arguments: Arguments) async throws -> ToolOutput {
        // Fetch from Wikipedia API, news API, etc.
        let fact = await fetchFactFromAPI(arguments.query)
        return ToolOutput(fact)
    }
}

耗时:实现工具需要 20-30 分钟,或切换到合适的 AI


模式 3b:结构错误(未使用 @Generable)

症状:

  • 解析错误
  • JSON 无效
  • 键错误

诊断: 手动解析 JSON,而非使用 @Generable

修复:

// ❌ BAD - Manual parsing
let prompt = "Generate person as JSON"
let response = try await session.respond(to: prompt)
let data = response.content.data(using: .utf8)!
let person = try JSONDecoder().decode(Person.self, from: data) // CRASHES

// ✅ GOOD - @Generable
@Generable
struct Person {
    let name: String
    let age: Int
}

let response = try await session.respond(
    to: "Generate a person",
    generating: Person.self
)
// response.content is type-safe Person, guaranteed structure

耗时:转换为 @Generable 需要 10 分钟


模式 3c:数据缺失(需要工具)

症状:

  • 模型没有所需信息
  • 输出模糊或泛泛而谈

诊断: 需要外部数据(天气、地点、联系人)

修复:

// ❌ BAD - No external data
let response = try await session.respond(
    to: "What's the weather in Tokyo?"
)
// Will make up weather data

// ✅ GOOD - Tool calling
import WeatherKit

struct GetWeatherTool: Tool {
    let name = "getWeather"
    let description = "Get current weather for a city"

    @Generable
    struct Arguments {
        let city: String
    }

    func call(arguments: Arguments) async throws -> ToolOutput {
        // Fetch real weather
        let weather = await WeatherService.shared.weather(for: arguments.city)
        return ToolOutput("Temperature: \(weather.temperature)°F")
    }
}

let session = LanguageModelSession(tools: [GetWeatherTool()])
let response = try await session.respond(to: "What's the weather in Tokyo?")
// Uses real weather data

耗时:实现工具需要 20-30 分钟


模式 3d:输出不一致(采样)

症状:

  • 同一个提示词每次生成的输出都不同
  • 测试需要一致的结果

诊断: 随机采样(默认行为)

修复:

// Default: Random sampling
let response1 = try await session.respond(to: "Write a haiku")
let response2 = try await session.respond(to: "Write a haiku")
// Different every time

// ✅ For deterministic output (testing/demos)
let response = try await session.respond(
    to: "Write a haiku",
    options: GenerationOptions(sampling: .greedy)
)
// Same output for same prompt (given same model version)

// ✅ For low variance
let response = try await session.respond(
    to: "Classify this article",
    options: GenerationOptions(temperature: 0.5)
)
// Slightly varied but focused

// ✅ For high creativity
let response = try await session.respond(
    to: "Write a creative story",
    options: GenerationOptions(temperature: 2.0)
)
// Very diverse output

耗时:2-5 分钟


模式 4a:初始延迟(预热)

症状:

  • 第一次生成需要 1-2 秒才开始
  • 后续请求更快

诊断: 模型加载时间

修复:

// ❌ BAD - Load on user interaction
Button("Generate") {
    Task {
        let session = LanguageModelSession() // 1-2s delay here
        let response = try await session.respond(to: prompt)
    }
}

// ✅ GOOD - Prewarm on init
class ViewModel: ObservableObject {
    private var session: LanguageModelSession?

    init() {
        // Prewarm before user interaction
        Task {
            self.session = LanguageModelSession(instructions: "...")
        }
    }

    func generate(prompt: String) async throws -> String {
        guard let session = session else {
            // Fallback if not ready
            self.session = LanguageModelSession()
            return try await self.session!.respond(to: prompt).content
        }
        return try await session.respond(to: prompt).content
    }
}

耗时:10 分钟 节省的延迟:首次请求缩短 1-2 秒


模式 4b:生成时间长(流式传输)

症状:

  • 用户等待 3-5 秒,却看不到任何内容
  • 随后整个结果一次性出现

诊断: 长内容生成未采用流式传输

修复:

// ❌ BAD - No streaming
let response = try await session.respond(
    to: "Generate 5-day itinerary",
    generating: Itinerary.self
)
// User waits 4 seconds seeing nothing

// ✅ GOOD - Streaming
@Generable
struct Itinerary {
    var destination: String
    var days: [DayPlan]
}

let stream = session.streamResponse(
    to: "Generate 5-day itinerary to Tokyo",
    generating: Itinerary.self
)

for try await partial in stream {
    // Update UI incrementally
    self.itinerary = partial
}
// User sees destination in 0.5s, then days progressively

耗时:15-20 分钟 感知延迟:0.5 秒,而非 4 秒


模式 4c:大型架构开销

症状:

  • 使用相同的 @Generable 类型发起后续请求时速度变慢

诊断: 每次都会将架构重新插入提示词

修复:

// First request - schema inserted automatically
let first = try await session.respond(
    to: "Generate first person",
    generating: Person.self
)

// ✅ Subsequent requests - skip schema insertion
let second = try await session.respond(
    to: "Generate another person",
    generating: Person.self,
    options: GenerationOptions(includeSchemaInPrompt: false)
)

耗时:2 分钟 节省的延迟:每次请求缩短 10-20%


模式 4d:复杂提示词(拆分处理)

症状:

  • 生成耗时 >5 秒
  • 结果质量较差

诊断: 提示词对于单次生成来说过于复杂

修复:

// ❌ BAD - One massive prompt
let prompt = """
    Generate complete 7-day itinerary with hotels, restaurants,
    activities, transportation, budget, tips, and local customs
    """
// 5-8 seconds, poor quality

// ✅ GOOD - Break into steps
let overview = try await session.respond(
    to: "Generate high-level 7-day plan for Tokyo"
)

var dayDetails: [DayPlan] = []
for day in 1...7 {
    let detail = try await session.respond(
        to: "Detail activities and restaurants for day \(day) in Tokyo",
        generating: DayPlan.self
    )
    dayDetails.append(detail.content)
}
// Total time similar, but better quality and progressive results

耗时:20-30 分钟 质量提升:显著改善


模式 5a:UI 卡顿(主线程阻塞)

症状:

  • 生成期间应用无响应
  • UI 卡顿数秒

诊断: 在主线程上同步调用 respond()

修复:

// ❌ BAD - Blocking main thread
Button("Generate") {
    let response = try await session.respond(to: prompt)
    // UI frozen for 2-5 seconds!
}

// ✅ GOOD - Async task
Button("Generate") {
    Task {
        do {
            let response = try await session.respond(to: prompt)
            // Update UI on main thread
            await MainActor.run {
                self.result = response.content
            }
        } catch {
            print("Error: \(error)")
        }
    }
}

耗时:5 分钟 UX 改进:大幅改善(UI 不再卡顿)


生产环境危机场景

背景

情况:你刚刚使用 Foundation Models 发布了一项 AI 驱动的功能。发布后 2 小时内:

  • 20% 的用户反馈“AI 功能无法使用”
  • App Store 评价下滑:“新的 AI 坏了”
  • 产品副总裁发邮件询问:“修复预计何时完成?”
  • 工程经理:“我们应该回滚吗?”

压力信号:

  • 🚨 收入影响:该功能是新版本应用的关键卖点
  • ⏰ 时间压力:“现在就修好”
  • 👔 高管关注:副总裁正在关注
  • 📉 公众声誉:所有人都能看到 App Store 评价
合理化陷阱

切勿落入以下陷阱:

  1. “禁用该功能”

    • 失去产品差异化
    • 等于承认失败
    • 无法了解问题出在哪里
  2. “回退到上一版本”

    • 浪费数周的工作
    • 无法修复根本原因
    • 用户依然不满
  3. “在我这里能用”

    • 模拟器 ≠ 真实设备
    • 你的设备 ≠ 所有设备
    • 忽视实际问题
  4. “切换到 ChatGPT API”

    • 侵犯隐私
    • 大规模使用时成本高昂
    • 无法解决可用性问题
强制执行流程
阶段 1:识别(5 分钟)
// Check error distribution
// What percentage seeing what error?

// Run this on test devices:
let availability = SystemLanguageModel.default.availability

switch availability {
case .available:
    print("✅ Available")
case .unavailable(let reason):
    print("❌ Unavailable: \(reason)")
}

// Hypothesis:
// - If 20% unavailable → Availability issue (device/region/opt-in)
// - If 20% getting errors → Code bug
// - If 20% seeing wrong results → Use case mismatch

结果:发现 20% 的用户使用的设备不支持 Apple Intelligence。


阶段 2:确认(5 分钟)
// Check which devices affected
// iPhone 15 Pro+ = ✅ Available
// iPhone 15 = ❌ Unavailable
// iPhone 14 = ❌ Unavailable

// Conclusion: Availability issue, not code bug

根本原因:该功能假设所有用户都拥有 Apple Intelligence。实际上有 20% 的用户没有。


阶段 3:设备要求(5 分钟)

确认:

  • Apple Intelligence 要求使用 iPhone 15 Pro 或更新机型
  • 或配备 M1 或更新芯片的 iPad
  • 或搭载 Apple 芯片的 Mac
20% 的用户群体使用较旧设备

阶段 4:实施修复(15 分钟)
// ✅ Add availability check + graceful UI
struct AIFeatureView: View {
    @State private var availability = SystemLanguageModel.default.availability

    var body: some View {
        switch availability {
        case .available:
            // Show AI feature
            AIContentView()

        case .unavailable:
            // Graceful fallback
            VStack {
                Image(systemName: "sparkles")
                    .font(.largeTitle)
                    .foregroundColor(.secondary)

                Text("AI-Powered Features")
                    .font(.headline)

                Text("Available on iPhone 15 Pro and later")
                    .font(.subheadline)
                    .foregroundColor(.secondary)
                    .multilineTextAlignment(.center)

                // Offer alternative
                Button("Use Standard Mode") {
                    // Show non-AI fallback
                }
            }
        }
    }
}

阶段 5:部署(20 分钟)
  1. 在多台设备上测试(15 分钟)

    • iPhone 15 Pro:✅ 显示 AI 功能
    • iPhone 14:✅ 显示友好提示
    • iPad Pro M1:✅ 显示 AI 功能
  2. 提交热修复版本(5 分钟)


沟通模板

发给产品副总裁(立即):

Root cause identified:

The AI feature requires Apple Intelligence (iPhone 15 Pro+).
20% of our users have older devices. We didn't check availability.

Fix: Added availability check with graceful fallback UI.

Timeline:
- Hotfix ready: Now
- TestFlight: 10 minutes
- App Store submission: 30 minutes
- Review: 24-48 hours (requesting expedited)

Impact mitigation:
- 80% of users see working AI feature
- 20% see clear message + standard mode fallback
- No functionality lost, just graceful degradation

发给工程团队:

Post-mortem items:
1. Add availability check to launch checklist
2. Test on non-Apple-Intelligence devices
3. Document device requirements clearly
4. Add analytics for availability status
节省的时间
  • 慌乱应对(禁用/回退):2 小时的会议时间 + 工作成果损失
  • 正确诊断:45 分钟找出根本原因 → 修复 → 部署
我们学到的经验
  1. 创建会话前务必检查可用性
  2. 在不同代际的真实设备上测试
  3. 优雅降级优于移除功能
  4. 向用户清楚说明设备要求

快速参考表

症状原因检查项模式时间
无法启动.unavailableSystemLanguageModel.default.availability1a5 分钟
区域问题所在区域不受支持检查支持的区域1b5 分钟
未选择加入Apple Intelligence 已停用检查设置1c10 分钟
超出上下文限制>4096 tokens对话记录长度2a15 分钟
护栏错误内容政策用户输入类型2b10 分钟
语言错误不支持的语言supportedLanguages2c10 分钟
输出出现幻觉用例不匹配检查任务类型3a20 分钟
结构错误缺少 @Generable是否需要手动解析?3b10 分钟
缺少数据没有工具是否需要外部数据?3c30 分钟
结果不一致随机采样是否需要确定性?3d5 分钟
初始延迟模型加载首次请求是否缓慢?4a10 分钟
等待时间过长没有流式处理生成时间是否 >1 秒?4b20 分钟
Schema 开销重复插入 Schema后续请求是否如此?4c2 分钟
提示词复杂一次处理过多内容生成时间是否 >5 秒?4d30 分钟
UI 冻结主线程检查线程5a5 分钟

交叉引用

相关 Axiom 技能:

  • axiom-foundation-models — 讲解反模式、正确使用模式和压力场景的规范技能
  • axiom-foundation-models-ref — 完整的 API 参考,包含所有 WWDC 2025 代码示例

Apple 资源:

  • Foundation Models 框架文档
  • WWDC 2025-286:认识 Foundation Models 框架
  • WWDC 2025-301:深入探索 Foundation Models 框架
  • Instruments Foundation Models 模板

最后更新:2025-12-03 版本:1.0.0 技能类型:诊断

评论

支持 Markdown