惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Security Latest
Security Latest
P
Proofpoint News Feed
GbyAI
GbyAI
PCI Perspectives
PCI Perspectives
博客园 - Franky
N
Netflix TechBlog - Medium
博客园_首页
WordPress大学
WordPress大学
K
Kaspersky official blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Vercel News
Vercel News
T
Threatpost
The Hacker News
The Hacker News
H
Help Net Security
S
Securelist
Recent Announcements
Recent Announcements
腾讯CDC
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta
C
Cisco Blogs
V
V2EX
C
Check Point Blog
S
Schneier on Security
Cyberwarzone
Cyberwarzone
C
Cybersecurity and Infrastructure Security Agency CISA
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Jina AI
Jina AI
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
博客园 - 叶小钗
A
Arctic Wolf
AWS News Blog
AWS News Blog
Latest news
Latest news
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
小众软件
小众软件
B
Blog
aimingoo的专栏
aimingoo的专栏
C
Cyber Attacks, Cyber Crime and Cyber Security
V
Visual Studio Blog
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything BFF模式详解:构建前后端协同的中间层 I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
LIKAS: An offline disaster companion for the Philippines, powered by on-device Gemma 4 E2B
John Paul Cu · 2026-05-24 · via DEV Community

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

LIKASyour companion when calamity strikes the nation.

Likas, in Filipino, means nature — and also to evacuate. LIKAS is an offline, AI-powered disaster companion that helps Filipinos get to safety when nature turns against them.

In the Philippines, the disaster is the connectivity outage. The 2024 typhoon season alone brought six major storms in 30 days; the country averages ~20 typhoons, 100–150 felt earthquakes, and recurring volcanic activity yearly, with 74% of the population in disaster-prone areas. When a typhoon makes landfall or a fault ruptures, cell towers fail and the internet drops at the exact moment a family needs to know where the nearest evacuation center is and how to reach it. Every "disaster app" I tried assumed the one thing never true in a disaster: a working network.

LIKAS is a React Native app (Android/iOS) that turns a phone into a self-contained survival tool. Maps, evacuation centers, a pre-computed OSM pedestrian routing graph, NDRRMC/PAGASA/PHIVOLCS protocols, and a fine-tuned Gemma 4 E2B model are bundled at install time. Zero network calls at runtime — by mandate, not as a fallback.

The centerpiece is an AI assistant that deliberately does not behave like a chatbot. A 2B model that free-forms safety advice is a liability; one that routes intent to grounded data is an asset. So LIKAS uses Gemma 4 as a task-specific tool-dispatcher: every turn it emits exactly one JSON envelope — a tool call or a spoken reply, never prose around it.

One real query, end to end: the user types, in Taglish, "Saan kami pwedeng lumikas? May aso at lola ako" ("Where can we evacuate? I have a dog and a grandmother"). Turn 1 — the model emits {"action":"tool","name":"route_to_nearest_evacuation","args":{}}. The app resolves this entirely on-device: Dijkstra over the pedestrian graph finds walkable routes, then a weighted scorer ranks centers (distance·0.4 + pwd·0.3 + pet·0.2 + capacity·0.1). Turn 2 — fed the result, the model produces the final answer personalized from the on-device profile: it surfaces the pet-friendly, PWD-accessible center because the question named a dog and a lola, in Taglish. No byte left the phone.

Four tools ground every safety-critical answer in authority data, not the model's parameters:

  • get_protocol quotes NDRRMC/PHIVOLCS/PAGASA steps verbatim (inventing safety steps is forbidden)
  • route_to_nearest_evacuation does offline, profile-aware routing
  • find_nearby is offline POI search (hospital, school, gym, multi-purpose hall, covered court)
  • get_user_profile supplies on-device personalization (conditions, companions, meeting points)

Demo

📺 Video walkthrough: https://www.youtube.com/watch?v=kHHcDSyip-Q

Code

🔗 GitHub: https://github.com/JpCurada/likas

