Publish Velqora-40M-Instruct (safetensors, best/latest checkpoints, tokenizer, and inference script)
08bf9cd verified |
Download README.md from Maxilicious20/Velqora-40M-Instruct: direct link, hf CLI and curl.
- Browser
- Download file 4.89 kB
-
https://huggingface.co/Maxilicious20/Velqora-40M-Instruct/resolve/main/README.md
- Command line
-
hf download hf://Maxilicious20/Velqora-40M-Instruct/README.md
-
curl -L -o README.md https://huggingface.co/Maxilicious20/Velqora-40M-Instruct/resolve/main/README.md
4.89 kB
| language: | |
| - en | |
| pipeline_tag: text-generation | |
| datasets: | |
| - HuggingFaceTB/cosmopedia-100k | |
| - HuggingFaceFW/fineweb-edu | |
| - roneneldan/TinyStories | |
| - HuggingFaceTB/smoltalk | |
| - HuggingFaceH4/ultrachat_200k | |
| - HuggingFaceH4/no_robots | |
| tags: | |
| - velqora | |
| - from-scratch | |
| - causal-language-model | |
| - custom-architecture | |
| - pytorch | |
| - grouped-query-attention | |
| - qk-norm | |
| - value-residuals | |
| - research | |
| license: apache-2.0 | |
| # Velqora-40M-Instruct | |
| **Velqora-40M-Instruct** is a **41,957,387-parameter** (~41.96M), English-first, decoder-only instruction-tuned conversational language model **trained from random initialization** on a single **NVIDIA GeForce RTX 4060 (8 GB)** under Windows 11. | |
| **GGUF companion:** [Maxilicious20/Velqora-40M-Instruct-GGUF](https://huggingface.co/Maxilicious20/Velqora-40M-Instruct-GGUF) | |
| ## Model overview | |
| | Property | Value | | |
| |---|---| | |
| | Developer | [Maxilicious20](https://huggingface.co/Maxilicious20) | | |
| | Parameters | **41,957,387** (~41.96M) | | |
| | Model type | Decoder-only causal language model (Instruct / SFT) | | |
| | Training origin | **From scratch**, no pretrained foundation weights | | |
| | Primary language | **English** | | |
| | Transformer layers | 12 | | |
| | Hidden size | 512 | | |
| | Attention | 8 query heads / 4 key-value heads (GQA) + QK-Norm + Layer-0 Value Residuals | | |
| | Feed-forward dimension | 1,536, SwiGLU | | |
| | Position embeddings | RoPE, base θ = 30,000 | | |
| | Normalization | RMSNorm | | |
| | Token embeddings | Tied input/output embeddings | | |
| | Tokenizer | Custom 8,192-token byte-level BPE | | |
| | Maximum context window | **2,048 tokens** | | |
| | Best validation loss | `1.5638` | | |
| | Implementation | Custom PyTorch (`scaled_dot_product_attention`, `bfloat16`) | | |
| | Training hardware | Windows 11, NVIDIA RTX 4060 8 GB | | |
| | License | **Apache-2.0** | | |
| > **Implementation note:** This release uses a custom PyTorch architecture (`velqora/model.py`), custom tokenizer (`tokenizer.json`), and tied embeddings rather than `AutoModelForCausalLM`. | |
| ## Training | |
| This checkpoint was trained from random initialization in two stages on a single NVIDIA RTX 4060 (8 GB): | |
| 1. **Curriculum Pretraining:** Next-token prediction across `HuggingFaceTB/cosmopedia-100k`, `HuggingFaceFW/fineweb-edu`, and `roneneldan/TinyStories`, scaling context length progressively up to the full maximum window. | |
| 2. **Supervised Fine-Tuning (SFT):** Assistant-only loss-masked multi-turn ChatML fine-tuning across `HuggingFaceTB/smoltalk`, `HuggingFaceH4/ultrachat_200k`, `HuggingFaceH4/no_robots`, and multi-turn recall/grounding dialogues. | |
| ## Download and run (custom PyTorch implementation) | |
| Repository layout: | |
| ```text | |
| README.md | |
| model.safetensors # Exported bfloat16 weights (best checkpoint) | |
| config.json # Velqora architecture configuration | |
| tokenizer.json # Custom 8,192-token byte-level BPE tokenizer | |
| generation_config.json # Recommended generation defaults | |
| run_inference.py # Ready-to-run CLI inference script | |
| ├── best_checkpoint/ | |
| │ └── model.pt # Best validation PyTorch checkpoint | |
| velqora/ | |
| __init__.py | |
| model.py # Custom VelqoraForCausalLM implementation | |
| ``` | |
| Install dependencies and run locally: | |
| ```bash | |
| pip install torch safetensors tokenizers huggingface_hub | |
| hf download Maxilicious20/Velqora-40M-Instruct --local-dir ./Velqora-40M-Instruct | |
| python ./Velqora-40M-Instruct/run_inference.py --model-dir ./Velqora-40M-Instruct --prompt "What is the capital of Germany?" | |
| ``` | |
| ### Chat serialization | |
| This instruct checkpoint uses ChatML role formatting: | |
| ```text | |
| <|im_start|>system | |
| You are Velqora, a helpful, thoughtful, and friendly AI assistant.<|im_end|> | |
| <|im_start|>user | |
| Hello!<|im_end|> | |
| <|im_start|>assistant | |
| ``` | |
| Assistant turns terminate with `<|im_end|>` (or `<|endoftext|>`). Recommended generation settings: temperature **0.35–0.55**, top-p **0.88**, repetition penalty **1.12**, and max context **2,048 tokens**. | |
| ## Intended use and limitations | |
| **Appropriate use:** Research on ultra-small, from-scratch language models, local edge inference experiments, and educational study of modern transformer components (GQA, QK-Norm, Value Residuals, SwiGLU, RoPE). | |
| **Limitations:** Because this model has ~42M parameters trained from scratch on a single consumer GPU, it can hallucinate facts, make arithmetic errors, or struggle with complex instructions. Do not use it for medical, legal, financial, or safety-critical tasks. | |
| ## License | |
| Licensed under the **Apache License 2.0** (`apache-2.0`). | |
| ## Citation and links | |
| - **PyTorch Model:** [Maxilicious20/Velqora-40M-Instruct](https://huggingface.co/Maxilicious20/Velqora-40M-Instruct) | |
| - **GGUF Companion:** [Maxilicious20/Velqora-40M-Instruct-GGUF](https://huggingface.co/Maxilicious20/Velqora-40M-Instruct-GGUF) | |