Inspiration
More than half of ICU patients on a ventilator are awake, alert and responsive to speech at some point (53.9% of 2,671 patients in Happ et al., 2015). They understand what is said to them. They cannot speak, and many cannot write or point because their hands are weak, swollen or restrained. Another study found that patients on a ventilator experience "a moderate to extreme level of psychoemotional distress because they cannot speak and communicate their needs" (Khalaila et al., 2011). Many can still nod and shake their heads.
This is not only an ICU problem. People with ALS, like the fictional user in the demo, often lose their voice while their understanding stays intact.
With only a nod and a shake, every conversation becomes a game of twenty questions. The visitor has to guess the right yes-or-no question, and the patient can never start a sentence of their own. Speech-language pathologists have a technique for this, partner-assisted scanning: a helper offers choices one at a time and the patient signals "that one". It needs a trained helper who has the time.
I wanted the iPad to be that helper, for the patient who lost their voice this week and for the person who has lived without it for years. The name comes from "can't get a word in edgewise".
What it does
Edgewise lets a person who cannot speak answer aloud with a nod. When someone sits down next to the bed and talks, the iPad transcribes what they say and, from the first few words, starts drafting what the user might say back. The on-device model writes these drafts, and Gemini writes a second set when the user asks for one. By the time the question ends, the replies are usually on screen.
- For a yes-or-no question, a nod says the YES reply and a shake says the NO reply.
- For anything else the app offers one reply at a time: "Say this?" A nod says it, and a shake shows the next one. This is partner-assisted scanning with the iPad as the partner.
- Before a reply is spoken, a take-back ring closes around it for 1.6 seconds. The opposite gesture cancels it.
- After a plain statement nothing is offered, because people nod while they listen. A shake asks for replies. Before anyone has spoken, the same shake offers conversation starters, so the user can begin a conversation too.
- The last choice is "None of these". It leads to "I'm not sure." after a yes-or-no question or "Please ask me a yes-or-no question." after any other, a different set of replies written by Gemini, the user's saved phrases, and Help, which says "I need help. Please come here." at once.
It also works by touch. A helper or the user can tap Type, enter one or two words and get full sentences built on them, or photograph a menu or a form and get replies that use what is on it. Replies are spoken in the system voice or in the user's Personal Voice, the copy of their own voice that iOS can make.
Edgewise remembers facts about the user on the iPad and uses them when they are relevant. Every fact starts as device-only, which means only the on-device model sees it. The user can mark a fact shareable, and then Gemini may see it too. An Activity list shows whether recent replies, photo descriptions and learned facts were made on the iPad or in the cloud, and one switch turns the cloud off.
How I built it
Every model call goes through Firebase AI Logic hybrid inference, and the app gives the two models different jobs:
- The on-device model drafts while the other person is still talking. It is Apple Foundation Models, called through
FirebaseAI.SystemLanguageModel. An early draft starts from the words heard so far, and it is redone only if the finished remark turns out different in wording or in kind, so the replies are usually ready when the question ends. This model also learns facts about the user, and it is the only model that sees device-only facts. - Gemini writes the second set.
gemini-3.5-flash-liteis asked first when the user turns the draft down ("Different replies"), to turn typed words into sentences, and for photos. It is asked second when the on-device model is unavailable or cannot draft. HybridModelchains them in both orders: on-device first with Gemini behind it for ordinary drafts, Gemini first with the on-device model behind it for different replies and typed words. In Airplane Mode, listening, drafting and speaking continue on the iPad, and a request for different replies or for typed words is answered by the on-device model.- What is private decides the route. When a device-only fact is relevant, the request is pinned to the on-device model. If Gemini is asked after all, because the user wants different replies or the on-device model could not draft, the request is rebuilt without the fact, and the screen counts what stayed on the iPad: "Cloud · you asked for different replies · 3 private facts stayed here".
- The screen says which model answered. The name is read from
rawResponse.modelVersion, so it is right even after a fallback insideHybridModel.
The routing rule and the text of every request live in a small Swift package, EdgewiseCore. It also classifies each remark, checks each line a model writes before it is shown, decides what may be remembered, and turns nods and shakes into choices. It has about 440 unit tests that run on a Mac. One group builds every request for every route and every step, and asserts that no request that may reach Gemini contains a device-only fact.
Around the models:
- SpeechAnalyzer transcribes on the device.
- ARKit face tracking reads nods and shakes.
- Remote Config changes the Gemini model, the drafting instructions and the end-of-turn pause without an app update.
- App Check identifies the app to Firebase before it calls Gemini.
- An evaluation mode puts 73 fictional questions, plus 40 held-out ones, to the real models and scores every line.
Where to look in the video
- 0:07 and 0:47: the on-device model drafts while the other person is still talking.
- 1:05: both models through Firebase AI Logic,
HybridModelin both orders. - 1:32: a private fact keeps the request on the on-device model.
- 1:55: the reply "I feel tired this afternoon." matches the device-only fact "Gets tired in the late afternoon.", shown in Memory at 2:31.
- 2:04: the user asks for different replies, and Gemini writes them at 2:14 with 3 private facts left out.
- 2:31: Memory, with device-only and shareable facts.
- 2:40: the Activity list and the cloud switch.
Try it
Install the TestFlight build on an iPad with Apple Intelligence: https://testflight.apple.com/join/pQHW3c88. On first launch the app offers a sample profile, and Nod or tap is on from the start, so a nod or a tap says a reply. The README table "See the routes with the sample profile" walks through each route.
To build from source, clone the repository, add the GoogleService-Info.plist of your own Firebase project and run the Debug configuration. The Debug configuration uses the App Check debug provider, so register the token it prints on first launch in the Firebase console.
Challenges I ran into
- The replies had to be ready before the question ended. Asking the on-device model for four replies as structured output took 4 to 14 seconds, longer than most questions last. Streaming them as plain numbered lines, and starting from the first words heard, brought the time until all four replies arrive to a median of 1.1 seconds in evaluation runs and 1.6 seconds in live use.
- A small model's sentence is spoken in someone's voice. It sometimes wrote a reply under YES that meant no, or promised something the user could not do. Every line is now checked against rules before it is shown, and each rule has a test.
- A nod is also just a nod. People nod while they listen, so a nod alone could say something the user never meant. The recognizer measures the swing of the head rather than its position, a reply is never spoken without the take-back ring, and after a statement nothing can be chosen by a nod alone.
- "Private" had to include what was said, not only what was stored. Keeping a medication fact on the device is not enough if a reply built on it later reaches the cloud as conversation history. Those lines are marked and left out.
Accomplishments that I'm proud of
- Someone who can only nod can answer aloud. A yes-or-no question is answered with a nod. The take-back ring gives a moment to cancel, and nobody touches the screen.
- Drafting starts before the question ends. In live conversation, 21 of 23 on-device drafts started while the other person was still speaking, so the replies are usually on screen when the question ends.
- The fallback works in practice. In six evaluation runs, 1,135 drafts in all, the on-device model answered 29 times in place of a busy or timed-out Gemini.
- The privacy rule is code with tests, not a promise. One function decides where each request runs and what it may carry, and the tests check that no request that may reach Gemini contains a device-only fact.
What I learned
- Hybrid is more than a fallback. The small model is fast enough to draft while a sentence is still being spoken. The large one gives a real alternative when the user turns the first replies down. Giving each its own job worked better than plain fallback in either order.
- Choosing the model is a decision about data. Asking what a request would carry turned out to be a better rule than asking which model is available.
- A small model needs a small request. One long session drifted back to earlier questions. A short request about one remark, with the remark quoted last, stayed on topic.
- Designing for a nod shapes everything else. Replies come one at a time so each needs only a yes or a no, every yes can be taken back, and the app stays quiet when nobody has asked anything.
What's next
- Sessions with speech-language pathologists and ICU nurses, and saved phrases built from their word lists.
- A blink or eyebrow signal for people who cannot nod.