Tüm Yazılar
KategoriAI
Okuma Süresi
16 dk
Yayın Tarihi
...
Kelime Sayısı
1.691kelime

Kahveni hazırla - bu içerikli bir makale!

WWDC25'te tanıtılan Apple Intelligence ile Core ML arasındaki kararı, Foundation Models entegrasyonu, privacy-first tasarım, battery consumption profiling ve production deployment için kapsamlı 2026 rehberi.

Apple Intelligence + Core ML: On-Device AI Pipeline 2026 Production Rehberi

# Apple Intelligence + Core ML: On-Device AI Pipeline 2026 Production Rehberi

WWDC25'te Apple, mobil AI manzarasını değiştiren bir hamleyle Apple Intelligence'i tanıttı: On-device LLM (Apple Foundation Models), Private Cloud Compute ve sistem seviyesinde AI entegrasyon. Ancak bu duyuru, geliştiriciler için tek başına yeterli değil — Core ML ile arasındaki kararı doğru vermek, üretim ekibi için ilk büyük teknik soru oldu.

Bu rehberde **Apple Intelligence vs Core ML** karar matrisi, Foundation Models entegrasyonu, on-device performance gerçekleri ve production deployment için 2026 best-practice'ler ele alınacak.

Pro Tip: Apple Foundation Models (genel adıyla AFM) henüz tüm iOS 18+ cihazlarda mevcut değil. A17 Pro / M-series ve sonrası gerekli. Daha eski cihazlar Core ML fallback bekliyor — bunu mimarine baştan yedir.

İçindekiler

  1. Apple Intelligence: Ne Var, Ne Yok
  2. Core ML vs Apple Intelligence — Karar Matrisi
  3. Foundation Models API Entegrasyonu
  4. Private Cloud Compute Architecture
  5. On-Device LLM Performance Profiling
  6. Privacy-First Design Patterns
  7. Battery Consumption: Gerçek Sayılar
  8. Fallback Strategy: Eski Cihazlar
  9. Production Deployment Checklist
  10. Apple Intelligence Roadmap 2026-2027

1. Apple Intelligence: Ne Var, Ne Yok

Apple Intelligence 4 temel katmandan oluşuyor:

  • System AI Features: Writing Tools, Image Playground, Genmoji — kullanıcıya direkt sunulan
  • App Intents Integration: Siri 2.0 + uygulama içi action'lar
  • Foundation Models: Geliştiriciye açılan on-device LLM (3B parametre)
  • Private Cloud Compute: Apple Silicon datacenter, gizlilik-korumalı server-side AI

Ne yapamaz:

  • 3B parametre on-device model — multi-hop reasoning sınırlı
  • Real-time streaming (server roundtrip yok, batch output)
  • Specialized domain (medical, legal) — base model, fine-tuning gerekir
  • Türkçe dahil non-English: WWDC25'te 7 dil, Türkçe Q4 2026 lokalize

Ne yapar:

  • Text summarization, rewriting, classification
  • Function calling (App Intents)
  • Multimodal: image + text understanding
  • Sentiment analysis, intent recognition
  • Code completion (basic, dev tools için)

2. Core ML vs Apple Intelligence — Karar Matrisi

Karar üç ekseni dikkate alıyor: task type, device support, customization needs.

Senaryo
Tercih
Neden
LLM-grade text generation
Apple Intelligence
3B param, optimize Apple Neural Engine
Image classification (custom)
Core ML
Specialized custom model, AI'dan daha hızlı
Object detection (custom dataset)
Core ML
YOLO/Detectron fine-tune + .mlmodel
Function calling / intent
Apple Intelligence
App Intents native entegrasyon
Tabular data prediction
Core ML
Tree-based model, AI overkill
Voice transcription
Speech.framework (Core ML alt)
Built-in, on-device, accurate
Image generation
Apple Intelligence + Image Playground
Sistem seviyesi, custom yapmaya gerek yok
Sentiment + entity extraction
NaturalLanguage + Core ML
Hafif, hızlı, custom domain için
Multi-turn conversation
Apple Intelligence
Foundation Models'in tasarım hedefi
Edge-device-only (A14 öncesi)
Core ML
AI desteklemez, fallback şart

Pratik karar yöntemi: "Bu task generic LLM kapasitesi mi, yoksa custom domain mi?" Eğer generic → Apple Intelligence; custom → Core ML.

Pro Tip: Apple Intelligence SystemLanguageModel ve LanguageModelSession API'ları üzerinden expose ediliyor. Core ML MLModel ve modern MLComputeUnits.all ile. İkisi aynı app'te birlikte yaşıyor — async let ile parallel inference yapabilirsin.

3. Foundation Models API Entegrasyonu

Apple Intelligence'ı use etmenin kanonik yolu FoundationModels framework (iOS 18.0+):

swift
1import FoundationModels
2 
3// Modeli al
4let model = SystemLanguageModel.default
5 
6// Session oluştur — multi-turn için stateful
7let session = LanguageModelSession()
8 
9// Basit prompt
10let response = try await session.respond(to: "Bu cümleyi özetle: \(longText)")
11print(response.content)

Streaming yanıt:

