<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nick Switzer</title>
    <description>The latest articles on DEV Community by Nick Switzer (@nswitzer).</description>
    <link>https://dev.to/nswitzer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3949377%2Feaeb9ca7-1894-41e5-99a3-5cd5c73ec60d.jpg</url>
      <title>DEV Community: Nick Switzer</title>
      <link>https://dev.to/nswitzer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nswitzer"/>
    <language>en</language>
    <item>
      <title>Vessel Ops</title>
      <dc:creator>Nick Switzer</dc:creator>
      <pubDate>Sun, 24 May 2026 21:03:04 +0000</pubDate>
      <link>https://dev.to/nswitzer/vessel-ops-3i2a</link>
      <guid>https://dev.to/nswitzer/vessel-ops-3i2a</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/google-gemma-2026-05-06"&gt;Gemma 4 Challenge: Build with Gemma 4&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"When a crew member is injured 200 miles offshore, there is no internet, no doctor, and no second opinion. This application is the second opinion."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We built &lt;strong&gt;Vessel Ops AI&lt;/strong&gt;, an offline-first desktop application that serves as a lifeline for the &lt;strong&gt;Medical Person in Charge (MPIC)&lt;/strong&gt; and &lt;strong&gt;Chief Engineer&lt;/strong&gt; on vessels operating hundreds of miles from shore.&lt;/p&gt;

&lt;p&gt;When a crew member is injured mid-ocean, the MPIC usually has to flip through a 400-page medical manual under immense pressure. When a critical component fails, the Chief Engineer troubleshoots alone without an OEM support hotline or even a simple Google search. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vessel Ops AI puts Gemma 4 on the laptop in the wheelhouse&lt;/strong&gt;. It's grounded in the WHO International Medical Guide for Ships, cites specific pages for every piece of advice, and requires zero connectivity at sea.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🏥 &lt;strong&gt;RAG-grounded medical triage&lt;/strong&gt; — every response cites &lt;code&gt;[WHO IMGS, p. XX]&lt;/code&gt; from an embedded 938-chunk knowledge base&lt;/li&gt;
&lt;li&gt;⚙️ &lt;strong&gt;Engineering fault diagnosis&lt;/strong&gt; — component tracking, maintenance logs, and AI-assisted troubleshooting&lt;/li&gt;
&lt;li&gt;📸 &lt;strong&gt;Multimodal analysis&lt;/strong&gt; — upload a photo of an injury or a failing part and Gemma classifies it on-device&lt;/li&gt;
&lt;li&gt;🎓 &lt;strong&gt;MPIC Study Mode&lt;/strong&gt; — an interactive medical examiner that scores crew responses 1–10 against established protocols&lt;/li&gt;
&lt;li&gt;🧠 &lt;strong&gt;Captain Sparky Trivia&lt;/strong&gt; — morale-boosting maritime trivia to keep crew engaged during long watches&lt;/li&gt;
&lt;li&gt;🔄 &lt;strong&gt;Offline sync queue&lt;/strong&gt; — every write accumulates locally and pushes to Firebase Firestore when the vessel reaches port&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🌐 Live hosted demo (no install required):&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://vessel-ops.web.app" rel="noopener noreferrer"&gt;https://vessel-ops.web.app&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Cloud preview mode — Gemma 4 26B MoE via Google AI Studio. A yellow banner indicates cloud mode.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The 3-minute pitch is embedded at the top of this post! Looking for a deeper dive? Check out the &lt;a href="https://www.youtube.com/watch?v=1UXPEHe7HwI" rel="noopener noreferrer"&gt;Extended Technical Demo&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💻 Download the desktop app:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/switzloco/sail_pal/releases/latest" rel="noopener noreferrer"&gt;GitHub Releases&lt;/a&gt; — Windows installer (75 MB, no admin required) or portable &lt;code&gt;.zip&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/switzloco" rel="noopener noreferrer"&gt;
        switzloco
      &lt;/a&gt; / &lt;a href="https://github.com/switzloco/sail_pal" rel="noopener noreferrer"&gt;
        sail_pal
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A Gemma small language model tool to help sailors with medical, maintenance and other needs when they don't have reliable internet access in the middle of the ocean
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Vessel Ops AI&lt;/h1&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;"When a crew member is injured 200 miles offshore, there is no internet, no doctor
and no second opinion. This application is the second opinion."&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;An offline-first AI assistant for the &lt;strong&gt;Medical Person in Charge (MPIC)&lt;/strong&gt; and &lt;strong&gt;Chief Engineer&lt;/strong&gt;
on vessels operating in deep-water environments. Runs entirely on a laptop — no cloud, no connectivity
required at sea. Powered by &lt;strong&gt;Gemma 4 via Ollama&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Hackathon Context&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Built for the &lt;strong&gt;Gemma 4 Good Hackathon&lt;/strong&gt; (Kaggle × Google DeepMind, due May 18, 2026).&lt;/p&gt;
&lt;p&gt;Prize targets:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ollama Prize&lt;/strong&gt; ($10k) — best project using Gemma 4 via Ollama&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Resilience Prize&lt;/strong&gt; ($10k) — offline disaster/emergency response&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health &amp;amp; Sciences Prize&lt;/strong&gt; ($10k) — medical decision support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cactus Prize&lt;/strong&gt; ($10k) — local-first app with intelligent model routing&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Deployment&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;
&lt;pre class="notranslate"&gt;&lt;code&gt;Laptop (MacBook, Windows, Linux)
  └── Ollama  →  gemma4:e2b (general / engine / maintenance / trivia)
              +  nswitzer/gemma4-maritime-medical-GGUF (Unsloth fine-tune
                 used automatically for medical routes)&lt;/code&gt;&lt;/pre&gt;…&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/switzloco/sail_pal" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How We Used Gemma 4
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Which Model — and Why
&lt;/h3&gt;

