<?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: Andy Mak</title>
    <description>The latest articles on DEV Community by Andy Mak (@andymak).</description>
    <link>https://dev.to/andymak</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%2F3938249%2F512dfe53-7c81-4145-b918-6312de15517b.png</url>
      <title>DEV Community: Andy Mak</title>
      <link>https://dev.to/andymak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andymak"/>
    <language>en</language>
    <item>
      <title>Why Gemma 4 E4B Was the Right Fit for Anti-FraudX</title>
      <dc:creator>Andy Mak</dc:creator>
      <pubDate>Mon, 18 May 2026 14:19:56 +0000</pubDate>
      <link>https://dev.to/andymak/why-gemma-4-e4b-was-the-right-fit-for-anti-fraudx-eb6</link>
      <guid>https://dev.to/andymak/why-gemma-4-e4b-was-the-right-fit-for-anti-fraudx-eb6</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: Write About Gemma 4&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Anti-FraudX is a local anti-scam training platform for Hong Kong.&lt;/p&gt;

&lt;p&gt;It simulates scam conversations, explains red flags, and helps users practise responses before they face a real fraud attempt. The project is designed for privacy-sensitive, community-friendly deployment, so the experience runs locally through Ollama instead of depending on cloud AI for every interaction.&lt;/p&gt;

&lt;p&gt;The system combines role-based simulation, trust scoring, and local model serving. That means users can see not just what a scam looks like, but how it unfolds under pressure.&lt;/p&gt;

&lt;p&gt;Gemma 4 E4B is the model that makes this practical. It powers the default reasoning path, victim simulation, recorder analysis, and the broader anti-fraud workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Chose Gemma 4 E4B
&lt;/h2&gt;

&lt;p&gt;Gemma 4 comes in different sizes, and the right one depends on the job.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2B / 4B&lt;/strong&gt; models are best for tiny edge or browser-style deployments&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;E4B&lt;/strong&gt; is the right balance for local, privacy-sensitive applications that still need useful reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;26B MoE&lt;/strong&gt; is better when throughput and richer reasoning matter more than footprint&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;31B Dense&lt;/strong&gt; is a stronger server-grade option when hardware is available&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Anti-FraudX, the deciding factor was deployment reality. The system needs to run in schools, homes, and community centres, where local execution and practicality matter as much as raw model size. E4B is large enough to support conversation, scoring, and explanation, but still small enough to remain usable on local infrastructure.&lt;/p&gt;

&lt;p&gt;That trade-off is important. A model can be technically impressive and still be the wrong choice for a product if it is too expensive, too heavy, or too difficult to deploy where people actually need it.&lt;/p&gt;

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

&lt;p&gt;Gemma 4 E4B is used in the parts of the product that matter most:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default model path&lt;/strong&gt; for general local reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Victim agent&lt;/strong&gt; for realistic responses under scam pressure&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recorder agent&lt;/strong&gt; for analysis, scoring, and feedback generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes Gemma 4 part of the actual learning loop, not just a model sitting behind the UI. The system uses it to simulate behaviour, explain risk in plain language, and help users understand how scams work in real situations.&lt;/p&gt;

&lt;p&gt;The runtime configuration is simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GEMINI_ENABLED=false
AGENT_MODEL=gemma4:e4b
AGENT_MODEL_VICTIM=gemma4:e4b
AGENT_MODEL_RECORDER=gemma4:e4b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The point of making this configuration visible is reproducibility. If someone wants to understand how the system behaves, the model choice is not hidden in a prompt or a private script. It is explicit in the environment and in the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Model choice should match deployment
&lt;/h3&gt;

&lt;p&gt;A larger model is not automatically a better product choice. For anti-scam training, usability and local access matter just as much as model capability.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The model should be visible in the code
&lt;/h3&gt;

&lt;p&gt;The Gemma 4 choice is reflected in environment variables, backend defaults, Docker configuration, and tests. That makes the setup reproducible and easy to verify.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Useful AI systems need more than generation
&lt;/h3&gt;

&lt;p&gt;Anti-FraudX combines Gemma 4 with trust scoring, role-based simulation, local serving, and testable workflows. The value comes from the system design, not only from the base model.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Good local AI should serve a real purpose
&lt;/h3&gt;

&lt;p&gt;The most interesting thing about Gemma 4 here is not that it is powerful, but that it is practical. It can support a local training tool that helps users build safer habits before a scam reaches them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Scams are emotional, fast-moving, and highly localised. In Hong Kong, people are often targeted through WhatsApp messages, phishing SMS, fake banking pages, fake police calls, romance scams, investment scams, and QR code payment traps.&lt;/p&gt;

&lt;p&gt;Gemma 4 makes it possible to build tools that are not only smart, but also deployable, privacy-aware, and useful in real communities. That is why E4B was the right fit for Anti-FraudX.&lt;/p&gt;