swift
1let stream = session.streamResponse(to: prompt)
2for try await token in stream {
3 appendToUI(token)
4}

Tool use (function calling):

swift
1struct WeatherQuery: Tool {
2 let name = "getWeather"
3 let description = "Get current weather for a city"
4 
5 @Generable
6 struct Arguments {
7 @Guide(description: "City name")
8 let city: String
9 }
10 
11 func call(arguments: Arguments) async throws -> String {
12 let weather = try await WeatherService.fetch(city: arguments.city)
13 return "\(weather.temp)°C, \(weather.condition)"
14 }
15}
16 
17let session = LanguageModelSession(tools: [WeatherQuery()])
18let response = try await session.respond(to: "İstanbul'da hava nasıl?")

Model otomatik olarak tool'u çağırır, sonucu yorumlar ve doğal dilde yanıt verir.


4. Private Cloud Compute Architecture

PCC, on-device kapasitesinin yetmediği taleplerde Apple datacenter'ında çalışan büyük modellere yönlendirme yapan privacy-first sistem.

Mimari özellikler:

  • Request'ler end-to-end encrypted
  • Datacenter Apple Silicon, telemetri sıfır
  • Sadece request body görülür, kullanıcı kimliği görünmez
  • Image build hash verifiable on Transparency Log
  • Apple security researcher'lar binary inspect edebiliyor

Code-level davranış: Geliştirici PCC vs on-device farkını bilmez. SystemLanguageModel otomatik olarak doğru execution path'i seçer. Sadece UseCase enum'u ile hint verebilirsin:

swift
1let model = SystemLanguageModel(useCase: .general) // varsayılan
2// veya
3let model = SystemLanguageModel(useCase: .contentTagging) // küçük, on-device

.general PCC routing yapabilir; .contentTagging zorla on-device.


5. On-Device LLM Performance Profiling

3B parametre model A17 Pro üzerinde:

Operation
Latency
Memory peak
50-token completion
280-340ms
+180MB
500-token completion
1.6-2.1s
+220MB
Function call decision
120-150ms
+90MB
Multimodal (image + text)
400-520ms
+260MB

A18 Pro üzerinde aynı operasyonlar %35-40 daha hızlı. M3/M4 iPad/Mac üzerinde %60-70.

Profiling pratikleri:

swift
1import os.signpost
2 
3let signposter = OSSignposter(subsystem: "AI", category: "Inference")
4let state = signposter.beginInterval("Foundation Model Inference")
5 
6let response = try await session.respond(to: prompt)
7 
8signposter.endInterval("Foundation Model Inference", state)

Xcode 16 Instruments → AI Inference template ile Foundation Models'in execution path'i, NE/CPU/GPU yük dağılımı, memory footprint görselleştirilebilir.

Critical bulgu: first inference her zaman ~800ms slower (model warm-up). Production'da:

swift
1// App launch'ta warm-up
2Task.detached(priority: .background) {
3 _ = try? await SystemLanguageModel.default.respond(to: "test")
4}

İlk gerçek user prompt 280ms cevap verir; warm-up olmadan 1.2s.


6. Privacy-First Design Patterns

Apple Intelligence'in DNA'sı gizlilik. Geliştirici olarak privacy postürünü güçlendirmek için:

1. Veri minimization:

swift
1// ❌ Yanlış: kullanıcı verisini full context'te gönder
2let response = try await session.respond(
3 to: "User: \(userProfile.fullData). Question: \(question)"
4)
5 
6// ✅ Doğru: sadece gerekli bilgi
7let response = try await session.respond(
8 to: "User language: \(userProfile.language). Question: \(question)"
9)

2. Conversation history scope:

Session-based default, ama kullanıcı session-out olunca history wipe et:

swift
1@MainActor
2final class ChatViewModel: ObservableObject {
3 private var session: LanguageModelSession?
4 
5 func startSession() {
6 session = LanguageModelSession()
7 }
8 
9 func endSession() {
10 session = nil // memory + history release
11 }
12}

3. Output sanitization:

Model output'unu UI'a göstermeden önce PII check yap (kişi isim, telefon, vb.):

swift
1import NaturalLanguage
2 
3func sanitize(_ text: String) -> String {
4 let tagger = NLTagger(tagSchemes: [.nameType])
5 tagger.string = text
6 var output = text
7 tagger.enumerateTags(...) { tag, range in
8 if tag == .personalName {
9 output.replaceSubrange(range, with: "[redacted]")
10 }
11 return true
12 }
13 return output
14}

4. App Privacy Manifest:

Yeni PrivacyInfo.xcprivacy dosyasına on-device-AI usage disclosure eklemek iOS 18+ App Store zorunluluğu:

xml
1<key>NSPrivacyAccessedAPITypes</key>
2<array>
3 <dict>
4 <key>NSPrivacyAccessedAPIType</key>
5 <string>NSPrivacyAccessedAPICategoryFoundationModels</string>
6 <key>NSPrivacyAccessedAPITypeReasons</key>
7 <array><string>1A2B.C0D9</string></array>
8 </dict>
9</array>

7. Battery Consumption: Gerçek Sayılar

