--- license: apache-2.0 library_name: transformers pipeline_tag: text-generation tags: - qwen3 - small-language-model - scratch-trained - text-generation - causal-language-model datasets: - Aslam7/Vibe-Coding-Instruct-Prepared --- # Vibe Coding Qwen3 SLM A compact, experimental **173.4M-parameter Small Language Model (SLM)** developed using the Qwen3 architecture and trained from randomly initialized weights on a prepared Vibe Coding instruction dataset. Unlike a conventional fine-tuned model, this experiment does not load pretrained Qwen3 language-model weights. The architecture was configured independently, initialized from scratch, and trained using the prepared instruction-response examples. **Model:** Vibe-Coding-Qwen3-SLM **Architecture:** Compact Qwen3 Causal Language Model **Parameters:** 173,404,416 (173.4M) **Training:** Random initialization **Framework:** PyTorch and Hugging Face Transformers --- ## 1. Project Overview The objective of this project was to explore the development and training of a compact language model for Vibe Coding-related instruction generation. The model follows the Qwen3 architectural design while using a significantly smaller configuration suitable for experimentation with limited computational resources. The project covers: - Dataset collection and inspection. - Dataset cleaning and deduplication. - Compact transformer architecture configuration. - Random model initialization. - Instruction-based language-model training. - Training and validation monitoring. - Checkpoint selection and model export. - GGUF conversion and quantization. - Local inference using Ollama. ## 2. Model Architecture The model uses the Hugging Face `Qwen3ForCausalLM` implementation with a custom compact configuration. | Configuration | Value | |---|---:| | Architecture | Qwen3 | | Model class | Qwen3ForCausalLM | | Configuration class | Qwen3Config | | Parameters | 173,404,416 | | Transformer layers | 6 | | Hidden size | 512 | | Attention heads | 8 | | Key-value heads | 2 | | Intermediate size | 1,536 | | Context length | 128 tokens | | Tokenizer | Qwen3-8B tokenizer | | Training initialization | Random weights | The architecture retains Qwen3-style components including: - RMSNorm - Grouped Query Attention (GQA) - Rotary Positional Embeddings (RoPE) - SwiGLU activation - QK normalization The architecture was configured using the Hugging Face Qwen3 implementation rather than manually implementing every transformer layer. ## 3. Training Methodology ### Initialization The model was initialized using a configuration rather than loading an existing pretrained language-model checkpoint. Conceptually: ```python config = Qwen3Config(**MODEL_CONFIG) model = Qwen3ForCausalLM(config) ``` The Qwen3 tokenizer was reused for tokenization, but pretrained Qwen3 language-model weights were not loaded. ### Dataset The model was trained using the prepared version of the assigned Vibe Coding instruction dataset. Prepared dataset: https://huggingface.co/datasets/Aslam7/Vibe-Coding-Instruct-Prepared Original dataset: https://huggingface.co/datasets/CodeDevX/Vibe-Coding-Instruct The dataset audit identified approximately 1.1 million source records, representing 14 distinct instruction/response mappings after normalization and deduplication. The prepared dataset was divided into: | Split | Examples | |---|---:| | Training | 12 | | Validation | 1 | | Testing | 1 | | Total | 14 | ### Training configuration - Optimizer: AdamW - Training updates: 1,200 - Objective: Response-only causal language-model loss - Validation monitoring: Enabled - Checkpoint saving: Enabled - Best-checkpoint selection: Based on validation loss ## 4. Evaluation Results The latest recorded experiment produced the following results: | Metric | Result | |---|---:| | Parameters | 173.4M | | Optimizer updates | 1,200 | | Best validation checkpoint | Update 100 | | Best validation loss | 4.8824 | | Held-out exact-match accuracy | 0% | | Test examples | 1 | The training diagnostics showed overfitting, with training loss decreasing while validation loss worsened. The test set contains only one unique example. Therefore, these results are preliminary experimental observations and should not be interpreted as a reliable measurement of general coding ability. The model demonstrates the architecture configuration, training, checkpointing and export pipeline, but its current generation quality requires further improvement. ## 5. Download the Model Install the required libraries: ```bash pip install torch transformers safetensors ``` Download and load the model using Hugging Face Transformers: ```python import torch from transformers import AutoTokenizer, AutoModelForCausalLM MODEL_ID = "Aslam7/Vibe-Coding-Qwen3-SLM" tokenizer = AutoTokenizer.from_pretrained(MODEL_ID) model = AutoModelForCausalLM.from_pretrained( MODEL_ID ) model.eval() print("Vibe Coding Qwen3 SLM loaded successfully.") ``` ## 6. Basic Inference Example Use a short Vibe Coding instruction: ```python messages = [ { "role": "user", "content": "Create a coding assistant." } ] input_ids = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ).to(model.device) with torch.no_grad(): outputs = model.generate( input_ids, max_new_tokens=64, do_sample=False ) response = tokenizer.decode( outputs[0][input_ids.shape[-1]:], skip_special_tokens=True ) print(response) ``` Note: This is an experimental model with a 128-token context configuration. Keep prompts and generation lengths short. Output quality is not guaranteed. ## 7. GGUF Export and Local Deployment The trained checkpoint was also converted into GGUF format for local inference using Ollama. Available quantization versions: | Format | File | |---|---| | F16 | `vibe-coding-qwen3-f16.gguf` | | Q4_K_M | `vibe-coding-qwen3-Q4_K_M.gguf` | | Q5_K_M | `vibe-coding-qwen3-Q5_K_M.gguf` | | Q8_0 | `vibe-coding-qwen3-Q8_0.gguf` | The GGUF files and Ollama configuration are available in the project repository. Project and deployment files: https://huggingface.co/datasets/Aslam7/Vibe-Coding-Instruct-Prepared/tree/main/project For the Q4_K_M version, navigate to the `gguf` directory and run: ```bash ollama create vibe-coding-qwen3 -f Modelfile ``` Then: ```bash ollama run vibe-coding-qwen3 ``` ## 8. Project Resources **Trained model repository** https://huggingface.co/Aslam7/Vibe-Coding-Qwen3-SLM **Prepared training dataset** https://huggingface.co/datasets/Aslam7/Vibe-Coding-Instruct-Prepared **Training notebook, application and deployment files** https://huggingface.co/datasets/Aslam7/Vibe-Coding-Instruct-Prepared/tree/main/project ## 9. Limitations and Future Improvements This model is an experimental compact language-model training project. Its current limitations include: - Very limited unique training examples. - Overfitting during training. - Limited context length. - Poor generalization on the held-out example. - Generation quality requiring further improvement. Potential future improvements include: - Expanding the number of unique training examples. - Improving dataset diversity. - Experimenting with model configurations. - Improving training stability and regularization. - Evaluating on a larger independent test set. - Comparing different quantization formats. The project demonstrates the process of configuring, training, evaluating and deploying a compact transformer language model from randomly initialized weights. It should not be considered a production-ready coding assistant in its current experimental state.