DEV Community

UMANG ARORA
UMANG ARORA

Posted on

Building a Local Chat Summarizer with Open-Weight AI HF3 Week 3

Building a Local Chat Summarizer with Open-Weight AI for Hacktoberfest Week 3

International Sloth Day special: I moved at sloth's pace and built something that conserves energy — my laptop's, and my time's.

What I Built

A local chat summarizer that reads your group chat overnight and outputs a 2-line morning summary. Built entirely with open-weight AI — no API keys, no server, no data leaving your machine.

Tech stack: Python + transformers library + Facebook OPT-350M (350 million parameter model, freely available open weights).

How it works:

  1. Read the last N messages from your group chat export (JSON format)
  2. Send them through an open-weight local model running via transformers
  3. Get a 2-line summary generated entirely on your laptop

Why Open Matters (The Core of This Build)

Closed AI Approach Open-Weight Approach
Data privacy: Messages uploaded to server you don't control Privacy: All messages stay on your laptop, never transmitted
Cost: $0.02-$0.10 per 1K tokens → $30-50/month for heavy users Cost: Zero marginal cost after one-time setup. Model runs locally forever
Flexibility: Locked to vendor's model, can't swap Flexibility: Can switch between any open-weight model (Llama, Mistral, etc.)
Reliability: Doesn't work during internet outages Reliability: Works offline — your automation keeps running
Ownership: You don't own the model or its outputs Ownership: You control the model, its weights, and its behavior

The Key Winning Sentence for This Challenge

"Because it runs entirely on my laptop with no internet connection, my personal group messages never leave my machine. I also save $30/month in API fees and can swap models whenever I want."

This sentence directly answers the Hacktoverst Week 3 prompt's core requirement: explaining where your open-based approach worked better than a closed one.

How You Can Try It

# 1. Install dependencies
pip install transformers torch

# 2. Run with your chat export
python summarizer.py group_chat.json

# 3. Output: 2-line morning summary appears in your terminal
Enter fullscreen mode Exit fullscreen mode

Need a chat export? Most group chat apps (WhatsApp, Discord, iMessage) can export conversation history as JSON. Look for "Export Chat" in your app's settings.

Open-Source Components

  • Model: facebook/opt-350m — 350M parameter model, fully open weights, research-friendly license
  • Framework: transformers by Hugging Face — industry-standard library for running ML models
  • Language: Python — most popular language for AI/ML prototyping
  • Inference: On-device via pipeline() API — no cloud required

Demo

Terminal output shows 2-line summary with "[open-source AI benefit]" note below.

Saved agent session with DevRelay: session will be embedded.

Try It Yourself

The full source is in summarizer.py. Clone, run, and see your open-weight AI in action:

git clone <your-repo>
cd hacktoberfest-week3
python summarizer.py group_chat.json
Enter fullscreen mode Exit fullscreen mode

Submitted to Hacktoverst Open-Source AI Challenge: Week 3

This project demonstrates how open-weight AI enables privacy, cost savings, and flexibility that closed APIs simply can't match. The open pieces are what make this project work — from the model weights to the framework to the entirely local deployment.

🏆 Submitted for: Hacktoverst Open-Source AI Challenge: Week 3 "Slow and Steady" theme

🎯 Target badge: Hacktoverst Challenge Completion Badge (and potentially Winner Badge in a partner category)

Top comments (0)