--- language: - en pipeline_tag: text-generation datasets: - HuggingFaceTB/cosmopedia-100k - HuggingFaceFW/fineweb-edu - roneneldan/TinyStories tags: - velqora - from-scratch - causal-language-model - custom-architecture - pytorch - grouped-query-attention - qk-norm - value-residuals - research license: apache-2.0 --- # Velqora-40M-Base **Velqora-40M-Base** is a **41,957,387-parameter** (~41.96M), English-first, decoder-only pretrained base causal language model **trained from random initialization** on a single **NVIDIA GeForce RTX 4060 (8 GB)** under Windows 11. **GGUF companion:** [Maxilicious20/Velqora-40M-Base-GGUF](https://huggingface.co/Maxilicious20/Velqora-40M-Base-GGUF) ## Model overview | Property | Value | |---|---| | Developer | [Maxilicious20](https://huggingface.co/Maxilicious20) | | Parameters | **41,957,387** (~41.96M) | | Model type | Decoder-only causal language model (Pretrained Base) | | 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 | `2.8360` | | 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 base checkpoint was trained from random initialization using next-token prediction on a single NVIDIA RTX 4060 (8 GB) across `HuggingFaceTB/cosmopedia-100k` (45%), `HuggingFaceFW/fineweb-edu` (35%), and `roneneldan/TinyStories` (20%) with progressive context-length curriculum scaling. ## 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 ├── latest_checkpoint/ │ └── model.pt # Final step 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-Base --local-dir ./Velqora-40M-Base python ./Velqora-40M-Base/run_inference.py --model-dir ./Velqora-40M-Base --prompt "What is the capital of Germany?" ``` ### Prompting (Base Model) As a **Base** pretrained model (not instruction-tuned), prompt it with natural text continuations rather than ChatML tags, up to **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-Base](https://huggingface.co/Maxilicious20/Velqora-40M-Base) - **GGUF Companion:** [Maxilicious20/Velqora-40M-Base-GGUF](https://huggingface.co/Maxilicious20/Velqora-40M-Base-GGUF)