Inspiration

Under a bridge deck, signal is usually spotty or gone. An inspector on a rented lift looks at a cracked abutment, writes "cracks wider than last time" and moves on. Back at the office someone has to turn that into a rating, and if the rating needed the crack width, the lift has to come back.

There are 624,193 bridges in the US National Bridge Inventory; 41,685 (6.7%) are rated poor (FHWA, Bridge Condition by Highway System 2025, as of June 15, 2025). Federal rules require each one to be inspected at intervals not to exceed 24 months (23 CFR 650.311). Put the same bridges in front of 49 inspectors from 25 states and their condition ratings varied over a range of up to five different ratings (FHWA reliability study, 2001). And by March 15, 2028, every bridge record has to be recoded to the new national standard (SNBI) and verified, with no temporary codes (FHWA memo, May 2022).

The judgment, the condition state of each element, is often made later at the office from photos and memory. If the call turns out to need a measurement nobody took (a Poor, or CS3, section-loss call needs remaining thickness, not an estimate), that is another access day, and when the part can only be reached from an under-bridge truck, renting one runs $3,500 to $7,000 a day (Roads & Bridges, May 2025).

When the Fern Hollow Bridge in Pittsburgh collapsed in January 2022, the National Transportation Safety Board found both gaps at once. Over more than 15 years, inspectors had failed to "accurately quantify remaining material", and the city had not acted on "repeated maintenance and repair recommendations" in inspection reports from 2005 to 2021 (NTSB, HWY22MH003, Feb 2024). ProofWalk works on those two steps: it asks for the measurement while the inspector is still at the part, and it puts the trend and the ranked repairs in front of the engineer who signs. Nearly half of US bridges (49.1%) are rated Fair, and a Fair bridge costs less to preserve than a Poor one (ASCE 2025 Report Card, Bridges), so seeing "Was Good, now Fair" early is where the money goes furthest.

