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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
有赞技术团队
有赞技术团队
H
Help Net Security
V
Visual Studio Blog
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LangChain Blog
N
Netflix TechBlog - Medium
罗磊的独立博客
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements

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
My Figma frame and my code had a fight. Gemma 4 refereed
Pavan · 2026-05-13 · via DEV Community

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

What I Built

Figma vs build is a Next.js app that compares a Figma frame export to a screenshot of the shipped UI. You upload both images, hit Run check, and get a structured list of mismatches (spacing, typography, color, radius and shadows, alignment, missing or extra bits, copy, icons) with low / medium / high severity and filters so you can skim fast.

Problem it tries to help with: “Looks off compared to Figma” bugs usually turn into eyeballing two pictures in Slack. This gives a first pass machine read so you have concrete bullets to triage, not a final sign off.

How Gemma fits in the stack: the browser only sends multipart images to POST /api/analyze. That route (Node runtime) calls OpenRouter with a multimodal chat payload, then zod validates the JSON before anything renders. Images go as data URLs inside image_url parts so there is no separate file host. A tiny parser handles models that wrap JSON in markdown fences or chatter around the object.

Honest limits: bad zoom, crop, or light vs dark mismatches cause false positives. There is a ~6MB per image cap in the handler, and serverless hosts can choke on huge bodies, so heavy @2x PNGs may need a resize before upload.

Demo

Video walkthrough

Images used

Deployed app: Vercel 🚀

Code

Repository: gemma4-figma-vs-ui

Quick run

git clone https://github.com/chilupa/gemma4-figma-vs-ui
cp .env.example .env.local

Enter fullscreen mode Exit fullscreen mode

Add OPENROUTER_API_KEY from OpenRouter, then:

npm install
npm run dev

Enter fullscreen mode Exit fullscreen mode

How I Used Gemma 4

What powers the product: every comparison is a single multimodal completion. The model sees two images in fixed order (reference first, implementation second) plus a system prompt that forces one JSON object with a mismatches array. No pixel diff engine does the judging. If parsing or schema validation fails, the API returns an error and a short raw text preview for debugging.

Which model I chose: google/gemma-4-31b-it on OpenRouter, i.e. the 31B Dense multimodal line the challenge calls out.

Why 31B Dense and not E2B / E4B for this build: E2B and E4B are the right story when you care about ultra mobile, edge, browser, or on device speed and cost. I want fewer missed diffs on subtle layout and hierarchy when both inputs are full screenshots, so I traded latency and API cost for stronger vision and judgment in one shot. If I rewrote the product for offline or Pixel class usage, I would move the default to a small Gemma 4 and probably simplify prompts or accept noisier output.

MoE note (not in the template checklist but real on OpenRouter): google/gemma-4-26b-a4b-it is there if I later optimize for throughput or cost with a different quality bar. Same env var swap (OPENROUTER_MODEL), no code fork required.

Bottom line: for pairwise UI screenshot QA, 31B Dense was the intentional fit. Small sizes and MoE stay valid alternatives for other deployment and economics stories.