On-device LLM Apple Neural Engine'in yoğun kullanıcısı. Battery profiling:

Workload
Battery per 1000 inference
50-token tek completion
%0.6-0.8
500-token completion
%2.1-2.6
Continuous streaming chat (5dk)
%3.2
Image + text multimodal
%1.4 / call

Pattern: ANE Apple'ın en enerji-verimli compute unit'i (CPU'dan 6x verimli). Yine de yoğun usage'da etkisi var.

Best practices:

  • 100+ inference back-to-back yapmıyorsan batching yerine adaptive throttle
  • Background UIBackgroundFetch içinde AI çalıştırma — iOS otomatik throttle eder
  • Low-power-mode ProcessInfo.processInfo.isLowPowerModeEnabled check ve AI feature'ı disable et
swift
1guard !ProcessInfo.processInfo.isLowPowerModeEnabled else {
2 return useSimpleHeuristic() // AI bypass
3}
4let response = try await session.respond(to: prompt)

8. Fallback Strategy: Eski Cihazlar

Apple Intelligence A17 Pro öncesi cihazlarda mevcut değil. Bu A14 → A16 arasında 3 jenerasyon eski cihaz demek — global iPhone user base'in ~%65'i.

Fallback hierarchy:

swift
1import FoundationModels
2 
3final class AIService {
4 func generateSummary(of text: String) async throws -> String {
5 // 1. Try Apple Intelligence
6 if SystemLanguageModel.isAvailable {
7 return try await foundationModelSummary(text)
8 }
9 
10 // 2. Fallback: Core ML compact model
11 if let coreMLModel = try? CompactSummarizer() {
12 return try coreMLModel.summarize(text)
13 }
14 
15 // 3. Fallback: NaturalLanguage built-in
16 return naturalLanguageSummary(text)
17 
18 // 4. Last resort: server-side API
19 // return try await ServerAPI.summarize(text)
20 }
21}

Core ML compact model** trade-off: Phi-3 mini (3.8B params, INT4) veya Gemma 2B convert via coremltools. Disk: ~500MB-1.2GB. Inference: 2-4x slower than Foundation Models.


9. Production Deployment Checklist

  • **PrivacyInfo.xcprivacy** Foundation Models disclosure ekli
  • **App launch warm-up** async detached task
  • **`SystemLanguageModel.isAvailable`** check before usage
  • **Low-power-mode** AI feature disable
  • **PII sanitization** layer output'tan önce
  • **Crash handling** model yükleme fail'larında graceful fallback
  • **Telemetry** opt-in (signpost + analytics)
  • **Fallback Core ML model** A14-A16 cihazlar için bundled
  • **App Store metadata** AI features açıklama
  • **Performance baseline** crash log + Instruments AI Inference data
  • **Localization**: Türkçe Q4 2026'ya kadar EN-only fallback
  • **Battery test**: 24 saat continuous use simülasyonu

10. Apple Intelligence Roadmap 2026-2027

WWDC25 announcement'larından çıkarımlar:

  • Q4 2026: Multimodal output (image generation directly in Foundation Models)
  • Q1 2027: Türkçe + 12 dil localization
  • Q2 2027: Custom model fine-tuning on-device (Core ML 9 ile)
  • Q3 2027: Federated learning support (cross-device privacy-preserving training)
  • Q4 2027: Function calling for shortcuts ve App Store apps (extended)

Geliştirici öncelikleri:

  1. Şimdi Apple Intelligence MVP entegrasyonu (Foundation Models basic)
  2. Q3 2026 PCC routing fine-tune
  3. Q4 2026 Multimodal output integrasyonu (Image Playground bundle)
  4. 2027 Custom fine-tuning'e geçiş

Sonuç

Apple Intelligence + Core ML birlikte yaşamaya yapılmış — biri "generic intelligence", öbürü "specialized prediction". Karar matrisi açık: LLM-grade text/multimodal → AI; custom domain prediction → Core ML.

Privacy-first DNA'sı Apple'ın rekabet üstünlüğü; geliştirici tarafında output sanitization + data minimization + session-out wipe disiplin gerekir.

Performance: A17 Pro+'ta 280ms first-token, %2-3 battery/1000 inference. Eski cihazlar için Core ML fallback şart, %65 user base.

Production-ready için 9 maddelik checklist ve 3-katmanlı fallback ile mimari kurulur. App Store reject riski kapatılır.

İlgili kaynaklar:

Etiketler

#Apple Intelligence#Core ML#On-Device AI#Foundation Models#Privacy#iOS#Performance
Muhittin Çamdalı

Muhittin Çamdalı

Senior iOS Developer

12+ yıllık deneyime sahip iOS Developer. Swift, SwiftUI ve modern iOS mimarileri konusunda uzman. Apple platformlarında performanslı ve kullanıcı dostu uygulamalar geliştiriyorum.

iOS Geliştirme Haberleri

Haftalık Swift tips, SwiftUI tricks ve iOS best practices. Spam yok, sadece değerli içerik.

Gizliliğinize saygı duyuyoruz. İstediğiniz zaman abonelikten çıkabilirsiniz.

Paylaş

İlgili İçerik