PersonalForge v2

March 21, 2026 · View on GitHub

PersonalForge v2

Fine-tune any LLM on your own data — free, offline, no coding

License: MIT Python 3.10+ Cost: $0.00 No Coding Offline

Upload files → Stream datasets → Clean data → Pick any model → Train on free Colab → Download GGUF → Chat offline forever

No cloud. No subscriptions. No data sent anywhere. Everything stays on your machine.

GitHub · LinkedIn · LM Studio · Ollama


What is PersonalForge?

Most "chat with your docs" tools search your files at runtime using RAG. PersonalForge goes deeper — it bakes your knowledge directly into a model's weights through fine-tuning. The GGUF file that comes out is your knowledge. No internet needed ever again.

Your Data (files, HuggingFace datasets, web search, Google Drive...)

           17-technique data cleaning pipeline

        Auto-generate Q&A pairs with thinking chains

     Fine-tune on FREE Google Colab T4 GPU
     SFT → DPO → BGE-M3 RAG → Auto evaluation

        Download GGUF (Q4_K_M, ~2-4GB)

        Chat offline forever — LM Studio or Ollama

Quick Start

# 1. Clone
git clone https://github.com/yagyeshVyas/personalforge
cd personalforge

# 2. Install
pip install -r requirements.txt

# 3. Run
python run.py

Browser opens at http://localhost:5000


Features

Data Sources — 6 ways to add training data

SourceWhat it does
File UploadPDF, Word, Excel, CSV, TXT, Python, JS, Java, C++, Jupyter
HuggingFace Streaming26 pre-verified free datasets, 1M-2M samples, no full download
Web SearchWikipedia, arXiv, Stack Overflow, GitHub READMEs, Project Gutenberg
URLsAny webpage, Wikipedia article, arXiv paper, GitHub repo
Cloud & RemoteGoogle Drive, Dropbox, AWS S3, GitHub Gist, Pastebin, JSON APIs
Manual HF DatasetPaste any owner/dataset-name from HuggingFace

HuggingFace Dataset Registry — 26 verified datasets

CategoryTop Datasets
Codingbigcode/starcoderdata, nampdn-ai/tiny-codes, sahil2801/CodeAlpaca-20k
ChatHuggingFaceH4/ultrachat_200k, Open-Orca/OpenOrca, tatsu-lab/alpaca
Reasoningnvidia/OpenMathInstruct-2, microsoft/orca-math-word-problems-200k
GeneralHuggingFaceFW/fineweb, wikimedia/wikipedia (10 languages)
Medicalmedalpaca/medical_meadow_medqa, medalpaca/medical_meadow_wikidoc
Legalpile-of-law/pile-of-law
Scienceallenai/peS2o, ccdv/arxiv-summarization
FinanceFinGPT/fingpt-sentiment-train, gbharti/finance-alpaca
MultilingualCohereForAI/aya_dataset (65 languages)

Universal Model Support

Search or paste any HuggingFace model ID — auto-detects:

  • Architecture (Llama, Qwen, Mistral, Phi, Gemma, DeepSeek, Falcon...)
  • LoRA target modules
  • Chat template format
  • Optimal training config (LoRA rank, learning rate, batch size)

58 popular models pre-configured — or paste any model ID directly:

unsloth/Qwen3.5-4B
unsloth/Qwen2.5-Coder-7B-Instruct
unsloth/Llama-3.2-3B-Instruct
unsloth/DeepSeek-R1-Distill-Qwen-7B
google/gemma-2-9b-it
microsoft/phi-4
... and any other public HuggingFace model

17-Technique Data Cleaning Pipeline

