Skip to content

A blazing-fast toolkit to design, fine-tune, and deploy Small Language Models with production-grade pipelines, efficiency, and control.

License

Notifications You must be signed in to change notification settings

eshanized/SLMGen

πŸš€ SLMGEN - Small Language Model Generator

License: MIT CI

SLMGEN Landing Page

Fine-tune SLMs. 2x faster. For free.

Live Demo Β· API Docs Β· User Guide


✨ What is SLMGEN?

SLMGEN is a production-ready web application that automates SLM fine-tuning. Upload your JSONL dataset and receive ready-to-run Google Colab notebooks with Unsloth + LoRA optimization.

Your Data β†’ Best Model β†’ Matched. One notebook. Zero setup. Ready to train.


🎯 Core Features

Feature Description
πŸ“€ Smart Upload Drag-and-drop JSONL with instant validation (min 50 examples)
πŸ“Š Quality Scoring Duplicate detection, consistency checks, 0-100% quality score
🧠 11 Model Support Phi-4, Llama 3.2, Gemma 2, Qwen 2.5, Mistral 7B + more
🎯 100-Point Matching Task fit (50pts) + Deploy target (30pts) + Data traits (20pts)
πŸ““ Self-Contained Notebooks Dataset embedded as base64 - no file uploads needed
☁️ 6 Deploy Targets Cloud, Server, Desktop, Edge, Mobile, Browser

🧠 Advanced Intelligence Features

Dataset Intelligence Layer

  • Personality Detection - Infers tone, verbosity, technicality, strictness
  • Hallucination Risk - Scores likelihood of model fabrication (0-1)
  • Confidence Score - Measures training reliability via coverage/diversity

Prompt & Behavior Engine

  • Behavior Composer - Generate system prompts from trait sliders
  • Prompt Linter - Detects contradictions, redundancy, ambiguity
  • Prompt Diff - Semantic comparison between prompts

Model Transparency

  • "Why This Model?" - Strength/weakness deep dive per model
  • Failure Previews - Synthetic failure cases before training
  • Model Card Generator - Auto-generated deployment README

πŸ› οΈ Tech Stack

Component Technology
Backend Python 3.11, FastAPI, Pydantic v2
Frontend Next.js 16, TypeScript, React 19
Auth Supabase (OAuth + Email)
Training Unsloth + LoRA on Google Colab (Free T4)
Deployment Vercel (Frontend) + Render (Backend)

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Supabase project

Backend

cd libslmgen
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env  # Configure Supabase keys
uvicorn app.main:app --reload --port 8000

Frontend

cd slmgenui
npm install
cp .env.example .env.local  # Configure API URL + Supabase
npm run dev

Open http://localhost:3000 πŸŽ‰


πŸ“ Project Structure

slmgen/
β”œβ”€β”€ libslmgen/                  # Python Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py             # FastAPI app
β”‚   β”‚   β”œβ”€β”€ routers/            # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ upload.py       # Dataset upload
β”‚   β”‚   β”‚   β”œβ”€β”€ analyze.py      # Dataset analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ recommend.py    # Model recommendation
β”‚   β”‚   β”‚   β”œβ”€β”€ generate.py     # Notebook generation
β”‚   β”‚   β”‚   β”œβ”€β”€ advanced.py     # Intelligence features
β”‚   β”‚   β”‚   └── jobs.py         # Job history
β”‚   β”‚   └── session.py          # Thread-safe sessions
β”‚   └── core/
β”‚       β”œβ”€β”€ ingest.py           # JSONL parsing
β”‚       β”œβ”€β”€ quality.py          # Quality scoring
β”‚       β”œβ”€β”€ analyzer.py         # Dataset analysis
β”‚       β”œβ”€β”€ recommender.py      # 100-point scoring engine
β”‚       β”œβ”€β”€ notebook.py         # Jupyter generator
β”‚       β”œβ”€β”€ personality.py      # Personality detection
β”‚       β”œβ”€β”€ risk.py             # Hallucination risk
β”‚       β”œβ”€β”€ confidence.py       # Training confidence
β”‚       β”œβ”€β”€ behavior.py         # Behavior composer
β”‚       β”œβ”€β”€ prompt_linter.py    # Prompt linting
β”‚       └── model_card.py       # README generator
β”œβ”€β”€ slmgenui/                   # Next.js Frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ app/                # Pages (dashboard, login, signup)
β”‚       β”œβ”€β”€ components/         # UI components
β”‚       β”œβ”€β”€ lib/                # API client & types
β”‚       └── hooks/              # React hooks (with persistence)
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ API.md                  # API reference
β”‚   β”œβ”€β”€ USER_GUIDE.md           # User guide
β”‚   └── DEPLOY.md               # Deployment guide
└── supabase/
    └── schema.sql              # Database schema

πŸ“Š Supported Models

Model Size Context Best For Gated
Phi-4 Mini 3.8B 16K Classification, Extraction ❌
Llama 3.2 1B/3B 8K Q&A, Conversations βœ…
Gemma 2 2B 8K Edge, Mobile βœ…
Qwen 2.5 0.5B-3B 32K Multilingual, JSON ❌
Mistral 7B 7B 32K Generation, Creative ❌
TinyLlama 1.1B 2K Ultra-lightweight ❌
SmolLM2 135M-1.7B 8K Small devices ❌

πŸ“¦ Dataset Format

Each line in your JSONL file should be a conversation:

{"messages": [{"role": "user", "content": "Hello!"}, {"role": "assistant", "content": "Hi there!"}]}
{"messages": [{"role": "system", "content": "You are helpful."}, {"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}

Requirements:

  • βœ… Minimum 50 examples
  • βœ… At least one user and one assistant message
  • βœ… UTF-8 encoding
  • βœ… Valid JSON per line

🌐 Deployment

Vercel (Frontend)

npx vercel --prod

Render (Backend)

Uses render.yaml blueprint for auto-deployment.

See DEPLOY.md for full instructions.


βš™οΈ Environment Variables

# Backend (.env)
ALLOWED_ORIGINS=https://slmgen.vercel.app,http://localhost:3000
UPLOAD_DIR=/tmp/uploads
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_key
JWT_SECRET=your_jwt_secret

# Frontend (.env.local)
NEXT_PUBLIC_API_URL=https://slmgen-api.onrender.com
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key

πŸ“„ License

MIT License - See LICENSE


πŸ‘€ Author

Eshan Roy


⭐ Star this repo if SLMGEN helped you fine-tune faster!

About

A blazing-fast toolkit to design, fine-tune, and deploy Small Language Models with production-grade pipelines, efficiency, and control.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks