Text Generation
Transformers
Safetensors
language-model
berna
dna-kernel-plexus
cells
research
non-commercial
Instructions to use muhamedkamil/berna-r7-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use muhamedkamil/berna-r7-v3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="muhamedkamil/berna-r7-v3")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("muhamedkamil/berna-r7-v3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use muhamedkamil/berna-r7-v3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "muhamedkamil/berna-r7-v3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "muhamedkamil/berna-r7-v3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/muhamedkamil/berna-r7-v3
- SGLang
How to use muhamedkamil/berna-r7-v3 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "muhamedkamil/berna-r7-v3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "muhamedkamil/berna-r7-v3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "muhamedkamil/berna-r7-v3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "muhamedkamil/berna-r7-v3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use muhamedkamil/berna-r7-v3 with Docker Model Runner:
docker model run hf.co/muhamedkamil/berna-r7-v3
Berna R7 v3
1.2B parameter language model with self-growing cell architecture.
| Parameters | 1,199,439,360 |
| Cells | 896 active / 1680 total |
| Data | 2.66B tokens (eng/math/code) |
| Tokenizer | vocab 32000 (custom BPE) |
| Status | β Training complete (step 10,200 / 10,200) |
| Final Loss | 2.35 |
| Final Checkpoint | step_00010200 |
Cell Growth Dynamics
| Step | Active Cells | Event |
|---|---|---|
| 0 | 112 | Initial |
| 300 | 224 | Split wave 1 |
| 600 | 448 | Split wave 2 |
| 900 | 896 | Split wave 3 |
| 900+ | 896 | Stable (9300+ steps) |
Growth: 8x (112 β 896), then natural stop.
Why it stopped:
- All cells hit min-neurons limit (256)
- Saturation S = 0.8578 (just above threshold 0.85)
- Data domains fully covered
K6 Encompassment: stable at 0.6138 (no explosion, no collapse) Births: 0 (no novel patterns β expected with current data)
Benchmarks (Final)
| Task | acc | acc_norm |
|---|---|---|
| HellaSwag | 28.19% | 29.84% |
| ARC-Easy | 47.69% | 41.71% |
| ARC-Challenge | 21.08% | 26.54% |
| PIQA | 60.50% | 57.78% |
| WinoGrande | 48.70% | β |
| OpenBookQA | 15.60% | 29.80% |
Perplexity (WikiText-103): 27.17
Perplexity (held-out English): 19.91
Comparison: GPT-2 Small (124M) achieves HellaSwag 31.4%, ARC-Easy 44.0%, PIQA 64.1%. Berna R7 v3 (1.2B) matches this at ~15x less training data.
Files
code/ Training code
config/ config.json
cells_runtime_current/ Live cells + cognitive log
cells_runtime_final/ Final cell state
checkpoints/step_00010200/ Final model (with wrapper)
checkpoints/step_00001700/ Earlier checkpoint
data/tokenized/ eng.npy, math.npy, code.npy
data/tokenizer/ tokenizer.json
Quick Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
p = "muhamedkamil/berna-r7-v3/checkpoints/step_00010200/model"
tok = AutoTokenizer.from_pretrained(p, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
p, trust_remote_code=True, torch_dtype=torch.bfloat16
).cuda().eval()
prompt = "The capital of France is"
ids = tok.encode(prompt, return_tensors="pt").cuda()
out = model.generate(ids, max_new_tokens=40, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))
Critical Notes
--resume mandatory for continued training
bf16 required (else 8x slower β Tensor Cores disabled)
num_workers=8 required (else 8x slower)
Optimizer state incompatible between bnb.AdamW8bit and torch.optim.AdamW
trust_remote_code=True required for loading (custom architecture)
Performance
GPU Config tok/s ETA (2.67B)
RTX 5090 batch=1 4,630 ~140h
A100 SXM batch=16, bf16, nw=8 14,000 ~46h
H100 batch=16, bf16 12-15k ~45h
H200 batch=24, bf16 15-22k ~30-40h
License
CC BY-NC 4.0 β research and personal non-commercial use only.
Commercial use requires written permission from the author.
Full text: https://creativecommons.org/licenses/by-nc/4.0/legalcode
Citation
bibtex
@misc{berna_r7_v3_2026,
author = {Muhamed Kamil},
title = {Berna R7 v3: DNA-Kernel Plexus Language Model},
year = {2026},
howpublished = {Hugging Face: muhamedkamil/berna-r7-v3},
note = {ORCID: 0009-0002-5866-8815, DOI: 10.5281/zenodo.23015308}
}
Links
R5 Theory: https://doi.org/10.5281/zenodo.23015308
R7 v0.1: https://doi.org/10.5281/zenodo.23037065
GitHub: https://github.com/Berna-Labs
Author: Muhamed Kamil (ORCID)
Updated: 2026-10-12 β Training complete