Supporting artifacts (all public):

How I Used Gemma 4

I chose Gemma 4 E2B — the 2B effective-parameter edge variant — because the entire premise of LIKAS is that the model has to live inside a phone that just lost signal. The 4B and 31B variants would have been more capable; they would also have been impossible. E2B was the only flavor where a Q4_K_M quantization (~1.8 GB) fits comfortably in the RAM budget of a mid-range Android phone someone already owns, alongside MapLibre, the pedestrian graph, and the OSM POI data. The judges' question — "show us why your model was the right tool for the job" — has a sharp answer here: the disaster is the connectivity outage, so the model must run where the disaster is, and only E2B can.

But putting a 2B model in the safety-critical path required two design moves that I think are the most interesting things about this submission:

1. Fine-tuning Gemma 4 E2B for one specific, life-or-death task — not as a better chatbot. Using Unsloth's LoRA pipeline I trained Gemma 4 E2B against the same 9-rule system prompt the app ships: verbatim protocol quoting, mandatory tool use for safety/evacuation queries, profile personalization, off-topic refusal, same-language response across English / Filipino / Taglish. Because training and inference share one prompt verbatim, there is zero distribution shift between the evaluation notebook and the phone. The dataset was the hard part — v3 generated 692 conversations but only ~30% of assistant turns were unique (the verbatim-quote rule mapped many paraphrased questions to the same protocol texts). The signature was unmistakable: train loss collapsed 3.47→0.31 in 24 steps while validation barely moved. The fix was a rule-preserving paraphrase generator whose extract_rules() pass parses every NDRRMC/PHIVOLCS step out of the source and asserts its presence in every variant — so surface form varies (terse / numbered / urgent / reassuring) without ever dropping a safety instruction.

2. Running Gemma 4 on-device via llama.cpp with a GBNF grammar around it. The fine-tuned model is quantized to Q4_K_M GGUF and runs entirely on-device through llama.rn (^0.12.0) — the full llama.cpp engine in-process on the phone (n_ctx: 4096, n_threads: 4, full GPU-layer offload, no server). Sampling is locked low (temperature 0.4): a disaster dispatcher should not be creative. Every turn must be exactly one parseable envelope, on a phone, with no server to retry against. Prompting alone can't guarantee that — so the decoder is constrained by a GBNF grammar built from the live tool registry: one speak production or one of four tool productions, with tool names and argument enums baked in as literals. The decoder physically cannot emit an invalid tool name or a half-formed object.

A grammar guarantees shape, not choice. The fine-tuned model is reliable but inconsistent — for an evacuation question it sometimes emits the clean tool call and sometimes narrates the tool inside a speak reply, leaving nothing on the map at the exact moment it matters most. So the dispatch loop is wrapped in a deterministic rescue: if the user's message unambiguously asks for evacuation or a nearby POI and the matching tool never ran, the app invokes that tool itself and pushes the route/pins to the map regardless of which shape the model chose. There is also a full no-LLM fallback: if the model fails to load or the battery is below 15%, the same keyword router still resolves evacuation and POI queries against the on-device data. The grounding survives even a dead model.

This separation is the heart of my use of Gemma 4: native function calling on the edge keeps a small model honest. Gemma owns what it is good at — parsing messy, code-switched Filipino intent and producing fluent, personalized replies. The device owns what must never be hallucinated — routes, distances, protocol text, personal data. The model never recalls a safety step; it fetches one. That is what makes a 2B model trustworthy enough to put in front of someone mid-evacuation.

Everything is verifiable: Likas/src/services/aiAssistantService.ts runs the dispatch loop, aiGrammar.ts builds the GBNF from the tool registry, Likas/scripts/build_dataset_v4.py contains the overfit numbers, and notebooks/Likas_Sample_Prompts.ipynb reproduces the exact production prompt and grammar at the same n_ctx=4096 — so on-device behavior is inspectable without building the app.