&lt;p&gt;Vessel Ops AI doesn't just "use Gemma" — Gemma is the core intelligence, and &lt;strong&gt;the model selection is driven entirely by the deployment constraint: a sailor's laptop with no internet.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Gemma 4 family gave us three options:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Architecture&lt;/th&gt;
&lt;th&gt;Total Params&lt;/th&gt;
&lt;th&gt;Active Params&lt;/th&gt;
&lt;th&gt;Our Verdict&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;E2B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dense&lt;/td&gt;
&lt;td&gt;~2B&lt;/td&gt;
&lt;td&gt;2B&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;Default edge model&lt;/strong&gt; — fits 8–16 GB RAM laptops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;E4B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dense&lt;/td&gt;
&lt;td&gt;~4B&lt;/td&gt;
&lt;td&gt;4B&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;Scale-up model&lt;/strong&gt; — stronger reasoning on 32 GB+ hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;26B MoE&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mixture-of-Experts&lt;/td&gt;
&lt;td&gt;~26B&lt;/td&gt;
&lt;td&gt;~4B&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;Cloud preview&lt;/strong&gt; — used for the hosted demo via AI Studio&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;31B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dense&lt;/td&gt;
&lt;td&gt;~31B&lt;/td&gt;
&lt;td&gt;31B&lt;/td&gt;
&lt;td&gt;❌ Too heavy for shipboard hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Why we chose the E2B/E4B small models for edge deployment:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Maritime laptops are typically mid-range machines such as a 2–3 year old ThinkPad with 8–16 GB RAM and no discrete GPU. The 26B MoE requires ~16–24 GB VRAM even at Q4 quantization; the 31B dense needs 24 GB+. Neither fits the hardware reality at sea. The E2B and E4B models were purpose-built for exactly this constraint — ultra-mobile, edge deployment on devices like mid-range laptops.&lt;/p&gt;