&lt;p&gt;The broader lesson is that open local models can matter in everyday safety work. When a model is small enough to run locally but capable enough to reason clearly, it becomes useful in places where cloud AI is not the right answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Anti-FraudX needed a model that could support local inference, practical reasoning, and multimodal scam education without making deployment too heavy. Gemma 4 E4B fits that job well.&lt;/p&gt;

&lt;p&gt;It is not just a model choice for a benchmark. It is the model choice that makes the product usable.&lt;/p&gt;

&lt;p&gt;The project demonstrates how open local models can create meaningful safety impact: not by replacing human judgment, but by training it before the moment of risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/LamChingFung-2425/Anti-FraudX/tree/andy-v7(gemma-4.0)" rel="noopener noreferrer"&gt;https://github.com/LamChingFung-2425/Anti-FraudX/tree/andy-v7(gemma-4.0)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key implementation files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;backend/main.py&lt;/code&gt; — loads environment variables, applies startup checks, and serves the FastAPI app&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/config.py&lt;/code&gt; — centralizes the default model selection for each agent&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/api/chat_routes.py&lt;/code&gt; — routes chat requests through the configured local model&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/services/vision_service.py&lt;/code&gt; — shared local model setup for analysis paths&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/tests/test_environment.py&lt;/code&gt; — checks that the required Gemma 4 model is available&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/tests/test_ollama_direct.py&lt;/code&gt; — verifies the direct Ollama path against Gemma 4&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Demo video: &lt;a href="https://youtu.be/BLYm_VUpMUI" rel="noopener noreferrer"&gt;https://youtu.be/BLYm_VUpMUI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live demo: &lt;a href="https://anti-fraudx-frontend-5gznvtwxga-uc.a.run.app/" rel="noopener noreferrer"&gt;https://anti-fraudx-frontend-5gznvtwxga-uc.a.run.app/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
    </item>
    <item>
      <title>Anti-FraudX: Local Scam Defense Training with Gemma 4 E4B</title>
      <dc:creator>Andy Mak</dc:creator>
      <pubDate>Mon, 18 May 2026 14:07:17 +0000</pubDate>
      <link>https://dev.to/andymak/anti-fraudx-local-scam-defense-training-powered-by-gemma-4-e4b-1ik0</link>
      <guid>https://dev.to/andymak/anti-fraudx-local-scam-defense-training-powered-by-gemma-4-e4b-1ik0</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 I Built
&lt;/h2&gt;

&lt;p&gt;Anti-FraudX is a local anti-scam training platform for Hong Kong learners.&lt;/p&gt;

&lt;p&gt;Instead of only showing static scam warnings, it lets people practise scam detection through interactive AI conversations, RPG-style training, and automated multi-agent simulations. The idea is to turn anti-fraud education into something people can rehearse, not just read about.&lt;/p&gt;

&lt;p&gt;The project focuses on a very real local problem: scams are fast, emotional, and often happen through familiar channels such as WhatsApp messages, phishing SMS, fake banking pages, fake police calls, romance scams, investment scams, and QR code payment traps. Anti-FraudX turns those risks into practice scenarios so users can see how pressure, urgency, trust, and manipulation appear in real conversations.&lt;/p&gt;

&lt;p&gt;The system includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an RPG-style training mode for scenario-based learning&lt;/li&gt;
&lt;li&gt;a personal chat mode where users can test their reactions&lt;/li&gt;
&lt;li&gt;an auto simulation mode with scammer, victim, expert, and recorder agents&lt;/li&gt;
&lt;li&gt;local model serving through Ollama for privacy-sensitive use&lt;/li&gt;
&lt;li&gt;a workflow that can be deployed in schools, homes, and community centres&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to make anti-fraud education more practical, more repeatable, and more accessible for people who need it most.&lt;/p&gt;

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

