Instructions to use gulding/EmsyAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use gulding/EmsyAI with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: llama cli -hf gulding/EmsyAI:F32
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: llama cli -hf gulding/EmsyAI:F32
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: ./build/bin/llama cli -hf gulding/EmsyAI:F32
Use Docker
docker model run hf.co/gulding/EmsyAI:F32
- Llama new
- LM Studio
- Jan
- vLLM
How to use gulding/EmsyAI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gulding/EmsyAI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gulding/EmsyAI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/gulding/EmsyAI:F32
- Ollama
How to use gulding/EmsyAI with Ollama:
ollama run hf.co/gulding/EmsyAI:F32
- Unsloth Desktop
- Docker Model Runner
How to use gulding/EmsyAI with Docker Model Runner:
docker model run hf.co/gulding/EmsyAI:F32
- Lemonade
How to use gulding/EmsyAI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull gulding/EmsyAI:F32
Run and chat with the model
lemonade run user.EmsyAI-F32
List all available models
lemonade list
- Atomic Chat
Update V4 Model Card
Browse files
README.md
CHANGED
|
@@ -12,65 +12,86 @@ tags:
|
|
| 12 |
|
| 13 |
# EmsyAI (V4)
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
- **Training Tokens:** 1.96 Billion
|
| 23 |
-
- **Context Length:** 4096
|
| 24 |
-
- **Dim:** 1024
|
| 25 |
-
- **Layers:** 16
|
| 26 |
-
- **Heads:** 16 (Q), 4 (KV) (Grouped Query Attention)
|
| 27 |
-
- **FFN Dim:** 2816 (SwiGLU)
|
| 28 |
-
- **RoPE Theta:** 10,000.0
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |

|
| 35 |
|
| 36 |
## 🧪 Evaluation & Data Contamination
|
| 37 |
|
| 38 |
-
After pretraining,
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
**
|
| 41 |
|
| 42 |
-
|
| 43 |
-
Actually, this is a massive success! Modern models that ace HumanEval are typically 40x larger (8B+) and trained on 1,500x more data (3T+ tokens). A 196M parameter model scoring 0% is mathematically expected.
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
EmsyAI V4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
| 54 |
|
| 55 |
```bash
|
| 56 |
# Clone the repository
|
| 57 |
git clone https://github.com/gulding/EmsyAI.git
|
| 58 |
cd EmsyAI
|
| 59 |
|
| 60 |
-
#
|
| 61 |
-
|
| 62 |
|
| 63 |
-
#
|
|
|
|
| 64 |
ollama run emsyai-v4
|
| 65 |
```
|
| 66 |
|
| 67 |
-
##
|
| 68 |
|
| 69 |
-
|
| 70 |
-
1. **QK-Norm:**
|
| 71 |
-
2. **Document-Aware Packing:**
|
| 72 |
-
3. **Tokenizer
|
| 73 |
-
4. **RoPE Scaling:** Lowering `head_dim`
|
| 74 |
|
| 75 |
---
|
| 76 |
*Built with ❤️ in pure PyTorch.*
|
|
|
|
| 12 |
|
| 13 |
# EmsyAI (V4)
|
| 14 |
|
| 15 |
+
[](https://huggingface.co/gulding/EmsyAI)
|
| 16 |
+
[](LICENSE)
|
| 17 |
|
| 18 |
+
EmsyAI is a 196M parameter language model I built from scratch to learn how LLMs actually work under the hood.
|
| 19 |
|
| 20 |
+
Instead of just fine-tuning an existing model, I wanted to handle the entire pipeline locally: writing a custom BPE tokenizer, building a Llama-style transformer in PyTorch, pretraining it on 2 billion tokens, applying LoRA instruction tuning, and exporting it to GGUF so it runs natively in Ollama.
|
| 21 |
|
| 22 |
+
## 📐 Architecture Evolution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
| Specification | EmsyAI V3 (Titan) | EmsyAI V4 (Current) |
|
| 25 |
+
|---|---|---|
|
| 26 |
+
| **Active Parameters** | 153.8M | **196.7M** (+2.3M LoRA) |
|
| 27 |
+
| **Training Tokens** | ~150M | **1.96 Billion** |
|
| 28 |
+
| **Context Window** | 4,096 tokens | 4,096 tokens |
|
| 29 |
+
| **Hidden Dimension** | 896 | **1,024** |
|
| 30 |
+
| **Layers** | 16 | 16 |
|
| 31 |
+
| **Attention Mechanism** | GQA (14 Q / 2 KV) | **GQA (16 Q / 4 KV)** |
|
| 32 |
+
| **FFN Dimension** | 2,560 (SwiGLU) | **2,816 (SwiGLU)** |
|
| 33 |
+
| **Validation Perplexity** | ~14.2 | **5.86** |
|
| 34 |
|
| 35 |
+
## 📉 Pretraining Hardware & Results
|
| 36 |
+
|
| 37 |
+
Pretrained on 1x NVIDIA RTX GPU (24GB VRAM) using mixed-precision FP16 and AdamW with cosine decay. The model was trained for 15,000 steps. The loss curve behaved surprisingly well, decaying smoothly down to a final validation perplexity of 5.86.
|
| 38 |
|
| 39 |

|
| 40 |
|
| 41 |
## 🧪 Evaluation & Data Contamination
|
| 42 |
|
| 43 |
+
After pretraining, I fine-tuned the model using LoRA on the ~20k `CodeAlpaca` instruction dataset to teach it the standard `[USER]` / `[MODEL]` prompt format.
|
| 44 |
+
|
| 45 |
+
**HumanEval pass@1 Score:** `0.0%` *(Expected Baseline)*
|
| 46 |
|
| 47 |
+
*Analysis:* Models that pass HumanEval are typically 40x-350x larger (8B-70B+) and trained on trillions of tokens. For a 196M parameter model, a 0.0% score is mathematically expected and serves as a strict baseline.
|
| 48 |
|
| 49 |
+
More interestingly, before fine-tuning, I audited the open-source CodeAlpaca dataset for contamination. Using a 13-gram exact match technique, I found 1,644 sequences in CodeAlpaca that perfectly leaked HumanEval test logic (like Heron's formula and prime number checks). Despite this verifiable data leakage in the training set, the model still scored 0.0%—meaning it didn't just blindly overfit or memorize the test set during instruction tuning. It remains an honest, baseline 196M model.
|
|
|
|
| 50 |
|
| 51 |
+
## 💬 Sample Output
|
| 52 |
|
| 53 |
+
Here is an example of how the 196M model responds post-instruction tuning. While it lacks the deep reasoning of a 7B model, it successfully internalizes Python syntax and basic structures.
|
| 54 |
|
| 55 |
+
**Prompt:**
|
| 56 |
+
```text
|
| 57 |
+
[USER]
|
| 58 |
+
Write a python function to check if a number is even.
|
| 59 |
+
[MODEL]
|
| 60 |
+
```
|
| 61 |
|
| 62 |
+
**Completion (EmsyAI V4):**
|
| 63 |
+
```python
|
| 64 |
+
def is_even(num):
|
| 65 |
+
if num % 2 == 0:
|
| 66 |
+
return True
|
| 67 |
+
else:
|
| 68 |
+
return False
|
| 69 |
+
```
|
| 70 |
|
| 71 |
+
## 💻 How to Run locally
|
| 72 |
+
|
| 73 |
+
The model is exported to GGUF and can be run instantly via Ollama. Because the `.gguf` file is too large for GitHub (and `.gitignore`d), you'll pull the weights directly from Hugging Face first.
|
| 74 |
|
| 75 |
```bash
|
| 76 |
# Clone the repository
|
| 77 |
git clone https://github.com/gulding/EmsyAI.git
|
| 78 |
cd EmsyAI
|
| 79 |
|
| 80 |
+
# Download the V4 GGUF weights from Hugging Face
|
| 81 |
+
huggingface-cli download gulding/EmsyAI emsyai-v4-instruct-f32.gguf --local-dir .
|
| 82 |
|
| 83 |
+
# Create and run the Ollama model
|
| 84 |
+
ollama create emsyai-v4 -f Modelfile
|
| 85 |
ollama run emsyai-v4
|
| 86 |
```
|
| 87 |
|
| 88 |
+
## 🛠️ Lessons Learned (Blueprint for V5)
|
| 89 |
|
| 90 |
+
Building this taught me a lot about transformer stability. Here is what I'm fixing for V5:
|
| 91 |
+
1. **QK-Norm:** I ran into severe attention logit explosions during scaling. V5 will inject RMSNorm on the Query and Key states to stabilize training.
|
| 92 |
+
2. **Document-Aware Packing:** Currently, the tokenizer blindly concatenates text. V5 will respect document boundaries to prevent cross-document attention poisoning.
|
| 93 |
+
3. **Tokenizer Byte Collisions:** I realized late in training that bytes 0-3 currently overlap with special tokens. I'll be rebuilding the tokenizer from scratch and expanding the vocab to 32K.
|
| 94 |
+
4. **RoPE Scaling:** Lowering `head_dim` to 64 and adjusting `rope_theta` to 500,000 to better balance high/low frequency positional data at 4096 context.
|
| 95 |
|
| 96 |
---
|
| 97 |
*Built with ❤️ in pure PyTorch.*
|