&lt;p&gt;Our system implements &lt;strong&gt;intelligent model routing&lt;/strong&gt; based on clinical severity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# backend/ai/ollama_client.py
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_pick_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;severity&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;critical&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serious&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model_scale&lt;/span&gt;    &lt;span class="c1"&gt;# gemma4:e4b — deeper reasoning
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model_primary&lt;/span&gt;      &lt;span class="c1"&gt;# gemma4:e2b — fast, fits any laptop
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Minor queries (crew vitals logging, routine maintenance) hit the fast E2B model. Critical medical events and serious engineering faults escalate to E4B for deeper reasoning — if the hardware supports it. This intelligent routing perfectly fits a local-first architecture pattern where the routing decision is quite literally life-or-death.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why the 26B MoE for the cloud demo:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The hosted preview at &lt;code&gt;vessel-ops.web.app&lt;/code&gt; uses &lt;code&gt;gemma-4-26b-a4b-it&lt;/code&gt; via Google AI Studio. The MoE architecture is ideal here — it delivers the intelligence of a much larger model while only computing ~4B parameters per token, keeping latency low for the demo. Crucially, we &lt;strong&gt;disabled Google Search grounding&lt;/strong&gt; so the cloud preview doesn't look artificially smarter than what a crew member would experience offline with the E2B/E4B models.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Gemma Does Real Work
&lt;/h3&gt;

&lt;p&gt;Gemma isn't a chat wrapper in this project. It's doing &lt;strong&gt;three distinct kinds of real work:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. RAG-grounded medical triage&lt;/strong&gt;&lt;br&gt;
Every query — regardless of which screen the user is on — automatically retrieves the top BM25-ranked passages from a 938-chunk SQLite FTS5 index of the WHO International Medical Guide for Ships (3rd Edition). These passages are injected into the system prompt with explicit citation markers, and Gemma is instructed to cite &lt;code&gt;[Source, p. XX]&lt;/code&gt; on every claim. Chris loves this page / source feature so he can dig deeper on his own. &lt;/p&gt;

&lt;p&gt;This dramatically reduces hallucination on dosages and protocols — exactly the kind of mistake that could kill/maim someone at sea.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Multimodal injury &amp;amp; component analysis&lt;/strong&gt;&lt;br&gt;
When a crew member uploads a photo of a wound or a failing engine part, Gemma's vision capability classifies the observation. The classification feeds back into the RAG step as additional query context, so the retrieved protocols are relevant to what the camera actually sees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Domain-specific personas&lt;/strong&gt;&lt;br&gt;
Different code paths apply different system prompts — medical chat, engine chat, MPIC study mode, trivia — all running on the same Gemma model. The MPIC study mode is particularly compelling: it acts as an interactive medical examiner that presents emergency scenarios and scores the crew member's response 1–10 against WHO protocols.&lt;/p&gt;




&lt;h3&gt;
  
  
  The FTS5 Decision (Killing the Embedding Model)
&lt;/h3&gt;

&lt;p&gt;This deserves its own section because it was the single most impactful engineering decision in the project.&lt;/p&gt;

&lt;p&gt;We started with ChromaDB + sentence-transformers for RAG. The embedding model alone added &lt;strong&gt;~1 GB&lt;/strong&gt; to the installer. For a vessel deployment where every megabyte matters and the installer ships on a USB stick, this was a dealbreaker.&lt;/p&gt;

&lt;p&gt;We replaced the entire RAG layer with &lt;strong&gt;SQLite FTS5&lt;/strong&gt; — which is built into stock Python — using BM25 ranking and a porter stemmer. The 938 WHO IMGS chunks ship as a 1.3 MB JSON that bootstraps into the FTS5 virtual table on first launch. Bundle size dropped &lt;strong&gt;~99%&lt;/strong&gt; with no measurable loss in retrieval quality on this corpus.&lt;/p&gt;

