Llama-based code models, trained on Kaggle T4. Ready-to-run GGUF weights below.
GitHub release: https://github.com/mrsandipmandal/alfa-code/releases/tag/v0.0.2 HuggingFace: https://huggingface.co/mrsandip/Alfa-Code/tree/main/gguf
| Model | Q8_0 (best) | Q4_0 (small) | Context |
|---|---|---|---|
| tiny-50M (56M) | tiny-50M-q8.gguf (60 MB) | tiny-50M-q4.gguf (32 MB) | 2048 |
| base-1B (1.1B) | base-1B-q8.gguf (1.19 GB) | base-1B-q4.gguf (632 MB) | 2048 |
| code-100k (1.39B) | — |
code-100k files deprecated (broken tokenizer build, model dropped). Current line: tiny-50M + base-1B (fixed build: faithful HF-identical tokenization, embedded chat template). Next:
alfa-code-1.2(this branch).
code-100k is an early checkpoint (1 epoch, eval loss ~3.1) — loads and runs, but output quality is rough. More training coming.
llama-server -m base-1B-q4.gguf -c 2048
llama-server -m tiny-50M-q8.gguf -c 2048
Tokenizer (32k BPE): tokenizers/alfa-32k.json — also in the v0.0.2 release assets.
python scripts/download_data.py --dataset code_small_test --max-rows 500
Output: data/processed/train.jsonl {modality,prompt,think,answer}
python scripts/train_tokenizer.py -> tokenizers/alfa-32k.json (32000 vocab, ~419KB)
pip install torch --index-url https://download.pytorch.org/whl/cu121
python scripts/train.py -> outputs/tiny-50M
Scale-up (Colab T4, ~2-4h): 5000+ rows, chat tuning, 3-5 epochs:
python scripts/download_data.py --dataset multimodal_mix --max-rows 5000 --overwrite
python scripts/download_data.py --dataset chat_qa --max-rows 2000 (appends Q&A rows)
python scripts/train_hf.py --data data/processed/train.jsonl --out /content/outputs/tiny-50M --epochs 3 --config configs/tiny-50M.yaml --max-seq-len 2048 --batch-size 1
1B model (16GB+ GPU only, not RTX 3050 4GB): same commands with --config configs/base-1B.yaml --out /content/outputs/base-1B (1.12B params, ~2.2GB fp16).
pip install gguf safetensors torch transformers
python scripts/convert_to_gguf.py --ckpt outputs/tiny-50M --quant Q8_0 (Q8_0 ~55MB, Q4_0 ~32MB, F16 ~105MB)
K-quants (Q4_K_M) need standard dims + llama-quantize binary — not offered (intermediate 1376).
Run local (RTX 3050 4GB):
llama-server -m outputs/tiny-50M.gguf -c 2048 or Ollama Modelfile (FROM ./outputs/tiny-50M.gguf).
python app/ui.py -> http://127.0.0.1:7860
hf upload mrsandip/Alfa-Code . . --exclude __pycache__ --exclude .venv --commit-message "Update"
outputs/base-1B/checkpoint-375/model.safetensors 4.2 GiBoutputs/base-1B/model.safetensors 4.2 GiBoutputs/base-1B/checkpoint-375/optimizer.pt 2.5 GiBoutputs/tiny-50M/checkpoint-32/optimizer.pt 427 MiBoutputs/tiny-50M/checkpoint-94/optimizer.pt 427 MiBoutputs/tiny-50M/checkpoint-1003/optimizer.pt 427 MiBoutputs/tiny-50M/checkpoint-1003/model.safetensors 214 MiBoutputs/tiny-50M/checkpoint-189/model.safetensors 214 MiBoutputs/tiny-50M/checkpoint-32/model.safetensors 214 MiBoutputs/tiny-50M/checkpoint-94/model.safetensors 214 MiBoutputs/tiny-50M/model.safetensors 214 MiBoutputs/tiny-50M/checkpoint-189/optimizer.pt 632.4 KiBoutputs/base-1B/checkpoint-375/rng_state.pth 14.3 KiBoutputs/tiny-50M/checkpoint-189/rng_state.pth 14.3 KiBoutputs/tiny-50M/checkpoint-32/rng_state.pth 14.3 KiBoutputs/tiny-50M/checkpoint-94/rng_state.pth 14.3 KiBoutputs/tiny-50M/checkpoint-1003/rng_state.pth 14.1 KiBoutputs/base-1B/checkpoint-375/scheduler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-1003/scheduler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-189/scheduler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-32/scheduler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-94/scheduler.pt 1.4 KiBoutputs/base-1B/checkpoint-375/scaler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-32/scaler.pt 1.4 KiBoutputs/tiny-50M/checkpoint-94/scaler.pt 1.4 KiB