Inspiration

In 2024, insurers reporting HealthCare.gov data denied 19% of in-network claims. Consumers internally appealed fewer than 1% of those denials. For a member trying to appeal, finding the relevant exception can mean reading a lengthy Evidence of Coverage. Asking a cloud chatbot for help can mean sharing a letter containing a name, member ID, claim number, and diagnosis. KFF analysis (https://www.kff.org/patient-consumer-protections/claims-denials-and-appeals-in-aca-marketplace-plans-in-2024/)

We built Cleave so members can check a denial against their own plan and draft an appeal while keeping the original letter on their device.

What it does

Elena’s insurer denied her after-hours urgent care claim because she had no referral. Her plan waives referrals for that visit. Here’s how Cleave helps her find the waiver and use it in an appeal.

  1. Reads the letter on her device. The local model extracts personal details into a vault that stays on the device.
  2. Lets her choose what to share. Cleave shows up to ten structured claim facts in plain English. Elena can uncheck any field before sending.
  3. Checks her own plan. Gemini via Firebase AI Logic cites Section 4.2(a) and shows it beside the insurer’s reason. If Elena withholds her plan ID, Cleave gives general guidance.
  4. Asks when a fact is missing. In a separate Medicare-style example, Cleave asks whether the member was outside the plan’s service area because the letter leaves that open.
  5. Prepares an editable appeal. Gemini drafts with placeholders. The browser or iPhone fills in the personal details locally.

How we built it

  • Web. React, TypeScript, and Firebase Hosting. Firebase AI Logic uses ONLY_ON_DEVICE for extraction, ONLY_IN_CLOUD for policy matching, and PREFER_IN_CLOUD for offline-capable triage. PDFs are parsed in the browser, and Firebase App Check protects cloud calls.
  • Native iOS. SwiftUI and PDFKit, with Apple Foundation Models for local extraction and Gemini through FirebaseAILogic for policy matching.
  • Privacy controls. The model proposes fields. A typed allowlist and an identifier scan control what can be sent. Members can inspect captured requests in Wire Proof.

Challenges we ran into

We found that hybrid SDK behavior can put sensitive inputs at risk. Cleave checks that local inference is available before processing a letter and verifies where inference ran. We demonstrate the PDF handling difference with a synthetic document in the Fail-Closed PDF Lab and reported it upstream. Firebase SDK issue (https://github.com/firebase/firebase-js-sdk/issues/10690)

On iOS, Apple’s default guardrails rejected some synthetic medical letters. We adjusted the local preprocessing and used Apple’s transformation guardrails. On web, we added a fail-closed timeout and retry handling for cloud rate limits.

Accomplishments we’re proud of

  • A complete workflow on web and iOS. Members can bring their own plan PDF, compare the denial with the relevant clause, and leave with an editable draft.
  • A benchmark with published misses. On the first run of 12 pre-registered synthetic cases, Cleave got 10/12 exact matches across clause, verdict, and confirmation, with 0/83 planted identifiers in outgoing requests. The redaction baseline got 9/12 exact with 49/83 identifiers in outgoing requests. Protocol and results (https://github.com/fexx301/Cleave/blob/main/eval/HOLDOUT.md)
  • A live Nano 4 check. On a synthetic OB-GYN denial, Cleave kept nine details on the device and completed local extraction in 9.8 seconds with zero network requests.

What we learned

The most valuable part of hybrid inference was deciding which information each step needed. The device handles the letter and identity. Cloud Gemini gets the approved facts and plan text it needs to find the clause. When those facts are insufficient, the app can ask the member directly.

What’s next

We want to repeat the evaluation across model runs, test more document formats, and expand to Android.

Try Cleave · Hosted web app (https://cleave-5a82b.web.app) · iOS Simulator build (https://github.com/fexx301/Cleave/releases/tag/ios-simulator-v1) · Source code and judge walkthrough (https://github.com/fexx301/Cleave)

All demo letters and members are fictional. Cleave helps with administrative policy review and appeal drafting.

Built With

  • apple-foundation-models
  • chrome-built-in-ai
  • firebase-ai-logic
  • firebase-app-check
  • firebase-hosting
  • gemini
  • gemini-nano
  • hybrid-inference
  • ios
  • javascript
  • on-device-ai
  • pdf.js
  • pdfkit
  • react
  • recaptcha-enterprise
  • swift
  • swift-ui
  • typescript
  • vite
  • vitetest
Share this project:

Updates

Submission history