&lt;p&gt;Is BM25 perfect? No. Lexical search struggles with synonyms — if a sailor types "cut," BM25 might miss the WHO manual's section on "lacerations." Dense retrieval (embeddings) normally bridges this semantic gap, but we refused to pay the 1 GB size penalty. &lt;/p&gt;

&lt;p&gt;Instead, we implemented &lt;strong&gt;LLM-Based Query Expansion&lt;/strong&gt;. When a sailor submits a medical query, we do a rapid, invisible pass through the fast &lt;code&gt;gemma4:e2b&lt;/code&gt; model: &lt;em&gt;"Rewrite this medical symptom into formal clinical terminology for a manual search."&lt;/em&gt; Gemma translates "cut" to "laceration, hemorrhage," and we pass the expanded query to the FTS5 index. We get the intelligence of semantic search with the footprint of lexical search.&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Laptop at Sea (no internet)
  ├── Ollama  →  gemma4:e2b (default) / gemma4:e4b (32GB+ RAM)
  ├── FastAPI backend  →  SQLite WAL + FTS5 RAG index
  ├── Next.js 14 static export  →  Tauri 2 desktop wrapper
  └── Any device on ship LAN  →  http://&amp;lt;laptop-ip&amp;gt;:3000

Cloud Preview (for judges / demos)
  ├── Google AI Studio  →  gemma-4-26b-a4b-it (MoE)
  ├── Cloud Run  →  FastAPI backend (stateless, auto-seeds demo data)
  └── Firebase Hosting  →  https://vessel-ops.web.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Challenges we Overcame
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Running frontier AI on "potato" hardware:&lt;/strong&gt; Many vessels run 3+ year old laptops. Gemma 4 E2B was chosen specifically for its capability-to-size ratio — responses generate fast enough to be useful in an emergency on hardware that wouldn't fit a 12B+ model in RAM alongside the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment for non-technical crews:&lt;/strong&gt; Installing Python, Node, and Ollama is beyond a typical crew member. We wrap everything — Python interpreter, dependencies, FTS5 index, WHO PDF — into a single NSIS installer that runs without admin rights.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PyInstaller orphan processes:&lt;/strong&gt; The PyInstaller &lt;code&gt;--onefile&lt;/code&gt; bootloader on Windows doesn't propagate termination to its child process. We reap orphan &lt;code&gt;vessel-ops-backend.exe&lt;/code&gt; processes on every launch with a 500ms settle — without this, the second launch silently fails because port 8000 is still bound.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team
&lt;/h3&gt;

&lt;p&gt;This project started with &lt;strong&gt;&lt;a href="https://www.linkedin.com/in/christopher-o-1a55b813/" rel="noopener noreferrer"&gt;Capt. Chris Oprzadek&lt;/a&gt;&lt;/strong&gt; — eight years as a Navy Nuclear Submarine Officer out of Hawaii and Guam, two Atlantic crossings, and now heading out with Seamester to teach offshore sailing. The brief came directly from him: &lt;em&gt;"we need a second opinion that works when there's no satellite."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Our medical advisor &lt;strong&gt;&lt;a href="https://www.linkedin.com/in/michael-switzer-61aaa1259/" rel="noopener noreferrer"&gt;Dr. Michael Switzer&lt;/a&gt;&lt;/strong&gt; — a physician who refits and maintains his own boat out of Port Townsend, WA — documents the practitioner-meets-boat-owner reality in his YouTube channel, where every onboard repair is also a reminder that out here you fix it yourself.&lt;/p&gt;

&lt;p&gt;Built by &lt;strong&gt;&lt;a href="https://www.linkedin.com/in/nswitzer/" rel="noopener noreferrer"&gt;Nick Switzer&lt;/a&gt;&lt;/strong&gt;. Between those three perspectives — deep-water passages, self-reliant boat life, and software — Vessel Ops AI's design brief wrote itself.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Vessel Ops AI is open source under GPL-3.0. The WHO IMGS content is used under fair-use for safety-critical, non-commercial maritime applications.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
    </item>
  </channel>
</rss>
