On-device inference
The student runs inside the app on an iPhone Air (A19 Pro, 12 GB) via MLX Swift, and keeps working in airplane mode.
The hybrid inference and continuous learning platform for on-device AI agents
Wrap your app's agent in one line. The phone answers first, private by default. A frontier model in the cloud handles what the phone can't, and every escalation trains the next on-device model.
Over time the phone handles most requests: fast, offline, private. Whatever still leaves the device is redacted and logged.
reschedule_appointment(day: "Fri")Illustration. Real screenshots from the demo app are below.
Today, an app's support agent sends every message to a frontier model.
How it works
Every request hits the router first. Confident ones stay on the device; the rest go to the teacher, whose answer goes back to the app and also becomes a training label. Each round, a new adapter ships to the phone, so fewer requests need the cloud.
Student confidence (token logprobs) and output validators gate each request live on the phone. Out-of-distribution checks run asynchronously in the cloud.
Hard requests go to the teacher right away, with names, IDs and amounts swapped for placeholders first.
Teacher answers and a 1% shadow sample become training data. Labeling and retraining never slow a reply.
Each round, a LoRA-tuned student lands on the phone and the share of escalated requests falls.
One line
GradientHarbor sits around an OpenAI-compatible client in Python, or HarborKit in Swift on iOS. It captures messages, tool calls and outcomes, and every response tells you which model answered and why.
let agent = Harbor.wrap(student: .local("lfm3-1.7b-insurance"),
teacher: .cloud(teacherURL), task: "member-support")
let reply = try await agent.respond(to: message, tools: tools)
reply.route // .student or .teacher, plus the gate that fired
from gradientharbor import wrap
client = wrap(OpenAI(), task="support-agent",
teacher="<frontier-model>", student="lfm2-1.2b-support")
resp = client.chat.completions.create(model="auto", messages=msgs, tools=tools)
resp.harbor.route # "student" | "teacher", plus the gate that fired
Focus
The student runs inside the app on an iPhone Air (A19 Pro, 12 GB) via MLX Swift, and keeps working in airplane mode.
Distill into the smallest model that holds accuracy, drop reasoning tokens, shorten tool prompts, quantize to 4-bit and cache the fixed prompt prefix.
Customer data stays on the device by default. What leaves is redacted first, limited to escalations and opt-in traces, and shown in a privacy ledger.
Data safety
Appeal the denial of claim [CLAIM_ID_1] for member [MEMBER_ID_1], amount [AMOUNT_1].Demo
A fictional insurer's iOS app with Policy, Claims, Appointments and a Support chat. The agent has eight mock tools over the member's local data. In the demo the app runs in the iPhone Simulator and the fine-tuned model runs on the laptop with MLX, the same weights the phone loads. When it books or moves an appointment, the Appointments screen updates. Insurance and health data are the strongest case for keeping work on the device.
get_policycheck_coverageget_claim_statusfile_claimfind_providerbook_appointmentreschedule_appointmentescalate_to_human[AMOUNT_1], not the real amount. 0 raw personal fields sent.Results
From the overnight run on November 8: the same 152 synthetic member requests for every setup, scored against ground truth. Our main student is Liquid AI's LFM3-1.7B (1.4 GB); Gemma 4 E4B (5.5 GB) is the larger option and the model behind the flywheel rounds. Phone latency and battery come from the app's eval mode next.
| Configuration | Task success | Held-out | Novel | Sent to cloud | p50 / step | Cloud cost |
|---|---|---|---|---|---|---|
| Sonnet 5.5 (cloud only) | 97.4% | 100% | 100% | 100% | 1.31 s | $1.91 |
| Liquid LFM3-1.7B, no fine-tuning | 37.5% | 50.0% | 24.1% | 0% | — | $0 |
| LFM3 fine-tuned (LoRA merged, 1.4 GB) | 86.8% | 98.0% | 58.6% | 0% | 1.18 s | $0 |
| LFM3 fine-tuned + router (main student) | 91.4% | 98.0% | 75.9% | 11.8% | 0.94 s | $0.21 |
| Gemma 4 E4B, no fine-tuning | 64.5% | 73.5% | 51.7% | 0% | 2.96 s | $0 |
| E4B fine-tuned, round 2 | 86.8% | 94.9% | 75.9% | 0% | 2.35 s | $0 |
| E4B fine-tuned + router, round 1 | 86.8% | 96.9% | 58.6% | 20.4% | 2.38 s | $0.73 |
| E4B fine-tuned + router, round 2 | 94.1% | 98.0% | 89.7% | 16.4% | 2.35 s | $0.71 |
On-device latency is measured on an M5 Mac with MLX, standing in for the phone. Every run sent 0 raw personal fields to the cloud.
Models
The student on the device is picked per app and platform; our main one is Liquid AI's LFM3-1.7B. In the cloud, one model teaches and another answers live, so each does the job it's best at.
Harbor.wrap(…)Opus labels training data from round 3. Rounds 0–2 were labelled by Sonnet 5.5, as in the results above. Dashed: not built yet.
Next
Train a small LoRA on the device from that user's own traces, so personal data never leaves at all.
Ship the student as LiteRT-LM for lower memory and multi-token prediction, and run the same file on Android. NPU export via LiteRT or ZETIC.
Distill whole multi-step agent runs, evaluated by replaying against mock tools.
Start student and teacher together on latency-critical paths, and move from SFT to RL once real reward signals exist.
As a company
The asset is the loop: redacted traces, evals and a router that knows when the student is wrong. Models become a compile target, and every build is checked by the same evals.
Core ML and the Apple Neural Engine, LiteRT on Android, and NPUs via LiteRT or ZETIC, from the same traces.
Apple stopped supporting custom Foundation Models adapters in OS 27, so for built-in models we compile the traces into prompts, tool definitions and output schemas, and train adapters wherever a platform allows them.
Pruning, vocabulary trimming and quantization-aware distillation, tuned for each app's download size and battery budget.
Search model shapes (depth, width, attention, vocabulary) per use case against the same evals. Research-heavy, and the furthest out.