What it does

  • At each part (on-device): the inspector talks about the part as they would write it on paper. Code reads the numbers, units, locations and negation; the on-device model (Apple's, via Firebase AI Logic HybridModel) returns a short answer: defect, condition state, quantity and what is missing. Code applies the rule pack's thresholds, so the model can raise a rating but never lower it. If the rating still needs one detail, such as crack width or remaining thickness, the phone asks one follow-up question while the inspector is still at the part. The part's card (condition-state cells, the evidence each state needs, last cycle's rating) is built in code on the phone, so it all works in Airplane mode, and a change shows plainly: "Was Fair in 2024".
  • Once per visit (cloud): when the inspector finishes the bridge and has signal, a cloud Gemini call reads the visit against past inspections and writes the visit report: what changed, links between parts (a leaking joint over a worse bearing), record checks (quantities that don't add up, changes without evidence, SNBI items left blank) and a ranked repair list. Without a model the same report is worked out in code and labelled so.
  • At the office (web): the district view shows what changed and what to fix first, with a map. Nothing goes in the record until a person signs.

What works with spotty or no signal

Step Under the deck, spotty or no signal Needs signal
Speak the note iPhone speech runs on the device where the phone supports it; otherwise type
Read numbers, units, locations and negation Code on the phone
Rate the part Apple's on-device model; if it can't answer, code rates it and the label says so
Ask the one missing detail On the phone, while the inspector is at the part
Part card and last cycle's rating ("Was Fair in 2024") Built in code on the phone
A Severe part The phone tells the inspector to call the district engineer before leaving
Save the visit Saved on the phone; it sends itself when signal returns
Visit report: trends, links between parts, ranked repairs One cloud Gemini call per visit (without a model, worked out in code and labelled so)
Review and sign-off District engineer on the web

Try it

  • Web, no install: https://proofwalk.web.app/try. Press Run a sample bridge: the phone rates four parts of Story Rd over Coyote Creek with spotty or no signal, then sends the visit and one cloud call writes the report. The report says where each step ran ("4 rated on this phone · 1 cloud call").
  • On-device in Chrome: desktop Chrome 139 or later with chrome://flags/#prompt-api-for-gemini-nano-multimodal-input turned on rates the parts with Chrome's built-in Gemini Nano through Firebase AI Logic. Without it, code rates the parts on the page and the label says so.
  • iPhone: the app runs Apple's on-device model through the same Firebase AI Logic hybrid API (iPhone 15 Pro or later with Apple Intelligence on). On a Mac with Xcode it builds from a fresh clone in three steps, with no Firebase config; they're in the repo README.

How we built it

  • One JSON spec (the bridge rule pack, evidence parser, schemas, prompts, token budget) drives a TypeScript reference engine and a Swift port; 185 golden vectors pass identically on both.
  • iPhone (SwiftUI): Firebase AI Logic HybridModel(primary: SystemLanguageModel.default, secondary: Gemini), one call per part with a fresh session, output capped at 128 tokens; where each answer ran is read from the response and counted on the report. Offline state machine in a Swift package tested on Linux.
  • Web (React + Vite): /try phone flow in a browser and /district for the district engineer, Firebase JS SDK getGenerativeModel with hybrid modes, so desktop Chrome rates parts with its built-in Gemini Nano.
  • Firebase: Firestore (rules with emulator tests: only the district engineer's role signs, sign-offs are append-only), Remote Config (model names, output cap), App Check, Anonymous Auth. Spark plan only, no Storage bucket.

How it uses Firebase AI Logic, and why hybrid

Reason Why it needs both
Spotty or no signal under the deck The rating has to happen on the phone, because there is often no network where the inspector stands.
The access window The missing detail has to be asked for while the lift is still under the span, not discovered at the office.
The rules don't fit on the phone The manual and SNBI run to hundreds of pages; the phone carries one compact card per part that fits the ~4,000-token on-device window.
The whole bridge needs a wider view Links between parts, past inspections and record checks need the full visit, so one cloud call per visit writes the report once the inspector has signal.

How it routes, in code: on iPhone each part goes to a HybridModel with Apple's on-device model as primary and Gemini as secondary; on the web each part call uses InferenceMode.PREFER_ON_DEVICE. With spotty or no signal only the phone's model or code answers (a note is never sent to the cloud while the app is offline). The visit report is one Gemini call: a plain cloud model on iPhone, ONLY_IN_CLOUD on the web. The final rating is the highest of the model's rating, the measured value's band and the rule floor, so the model can raise a rating but never lower it.

What we verified, and what we haven't

Verified:

  • On a real iPhone 17 in Airplane mode (Nov 30): all 348 held-out notes were rated on the phone with no signal (Airplane mode). Apple's on-device model answered 336 through Firebase AI Logic, median 1.6 s a part; its safety filter refused 12, which the phone rated with code or left for the inspector, as the app does. The on-device row below is that run, with the ratings the phone stored.
  • Two engines, one spec: the TypeScript and Swift engines pass the same golden vectors in spec/golden.
  • Firestore rules: emulator tests show only the district engineer's role can sign and sign-offs can't be edited.
  • Every push: typecheck, unit tests, the eval runner, the rules tests and a browser smoke test run in CI.

Not yet:

  • Chrome's built-in Gemini Nano on the hosted /try (without it, code rates the parts and the label says so).
  • The cloud row of the visit-report eval (harness ready, not run).
  • Real field notes, and review of the labels by a certified inspector.

Evaluation

540 synthetic field notes written from the condition-state cells of the public Caltrans Bridge Element Inspection Manual (2017), half of them hard cases (shorthand, negation, mixed units, values near a threshold, two defects in one note). Each note is labelled with the cell it came from. A second, blind labeller agreed on every condition state; 17 notes it flagged as ambiguous are left out of the headline. Split: 175 dev notes, 348 held-out test notes. Numbers below are exact condition-state match with 95% intervals; the held-out rows are the ones in eval/results/v2/headline.md.

Held-out test (348 notes, 196 of them Poor or Severe; the on-device row was run on an iPhone 17 in Airplane mode on Nov 30):

System Poor or Severe missed (of 196) Poor or Severe caught Exact rating Missing detail caught
Keyword rules (baseline) 62 68.4% [62-74] 48.0% [43-53] 71.3%
Code layer only (no model) 13 93.4% [89-96] 93.1% [90-95] 98.8%
On-device (iPhone 17) + code, offline 5 97.4% [94-99] 78.4% [74-82] 87.5%
Gemini 3.5 Flash-Lite + code 0 100% [98-100] 98.3% [96-99] 100%
Gemini 3.1 Flash-Lite + code 0 100% [98-100] 99.1% [97-100] 98.6% (73 of 80 scored)

Phone speed on the same run: median 1.6 s a part, p90 3.6 s (over the 348 test notes the phone's model answered, the 12 ambiguous ones included; 336 of the 348 held-out).

These rows use the code with the shorthand rule: it teaches the code 21 inspector abbreviations ("pk rust", "exp rebar w/ SL", "struct review"). The on-device row ran with it on the phone; the code and cloud rows re-score their stored answers offline with it. The list came only from the dev notes; the held-out notes had been scored once before, so this is a design change checked on dev, not a fresh test.

Before the shorthand rule: phone 96.4% caught and 76.4% exact (7 missed, Nov 25 run), code alone 82.1% caught (35 missed), Gemini 3.5 Flash-Lite 97.4% exact (0 missed). Full tables: eval/results/v2/rescore-test.md and TABLES.md.

The 175 dev notes tuned the prompts and rules, so they are never the headline; their rows are in eval/results/v2/TABLES.md.

What it shows:

  • Offline, the phone caught 191 of 196 Poor or Severe parts, 1.6 s a part, on iPhone 17 in Airplane mode.
  • Poor or Severe parts missed, of 196 (fewer is better): keyword search 62, rules alone 13, rules + phone model 5, rules + Gemini 0 but it needs signal.
  • None of the other five was marked Good: 3 still flagged as worn, 2 handed back to the inspector instead of guessed. When it's unsure, the inspector decides.
  • Adding the phone's model to the code rules cuts misses from 13 to 5. Three of the five are notes Apple's safety filter refused on this run (it answered all three on Nov 25); the phone marks them for the inspector to settle. The other two are "patch cracked and unsound" (word order) and spld … 1.5" dp (shorthand that only appears in the held-out notes, left out so the test stays untuned).
  • On the phone the model alone is much weaker (54.6% exact on held-out, against 95.1% for Gemini 3.5 Flash-Lite) and mostly rates too high, so the phone's exact rating (78.4%) is below code alone (93.1%). It errs high: a Fair called Poor costs a second look, a Poor called Fair can miss a repair.
  • When the phone marks a rating ready it is right 39 of 41 times. Everything else asks the inspector to look.
  • Gemini 3.1 and 3.5 Flash-Lite are close on the held-out notes (99.1% and 98.3% exact); 3.5 Flash-Lite is the cloud model because its latency is steadier (p95 6.5 s against 48.7 s on the held-out run, 4.4 s against 36 s on the Nov 26 dev run); the medians swap between runs.
  • The cloud rows rate each part in the cloud. They show how far a model can go with the same card; the on-device row is the one the phone ships.

Limits: the notes are synthetic, so they show whether a model applies the manual's cells to inspector-style wording, not how often real notes look like this. Labels come from the writer of the notes and a blind second labeller, both Claude sessions; Ikram spot-checked 30 notes and changed none, and he is not a certified inspector. Public NBI element data for Delaware (2023 vs 2025, 2,933 elements) shows the worst condition state changed between cycles for 11% of elements, so "Was Fair in 2024" is a meaningful flag.

The cloud task has its own eval. Eval V is 96 synthetic visits with planted facts: a joint leaking onto a part that got worse, a dry joint over a part cracked for its own reason, a leak that lands on the slope, a crack that widens inside one condition state, a repaired part, a Severe part. The report the app writes in code when there is no model gets the trends right on 262 of 278 parts but finds none of the 16 widening cracks, and it can't tell a leak that lands on the slope from one that lands on the parts below, so 16 of its 32 links between parts are wrong. The cloud call (Gemini 3.5 Flash-Lite) is there for exactly this reading. Its row on this eval is not run yet, so we make no accuracy claim for the cloud report; the harness and how to run it are in eval/results/visit/TABLE.md.

Challenges

  • Decode on device is slow, so the answer is short codes (defect, condition state, quantity, what is missing) plus at most one follow-up question.
  • Numbers matter more than words near thresholds, so code applies the bands and the model only adds what text needs reading.
  • The phone's model sees one part at a time; the trends and links need the whole visit and its history, so the cloud makes one call per visit, after the inspector is done, and the client retries busy answers before falling back to the code layer.

What's next

An SDK for the inspection apps states already run, so the per-part rating and the visit report check every record against SNBI ahead of the 2028 deadline.

Built with

Firebase AI Logic (hybrid inference), Gemini 3.5 Flash-Lite, Apple Foundation Models (on-device, via Firebase AI Logic), Gemini Nano (Chrome built-in AI), Cloud Firestore, Firebase Remote Config, Firebase App Check, Firebase Authentication, Swift, SwiftUI, TypeScript, React, Vite.

Disclaimer. ProofWalk is a demo. Bridge names and places are used for illustration, and every inspection, rating and report is sample data that does not reflect any real structure's condition; it is not for engineering or safety decisions and is not affiliated with or endorsed by any agency.

Built With

Share this project:

Updates

Submission history