&lt;p&gt;Demo video: &lt;a href="https://youtu.be/BLYm_VUpMUI" rel="noopener noreferrer"&gt;https://youtu.be/BLYm_VUpMUI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A strong walkthrough should show:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;a Hong Kong scam scenario, such as a suspicious message or fake payment request&lt;/li&gt;
&lt;li&gt;the user entering the RPG or chat mode&lt;/li&gt;
&lt;li&gt;the scammer applying pressure or urgency&lt;/li&gt;
&lt;li&gt;the victim and recorder agents responding through Gemma 4 E4B&lt;/li&gt;
&lt;li&gt;the expert agent explaining the red flags&lt;/li&gt;
&lt;li&gt;the final trust score, risk explanation, and learning takeaway&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Live demo: &lt;a href="https://anti-fraudx-frontend-5gznvtwxga-uc.a.run.app/" rel="noopener noreferrer"&gt;https://anti-fraudx-frontend-5gznvtwxga-uc.a.run.app/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/LamChingFung-2425/Anti-FraudX/tree/andy-v7(gemma-4.0)" rel="noopener noreferrer"&gt;https://github.com/LamChingFung-2425/Anti-FraudX/tree/andy-v7(gemma-4.0)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key implementation files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;backend/main.py&lt;/code&gt; — loads environment variables, applies startup checks, and serves the FastAPI app&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/config.py&lt;/code&gt; — centralizes model defaults for each agent role&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/api/chat_routes.py&lt;/code&gt; — routes chat requests through the configured local model&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/services/vision_service.py&lt;/code&gt; — shared model setup for analysis paths&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/tests/test_environment.py&lt;/code&gt; — checks that the required Gemma 4 model is available&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/tests/test_ollama_direct.py&lt;/code&gt; — verifies the direct Ollama path against Gemma 4&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Representative runtime configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GEMINI_ENABLED=false
AGENT_MODEL=gemma4:e4b
AGENT_MODEL_VICTIM=gemma4:e4b
AGENT_MODEL_RECORDER=gemma4:e4b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anti-FraudX keeps the older fine-tuned scammer and expert models for specialist behavior, while Gemma 4 E4B powers the default reasoning, victim simulation, recorder analysis, and the main local training loop.&lt;/p&gt;

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

&lt;p&gt;I used &lt;strong&gt;Gemma 4 E4B&lt;/strong&gt; as the main local reasoning model for Anti-FraudX.&lt;/p&gt;

&lt;p&gt;Gemma 4 powers the parts of the system where general reasoning and user-facing explanation matter most:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default model path&lt;/strong&gt; for general local reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Victim agent&lt;/strong&gt; for realistic responses under scam pressure&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recorder agent&lt;/strong&gt; for analysis, scoring, and feedback generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes Gemma 4 part of the actual learning loop, not just a model sitting behind the UI. The system uses it to simulate behaviour, explain risk in plain language, and help users understand how scams work in real situations.&lt;/p&gt;

&lt;p&gt;I chose &lt;strong&gt;E4B&lt;/strong&gt; because Anti-FraudX needs to run in realistic community environments. A larger model such as 31B Dense may offer stronger reasoning, but it also increases hardware cost and makes local deployment harder. Smaller models are easier to run, but they do not give enough depth for role-based simulation, trust scoring, and clear anti-fraud explanations.&lt;/p&gt;

&lt;p&gt;E4B is the best balance for this project because it is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;practical for local Ollama deployment&lt;/li&gt;
&lt;li&gt;strong enough for short multi-step reasoning&lt;/li&gt;
&lt;li&gt;suitable for privacy-sensitive scam training data&lt;/li&gt;
&lt;li&gt;useful for both conversation and moderation-style feedback&lt;/li&gt;
&lt;li&gt;accessible enough for schools, homes, and community workshops&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes Gemma 4 more than a chatbot model inside the project. It sits inside the training loop: users interact with scenarios, agents respond, the recorder explains what happened, and the system turns the interaction into a learning experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Model choice should match deployment
&lt;/h3&gt;

&lt;p&gt;A larger model is not automatically a better product choice. For anti-scam training, usability and local access matter just as much as model capability.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The model should be visible in the code
&lt;/h3&gt;

&lt;p&gt;The Gemma 4 choice is reflected in environment variables, backend defaults, Docker configuration, and tests. That makes the setup reproducible and easy to verify.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Useful AI systems need more than generation
&lt;/h3&gt;

&lt;p&gt;Anti-FraudX combines Gemma 4 with trust scoring, role-based simulation, local serving, and testable workflows. The value comes from the system design, not only from the base model.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Product value comes from context
&lt;/h3&gt;

&lt;p&gt;The model alone is not the story. The real value comes from using Gemma 4 in a product that helps people make safer decisions under pressure. That is what turns the model into something meaningful for everyday users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Scams are emotional, fast-moving, and highly localised. In Hong Kong, people are often targeted through WhatsApp messages, phishing SMS, fake banking pages, fake police calls, romance scams, investment scams, and QR code payment traps.&lt;/p&gt;

&lt;p&gt;Gemma 4 makes it possible to build tools that are not only smart, but also deployable, privacy-aware, and useful in real communities. That is why E4B was the right fit for Anti-FraudX.&lt;/p&gt;

&lt;p&gt;The larger point is that local AI is not only about convenience. It is about trust. When conversations, training data, and scam examples can stay local, the system becomes easier to use in real environments where privacy and access are just as important as model quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Anti-FraudX needed a model that could support local inference, practical reasoning, and multimodal scam education without making deployment too heavy. Gemma 4 E4B fits that job well.&lt;/p&gt;

&lt;p&gt;It is not just a model choice for a benchmark. It is the model choice that makes the product usable.&lt;/p&gt;

&lt;p&gt;The project shows that open local models can do more than answer questions. They can help people build resilience before the moment of risk, and that makes them especially valuable in safety and education settings.&lt;/p&gt;

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