Continuous Agent learning on the device
The previous tutorial proved the learning mechanism in a Mac terminal. This one lets you experience it firsthand on an iPhone: the model loads, learns, and restores on the device — fully offline, with data never leaving the device.
Complete the CLI learning demo in Build your first device Agent. You need Edge Studio installed and a local model.
This walkthrough is in Preview Labs: several screenshots are still placeholders, and the full flow has not yet been re-validated end to end against the current exported scaffold. The CLI quickstart remains the deterministic, copy-paste proof; treat this page as a preview until the device evidence lands.
Why this step matters
The CLI demo proves the mechanism — RPP self-learning can generate a Neural Imprint artifact, and behavior changes after restore. But that ran on a Mac.
The real value of Edge is this: the same learning loop runs on the user's phone. No Mac, no cloud, no re-export. The device itself is the Agent.
In this step you verify firsthand:
| What you verify | What you'll see |
|---|---|
| The model loads on iPhone | Local inference, no network needed |
| Pick a life-scenario domain | 8 built-in domains to choose from |
| Trigger learning with synthetic data | On-device Edge Halo profile job |
| NI artifact generated and restored | Behavior changes, same as the CLI |
| Airplane-mode verification | Turn off the network — everything still works |
| Removable | Delete the NI and the model returns to stock |
1. Export from Edge Studio
Open Edge Studio:
edge studio
In the Web UI (http://127.0.0.1:18842):
- Load the same model you used in the CLI demo (
qwen3.5-9b-4bit) - Click Export → Edge Scaffold
- Enter an app name, e.g.
FinanceAgent - Download the ZIP
Edge Studio Web UI export screen
2. Open in Xcode and deploy to a real device
Unzip the archive and open the generated project:
unzip FinanceAgent.zip
cd FinanceAgent # project root — holds project.yml + FinanceAgent.xcodeproj
open FinanceAgent.xcodeproj
The .xcodeproj is already generated by the export; the app source lives in the nested FinanceAgent/ subfolder. (You normally don't need to run xcodegen generate; on current preview releases it is safe to — the model's on-demand-resource (ODR) wiring is in project.yml and survives regeneration.) In Xcode:
- Select your Development Team under Signing & Capabilities
- Select a real iPhone/iPad — not the Simulator
- Build & Run — use the Release configuration (Debug runs on-device inference 2–10× slower; switch via Product → Scheme → Edit Scheme → Run → Build Configuration → Release)
The Simulator cannot validate Metal inference, memory behavior, or NI restore. Edge's on-device experience is only real on real hardware.
Selecting a real device in Xcode
3. First launch: Onboarding
On first launch the app runs an onboarding flow:
- Device assessment — the app detects your hardware (chip, memory, storage) and computes an AI IQ score
- Model selection — recommends a model tier based on device capability
- Model download — downloads the model locally (network needed the first time, not afterward)
Onboarding device assessment — AI IQ score
Model download progress
4. Verify basic chat
Once the model finishes loading, go to the Chat page. Ask an ordinary question first to confirm inference works:
I have $800 left after bills this month. What should I do with it?
You should see a generic answer — savings, investing, paying down debt — with no awareness of your preferences.
This is the base-model state: the model can chat, but it doesn't know you.
Base-model generic answer
5. Pick a domain and load synthetic data
Go to Settings → Personalization.
You'll see a domain picker with 8 built-in life scenarios:
| Domain | Scenario | Synthetic data |
|---|---|---|
| finance | Personal finance | Spending records, subscriptions, cash flow |
| health | Fitness & health | Workouts, diet, sleep |
| cooking | Kitchen & cooking | Ingredients, taste, allergies |
| reading | Reading & learning | Book list, notes, progress |
| journal | Journal & reflection | Daily entries, mood, reflection |
| travel | Travel & exploration | Itinerary, preferences, budget |
| music | Music & entertainment | Play history, taste, context |
| work | Work & productivity | Tasks, schedule, work habits |
Pick finance (the same scenario as the CLI demo).
Domain picker with finance selected
Go to the Sample Data page and load the synthetic data. These are pre-built synthetic spending records — a Spotify subscription, 7-Eleven purchases, food-delivery orders, and so on — all marked synthetic: true.
Loaded synthetic spending records
6. Check the data pipeline status
On the Personalization page you can see the full data pipeline:
| Metric | Meaning |
|---|---|
| Classified Facts | Structured facts processed by the classification engine |
| Raw Unclassified | Raw records waiting to be classified |
| Chat Feedback | 👍 👎 feedback the user has given |
| Chat Corrections | Corrections the user has made |
| Training Events | Learning events produced so far |
Data Pipeline status panel
7. Trigger on-device learning
Once enough local signals (facts + corrections) accumulate, the app can trigger an Edge Halo profile job.
Learning runs locally on the device:
- Edge Halo reads app-approved local signals (classified facts, corrections, tool schema)
- Runs RPP profile analysis using the A-library basis in
Resources/RPP/ - Generates a Neural Imprint capsule on the device
- Compatibility check (model / tokenizer / runtime / tool schema / cache backend)
- Pass → restore; fail → fail closed, keep the base model
Neural Imprint status becomes Active
In the Persona Runtime area at the top of the Personalization page, you should see:
- Neural Imprint: Active ✅
- Artifact SHA256 (first 12 hash characters)
- Cache Backend
This is the proof of on-device learning: the NI artifact was generated and restored locally on the iPhone.
8. Chat again: see the difference
Go back to the Chat page and ask the same question:
I have $800 left after bills this month. What should I do with it?
The answer should now be more conservative and cash-flow focused — the same behavior change you saw in the CLI demo.
| Moment | Answer style |
|---|---|
| Step 4 (before learning) | Generic: savings, investing, paying down debt… |
| Step 8 (after learning) | Conservative: preserve liquidity first, top up the emergency fund, avoid high risk |
This is the on-device learning aha moment. Same model, same question, answer changed after local learning. Not prompt stuffing — no preference was injected into the prompt. Not LoRA — the model was not retrained. The NI artifact was generated and restored locally on the device.
Post-learning answer (conservative, cash-flow oriented)
9. Airplane-mode verification
Turn on Airplane Mode and ask again:
I'm thinking about buying a fund. Any suggestions?
The answer should still be normal — conservative style, cash-flow aware, no invented return numbers.
This proves: model inference plus learning-state restore need no network at all. All compute happens locally on the device.
Normal conversation in Airplane Mode
10. Removability verification
Go to Settings → Personalization → Data Management:
- Tap Clear Feedback and Corrections
- Watch the Neural Imprint status change from "Active" back to "Not active"
Go back to Chat and ask the same question again. The answer should return to the generic style.
Learning state is removable. The user can clear it at any time, and the model returns to its factory state. This is Edge's promise: restorable, removable, user-controlled.
NI status returns to Not active after clearing
11. Try other domains
You just experienced the full on-device learning loop with the finance domain. Now go back to Settings → Personalization and switch to another domain:
- health — load workout records and see whether the assistant learns your exercise preferences
- cooking — load taste data and see whether its recipe suggestions change
- journal — load journal data and see whether its writing-suggestion style changes
Each domain has its own synthetic dataset, with the same learning loop: load data → trigger learning → NI generated → restore → behavior change.
Custom domains and A-library coverage
On-device RPP profile analysis needs a model-matched A-library basis from
Resources/RPP/. This is separate from the Mac CLI --sample-file demo: the
CLI learning path can run any local sample file without an A-library, while the
device path uses A-library assets when Edge Halo analyzes local profile signals.
The scaffold bundles 18 A-library artifacts: 9 direction sets for two Qwen3.5
model families. The generic directions_a set has 50 directions per model
family; each bundled domain-specific set currently has 10 directions per model
family.
Bundled direction sets:
| Direction set | Role |
|---|---|
directions_a | Generic fallback basis |
finance_consumer | Personal finance |
cooking_kitchen | Kitchen and cooking |
music_media | Music and media |
health_fitness | Health and fitness |
reading_learning | Reading and learning |
journal_reflection | Journal and reflection |
travel_explorer | Travel and exploration |
work_productivity | Work and productivity |
For the bundled scaffold domains, the app maps each domain to its matching
direction set. If a domain-specific A-library is missing but the same model
family has directions_a, the app falls back to the generic basis and labels
the run as using a fallback A-library. That means the run uses a generic basis
rather than a domain-specific one; this page makes no quality claim about that
fallback. If the model family has no matching A-library at all, Edge Halo fails
closed with aLibraryUnavailable.
For a custom domain, create a custom direction set in Edge Studio:
- Open Training → A-library generation.
- Use
refine_domain_descriptionto turn a rough domain idea into a clearer description. - Use
suggest_directionsto draft editable direction candidates with the loaded host model. - Run
validate_yaml. The validator requires at least 10 directions, at least 5 positive and 5 negative examples per direction, and pair length balance greater than 0.7. - Generate the A-library. Edge Studio sweeps target layers, writes
.safetensorsartifacts, and stores a health report. - Bind the export to that direction set:
edge export scaffold \
--model qwen3.5-9b-4bit \
--app-name MyCustomAgent \
--direction-set-id my_custom_domain \
--output MyCustomAgent.zip
The complete Edge story
You've now walked both paths:
| Path | What you proved |
|---|---|
| CLI demo | The learning mechanism works: inspect → before → learn → after |
| This page | The device experience is real: load, learn, restore, offline, removable on iPhone |
This is the complete Edge story:
The device is the Agent, the app is the carrier. The model learns the user's preferences and learns to use local tools, on the device. Learning state is generated locally, restored locally, transferable across devices, and removable anytime. Data never leaves the device. The base model package is never replaced.
Next steps
| Goal | Where to go |
|---|---|
| Understand Neural Imprint vs LoRA/SFT | Neural Imprint vs LoRA |
| Understand the product architecture | Architecture |
| Customize your Agent carrier | Edge Scaffold |
| API reference | Edge Inference API |