File size: 3,261 Bytes
09ba1fe
 
1b2c914
 
 
 
 
 
 
 
 
 
 
 
 
 
09ba1fe
1b2c914
12b878f
1c458ef
1b2c914
 
 
 
 
7f96631
1c458ef
 
 
 
 
12b878f
1b2c914
1c458ef
 
1b2c914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d579232
1b2c914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4e44f0a
1b2c914
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
license: mit
language:
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- code
- python
- gguf
- small-model
- pretrained-from-scratch
- gpt2
- from-scratch
- coding
- SLM
---

# πŸš€ PyBlissa-Coder-50M
# !! BENCHMARK ON HumaEval DATASET: 10.4% !!

A 50M-parameter Python code generation model trained from scratch on a single RTX 5080. Built as part of the **PRIME** lineup of small, locally-runnable AI systems.

Despite its size, PyBlissa punches well above its weight on Python instruction-following tasks. Trained near-Chinchilla optimal (~13 tokens/parameter) for maximum capacity utilization.

This model punched a solid 10.4% score in OpenAI's HumanEval dataset, which is an amazing number for this model's size!
However, this model technically *can* generate bad outputs. You'd need to tweak the temperature. But that's a rare case!

![Benchmark](pyblissa_humaneval_benchmark.png)


![Loss Visualization](loss_visualization.png)



## Stats

| | |
|---|---|
| Parameters | 50.2M |
| Architecture | Decoder-only transformer (GPT-2 style) |
| Context length | 1024 tokens |
| Vocab size | 16,000 (custom ByteLevel BPE) |
| Train tokens | 166M |
| Final val loss | 0.474 |
| Training time | 73 minutes (RTX 5080) |

## Architecture

```
d_model:      640
n_layer:      8
n_head:       8
d_ff:         2560
block_size:   1024
tied embeddings, pre-LN, no bias, GELU MLP, SDPA attention
```

## Training data

Two-source code-instruction corpus, 425k samples β†’ 166M tokens after BPE tokenization:

- **`nvidia/OpenCodeInstruct`** β€” 400k high-quality instruction-code pairs
- **`flytech/python-codes-25k`** β€” 25k Python-focused instruction-code pairs

Trained for 4 epochs with cosine LR schedule (3e-4 β†’ 3e-5), bf16 autocast, batch size 20.

## Prompt format

Trained on a strict prefix structure:

```
PROMPT: <your instruction>
CODE:
<generated code>
```

Anything else is out-of-distribution. The Modelfile in this repo handles the formatting automatically.

## Usage β€” Ollama (recommended)

```bash
ollama run hf.co/Rohanify/PyBlissa-Coder-50M:F32
```

Or pull the GGUF directly and create locally:

```bash
ollama create pyblissa-coder -f Modelfile
ollama run pyblissa-coder "write a function to merge two sorted lists"
```

## Usage β€” llama.cpp

```bash
./llama-cli -m PyBlissa-Coder-50M-F32.gguf \
  -p "PROMPT: write a function to reverse a string\nCODE:\n" \
  --temp 0.8 --top-k 50 --top-p 0.95 -n 256
```

## Files

| File | Purpose |
|---|---|
| `PyBlissa-Coder-50M-F32.gguf` | Full-precision GGUF weights |
| `Modelfile` | Ollama config (prompt template, stop tokens, sampling) |
| `tokenizer.json` | Custom 16k BPE tokenizer |

## Limitations

- Mostly Python β€” other languages weren't that much in training data
- 1024-token context β€” longer programs get truncated
- Small flytech subset (~6% of training data) contains code with unescaped quote bugs; the model occasionally inherits this pattern
- No safety tuning, no RLHF β€” base model only

## Acknowledgments

Datasets by NVIDIA and flytech. Built using the nanoGPT-style training recipe with custom tokenization. Tooling: PyTorch, HuggingFace `tokenizers`, llama.cpp for GGUF conversion.

---

Made by Rohan. Also known as ElectroPlayin on YouTube