<?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: Kazuto</title>
    <description>The latest articles on DEV Community by Kazuto (@katsu).</description>
    <link>https://dev.to/katsu</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F787243%2F5af14c18-f528-43b8-b781-542f2b1d44df.jpg</url>
      <title>DEV Community: Kazuto</title>
      <link>https://dev.to/katsu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/katsu"/>
    <language>en</language>
    <item>
      <title>I Fine-Tuned Gemma 4 to Read Receipts. #Hactoberfest26</title>
      <dc:creator>Kazuto</dc:creator>
      <pubDate>Sun, 25 Oct 2026 04:04:32 +0000</pubDate>
      <link>https://dev.to/katsu/i-fine-tuned-gemma-4-to-read-receipts-hactoberfest26-56ic</link>
      <guid>https://dev.to/katsu/i-fine-tuned-gemma-4-to-read-receipts-hactoberfest26-56ic</guid>
      <description>&lt;p&gt;The project my team and I worked on during the MLH Hacktoberfest Open-Source AI Hack Day on October 24, 2026 was &lt;strong&gt;ReceiptLens&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We were a team of first-year engineering students, and we decided to take on one of the advanced challenges: fine-tuning Google's Gemma 4 model for receipt information extraction.&lt;/p&gt;

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

&lt;p&gt;ReceiptLens is an AI-powered receipt extraction and expense analysis application.&lt;/p&gt;

&lt;p&gt;The idea is straightforward. Instead of manually entering the information printed on a receipt, you upload an image and let the model extract it.&lt;/p&gt;

&lt;p&gt;Our original task focused on four fields: merchant name, date, address, and total amount.&lt;/p&gt;

&lt;p&gt;We used Google's Gemma 4 E2B vision-language model, fine-tuned with LoRA using Unsloth, to convert receipt images into structured JSON.&lt;/p&gt;

&lt;p&gt;But as we continued building, we started thinking about what happens after the information is extracted.&lt;/p&gt;

&lt;p&gt;An extracted total isn't particularly useful if it just sits inside a JSON object. And what happens when the model makes a mistake?&lt;/p&gt;

&lt;p&gt;That led us to extend ReceiptLens beyond the original challenge.&lt;/p&gt;

&lt;p&gt;We added support for extracting two more optional fields — the receipt or transaction number and merchant phone number — along with editable results, CSV/JSON exports, and a spending-analysis dashboard.&lt;/p&gt;

&lt;p&gt;The expanded application is designed around this workflow:&lt;/p&gt;

&lt;p&gt;Upload → Extract → Review → Correct → Save → Analyze&lt;/p&gt;

&lt;p&gt;The idea is to turn a receipt extraction experiment into the foundation of a practical expense-management tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does the output look like?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our expanded data structure contains six fields:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
  "company": "EXAMPLE STORE",&lt;br&gt;
  "date": "2026-10-24",&lt;br&gt;
  "address": "12 MAIN STREET",&lt;br&gt;
  "total": "245.50",&lt;br&gt;
  "receipt_number": "TXN-10482",&lt;br&gt;
  "phone_number": "012-3456789"&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is an illustrative example of the expanded schema, not an actual model prediction.&lt;/p&gt;

&lt;p&gt;There's an important distinction here.&lt;/p&gt;

&lt;p&gt;Our fine-tuned model was trained and evaluated on the original four fields. The additional receipt and phone numbers are extracted through a separate prompted image-inference pass. Since the SROIE dataset doesn't provide labels for those additional fields, we haven't measured their extraction accuracy.&lt;/p&gt;

&lt;p&gt;That means users still need to verify the output — which is exactly why we added manual correction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How we built it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I wanted ReceiptLens to be more than an API wrapper, so we organized it around an actual machine learning workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The dataset&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We used the ICDAR 2019 SROIE dataset, available on Hugging Face. It contains scanned receipts along with annotated information for company, date, address, and total.&lt;/p&gt;

&lt;p&gt;The dataset version we used provides 626 training receipts and 361 test receipts. For our initial experiment, we configured 160 training examples, 20 validation examples, and a fixed 30-receipt evaluation sample.&lt;/p&gt;
&lt;h2&gt;
  
  
  Demo
&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/KAZUTO0" rel="noopener noreferrer"&gt;
        KAZUTO0
      &lt;/a&gt; / &lt;a href="https://github.com/KAZUTO0/ReceiptLens" rel="noopener noreferrer"&gt;
        ReceiptLens
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ReceiptLens directly conditions a vision-language model on both the receipt image and a text instruction. It learns to generate a structured response instead of first requiring a separate OCR engine.
    &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;ReceiptLens — Receipt Information Extraction with Gemma 4&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Turning receipt images into structured data with an open-weight vision-language model and LoRA fine-tuning.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;ReceiptLens is a Python-based experiment and interactive demo that extracts &lt;strong&gt;merchant name, date, address, total amount, receipt/transaction number, and contact number&lt;/strong&gt; from scanned receipts. It fine-tunes &lt;strong&gt;Google Gemma 4 E2B&lt;/strong&gt; using &lt;strong&gt;Unsloth + LoRA&lt;/strong&gt;, then compares the adapted model with the original model on the same receipt images.&lt;/p&gt;
&lt;p&gt;Built for &lt;strong&gt;HacktoberFest Hack Day — Open-Source AI, Theme 3B: Receipt Information Extraction&lt;/strong&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Experimental project, not production-ready OCR.&lt;/strong&gt; Results below are from a 30-receipt evaluation shared from a Colab run. On a 30-receipt test sample, complete extraction accuracy improved from 20% to 30%, with improvements in merchant, date, and total extraction.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tech Stack:&lt;/strong&gt; Python, Gemma 4 E2B, Unsloth, LoRA, Hugging Face, PyTorch, Google Colab, and Gradio&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Key Features:&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;AI-powered receipt information extraction&lt;/li&gt;
&lt;li&gt;Fine-tuned multimodal vision-language model&lt;/li&gt;
&lt;li&gt;Editable extracted…&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/KAZUTO0/ReceiptLens" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Partner Technologies
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gemma 4 E2B&lt;/strong&gt; is an open-weight vision-language model. It can process an image alongside a text instruction, which makes it suitable for extracting information directly from receipt photographs.&lt;/p&gt;

&lt;p&gt;Full fine-tuning would have been expensive and difficult with our available computing resources. So we used &lt;strong&gt;LoRA&lt;/strong&gt; — Low-Rank Adaptation. Rather than updating every weight in the original model, LoRA trains small additional adapter weights.&lt;/p&gt;

&lt;p&gt;We used &lt;strong&gt;Unsloth&lt;/strong&gt; to manage the vision fine-tuning workflow, with 4-bit model loading to reduce memory requirements.&lt;/p&gt;

&lt;p&gt;Our project configuration started with LoRA rank 8, a learning rate of 0.0002, and 40 training steps.&lt;/p&gt;

&lt;p&gt;We also kept preprocessing and evaluation separate from the training code so we could compare the original and fine-tuned models under consistent conditions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hugging Face&lt;/strong&gt; provided the receipt dataset and access to the open-weight model ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Colab&lt;/strong&gt; and &lt;strong&gt;PyTorch&lt;/strong&gt; provided the environment for GPU-based inference and training&lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;Gradio&lt;/strong&gt; helped us build a usable Python interface without needing a separate frontend framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hackathon Experience
&lt;/h2&gt;

&lt;p&gt;This was a particularly interesting experience because we were all first-year engineering students, and most of us were still relatively new to practical AI development.&lt;/p&gt;

&lt;p&gt;We chose an advanced problem despite that.&lt;/p&gt;

&lt;p&gt;Of course, things didn't work perfectly from beginning to end.&lt;/p&gt;

&lt;p&gt;There were dependency warnings, GPU memory considerations, and the occasional frustrating Colab error.&lt;/p&gt;

&lt;p&gt;At one point, Colab reported that CUDA wasn't available. At another, our application couldn't find the expected project directory.&lt;/p&gt;

&lt;p&gt;It was a reminder that building an AI application involves much more than getting a model to respond.&lt;/p&gt;

&lt;p&gt;You have to understand your environment, manage dependencies, keep track of files and checkpoints, test the actual output, and make sure everything still works when you demonstrate it.&lt;/p&gt;

&lt;p&gt;I also learned to be more careful about how we describe model performance.&lt;/p&gt;

&lt;p&gt;An improvement from 20% to 30% sounds impressive as a relative percentage. But when you say that it means going from six correct receipts to nine, it becomes easier to understand both the improvement and how much work remains.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/KAZUTO0/ReceiptLens" rel="noopener noreferrer"&gt;https://github.com/KAZUTO0/ReceiptLens&lt;/a&gt;&lt;br&gt;
Event: MLH Hacktoberfest Open-Source AI Hack Day, October 24, 2026&lt;br&gt;
Team: PARADOX&lt;br&gt;
Name: Sameer Kumar Karn&lt;/p&gt;

</description>
      <category>mlhacks</category>
      <category>devchallenge</category>
      <category>hackathon</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