#TechniqueWhat it removes
1Encoding fixPDF conversion artifacts (’')
2Unicode normalizeZero-width chars, special spaces
3PII removalHF tokens, AWS keys, OpenAI keys, GitHub tokens
4Page numbersPage 42, - 42 -, standalone numbers
5Headers/footersISBN, "Table of Contents", "Printed in..."
6WatermarksCONFIDENTIAL, DRAFT, DO NOT DISTRIBUTE
7BoilerplateCopyright lines, "All rights reserved"
8Broken sentencesPDF line breaks (sen-\ntencesentence)
9Table noise`
10Whitespace3+ newlines, trailing spaces, tabs
11Repeated chars==========, ---------- separators
12Code cleaningAuto-generated markers, minified lines
13URL removalRaw URLs in non-code text
14Quality gateRejects chunks under 80 chars or 15 words
15Exact dedupMD5 hash deduplication
16Near dedup3-gram MinHash — removes 80%+ similar chunks
17Sentence dedupCross-document sentence deduplication

3 Training Modes

ModeBest ForHow It Thinks
Developer / CoderCode, technical docsStep-by-step solutions, code examples, best practices
Deep ThinkerResearch, analysisMulti-angle reasoning, connects ideas across documents
Honest / FactualManuals, referenceCites sources, admits gaps, never guesses

Every mode adds <think>...</think> reasoning chains before every answer.


Fine-Tuning Pipeline

Advanced techniques used in every training run

TechniqueDetails
rsLoRARank-stabilized LoRA — more stable than standard LoRA
NEFTuneNoise embedding fine-tuning (α=5-10) — better generalization
Gradient checkpointing60% less VRAM via Unsloth
8-bit AdamWQuantized optimizer — less VRAM
Cosine LR + warmupBetter convergence than linear schedule
Gradient clippingPrevents loss spikes
Early stoppingAuto-loads best checkpoint
DPO alignmentTeaches preferred vs rejected responses
Curriculum learningEasy → hard sorting
Mixed precisionBF16 on Ampere, FP16 on older GPUs
4-bit quantizationFits 7B on free T4 GPU
BGE-M3 RAGBest free embeddings + ChromaDB vector index
Auto evaluationAccuracy score before download

LoRA Config by Model Size

$ \text{Small} (1-2\text{B}): \text{r}=16, \text{alpha}=16, \text{lr}=3\text{e}-4, \text{batch}=4 \times 2=8 \text{Medium} (3-4\text{B}): \text{r}=16, \text{alpha}=32, \text{lr}=2\text{e}-4, \text{batch}=2 \times 4=8 \text{Large} (7\text{B}+): \text{r}=8, \text{alpha}=16, \text{lr}=1\text{e}-4, \text{batch}=1 \times 8=8 $

For best small model performance (3-4B punching above weight)

neftune_noise_alpha = 10   # Higher than default 5
r                   = 32   # Double rank for small models
lora_alpha          = 64   # 2x rank

Sample Targets

SizeSamplesQualityTraining time
Quick test10KBasic~15 min
Small50KDecent~25 min
Recommended200KGood~45 min
Large500KGreat~70 min
Production1MExcellent~90 min*
Massive2MBest~90 min*

*Colab T4 caps at ~100K pairs per session. For 1M+ samples, generate in batches.


Supported Models

Best model per use case

Use CaseRecommendedWhy
Codingunsloth/Qwen2.5-Coder-7B-InstructPurpose-built for code
Coding (small)unsloth/Qwen3.5-4BBest under 4B, built-in thinking
Reasoningunsloth/DeepSeek-R1-Distill-Qwen-7BBuilt-in chain-of-thought
Chatunsloth/Llama-3.2-3B-InstructMost natural conversations
Generalunsloth/Qwen2.5-7B-InstructBest all-around
Medicalunsloth/Phi-3-mini-4k-instructBest factual accuracy
Legalunsloth/mistral-7b-instruct-v0.3Best for long documents
Multilingualunsloth/Qwen2.5-3B-InstructStrongest multilingual

Running on Google Colab (Free)

After generating your notebook in PersonalForge:

1. File → Upload notebook → build_my_ai.ipynb
2. Runtime → Change runtime type → T4 GPU → Save  ⚠️ DO THIS FIRST
3. Run Cell 1 → upload training_pairs.jsonl when asked
4. Runtime → Run All
5. Watch eval_loss go down — auto-stops at best checkpoint
6. Last cell downloads your .gguf automatically

Understanding loss numbers:

eval_loss > 2.0  →  just started
eval_loss ~ 1.5  →  learning
eval_loss ~ 1.0  →  good model
eval_loss < 0.7  →  excellent model
eval_loss rising →  overfitting — training correctly auto-stopped

Using Your GGUF

LM Studio (easiest)

Download from lmstudio.ai
File → Load Model → select .gguf → Chat

Ollama

ollama run /path/to/your-model.gguf

Share on HuggingFace (optional)

huggingface.co/new → upload .gguf

Project Structure

personalforge/
├── server.py                    # Flask web server
├── run.py                       # Launch script
├── requirements.txt
├── templates/
│   └── index.html               # Full UI (single page app)
├── core/
│   ├── hw_scanner.py            # Hardware detection (RAM/GPU/disk)
│   ├── file_loader.py           # Multi-format file loader
│   ├── data_cleaner.py          # 17-technique cleaning pipeline
│   ├── hf_streamer.py           # HuggingFace dataset streaming
│   ├── hf_registry.py           # 26 verified dataset configs
│   ├── url_fetcher.py           # URL/webpage fetcher
│   ├── remote_fetcher.py        # Google Drive/Dropbox/S3
│   ├── web_collector.py         # Web search data collector
│   ├── pair_generator.py        # Q&A pair generation (3 modes)
│   ├── model_resolver.py        # Universal model config resolver
│   └── model_matcher.py         # Hardware-aware model matching
├── colab/
│   └── notebook_generator.py    # Colab notebook generator
├── data/                        # Uploaded files (gitignored)
└── output/                      # Generated files (gitignored)
    ├── training_pairs.jsonl
    └── build_my_ai.ipynb

Free Stack

ToolPurpose
Unsloth2x faster training, 60% less VRAM
Google ColabFree T4 GPU (~12 hrs/day)
LM StudioRun GGUF locally (desktop)
OllamaRun GGUF locally (terminal)
ChromaDBLocal vector database for RAG
FlaskWeb UI framework
DuckDuckGo APIFree web search, no API key
Project GutenbergFree books API

Total cost: $0.00 — forever.


Honest Limitations

  • Fine-tuning is not training from scratch — base model weights are preserved
  • You need 200K+ pairs for good results — fewer gives weaker output
  • Free Colab T4 handles ~100K pairs per session comfortably
  • 7B models are tight on free T4 (14GB VRAM needed) — use 4-bit
  • RAG vs fine-tuned knowledge conflict is not fully resolved
  • Web collection is slower than HF dataset streaming for large volumes

Author

Yagyesh Vyas


License

MIT — free forever. Use it, modify it, share it.


Built with care · Free forever · MIT License

⭐ Star this repo · 🐛 Report Bug · 💡 Request Feature

Powered by Unsloth · Google Colab · llama.cpp