Text Generation
Transformers
Safetensors
English
nano-transformer
cobol
code
code-generation
legacy-modernization
sovereign-ai
from-scratch
Instructions to use Skyl4r-Ai/Skylar-390M-Cobol with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Skyl4r-Ai/Skylar-390M-Cobol with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Skyl4r-Ai/Skylar-390M-Cobol")# Load model directly from transformers import NanoTransformer model = NanoTransformer.from_pretrained("Skyl4r-Ai/Skylar-390M-Cobol", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Skyl4r-Ai/Skylar-390M-Cobol with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Skyl4r-Ai/Skylar-390M-Cobol" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Skyl4r-Ai/Skylar-390M-Cobol", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Skyl4r-Ai/Skylar-390M-Cobol
- SGLang
How to use Skyl4r-Ai/Skylar-390M-Cobol 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 "Skyl4r-Ai/Skylar-390M-Cobol" \ --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": "Skyl4r-Ai/Skylar-390M-Cobol", "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 "Skyl4r-Ai/Skylar-390M-Cobol" \ --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": "Skyl4r-Ai/Skylar-390M-Cobol", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Skyl4r-Ai/Skylar-390M-Cobol with Docker Model Runner:
docker model run hf.co/Skyl4r-Ai/Skylar-390M-Cobol
MwSpace Srl commited on
SkylarCobol-390M v0.1 — from-scratch COBOL specialist (COBOLEval CSR 82.2% / pass@1 5.5%, beats 7B baselines)
Browse files- README.md +129 -0
- config.json +25 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- cobol
|
| 7 |
+
- code
|
| 8 |
+
- code-generation
|
| 9 |
+
- legacy-modernization
|
| 10 |
+
- sovereign-ai
|
| 11 |
+
- from-scratch
|
| 12 |
+
library_name: transformers
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# SkylarCobol-390M
|
| 17 |
+
|
| 18 |
+
**A 390M-parameter, from-scratch language model specialized in COBOL — small enough to run
|
| 19 |
+
locally and on-prem, trained entirely in-house, that outperforms 7B general code models on
|
| 20 |
+
COBOL code generation.**
|
| 21 |
+
|
| 22 |
+
> ⚠️ **Research preview (v0.1).** This is an honest proof-of-concept, **not** a production tool.
|
| 23 |
+
> It demonstrates that a small, sovereign, specialized model can beat much larger generalist
|
| 24 |
+
> code LLMs on a niche legacy language. Read the **Limitations** before using it. Numbers are
|
| 25 |
+
> reported with full methodology and a decontamination audit — no hidden asterisks.
|
| 26 |
+
|
| 27 |
+
## TL;DR
|
| 28 |
+
|
| 29 |
+
- **~390M parameters** (386M exact), decoder-only, Qwen3-style architecture, trained **100% from
|
| 30 |
+
scratch** (no warm-start from anyone else's weights).
|
| 31 |
+
- Domain: **COBOL** — the language that still runs banking, insurance and public-administration
|
| 32 |
+
back-ends, where general code models perform poorly and skilled developers are retiring.
|
| 33 |
+
- **Sovereign**: runs on a single local GPU, no data leaves your infrastructure, no dependency on
|
| 34 |
+
any external LLM provider.
|
| 35 |
+
- On **COBOLEval** (146 HumanEval-derived COBOL problems, compiled and executed with GnuCOBOL),
|
| 36 |
+
it **beats Qwen2.5-Coder-7B, CodeLlama-7B and StarCoder2-7B on pass@1** — at **18× fewer
|
| 37 |
+
parameters**.
|
| 38 |
+
|
| 39 |
+
## Results — head-to-head on COBOLEval
|
| 40 |
+
|
| 41 |
+
All models evaluated on the **same harness**, greedy decoding, seed 0, GnuCOBOL compile+execute,
|
| 42 |
+
official `{NAME}.TXT` scoring.
|
| 43 |
+
|
| 44 |
+
| Model | Params | CSR (compile rate) | pass@1 |
|
| 45 |
+
|---|---:|---:|---:|
|
| 46 |
+
| **SkylarCobol-390M (this model)** | **390M** | **82.2%** | **5.5%** |
|
| 47 |
+
| Qwen2.5-Coder-7B-Instruct | 7B | 6.2% | 2.1% |
|
| 48 |
+
| CodeLlama-7B-Instruct | 7B | 6.8% | 0.7% |
|
| 49 |
+
| StarCoder2-7B | 7B | 48.6% | 0.0% |
|
| 50 |
+
| *Claude Opus 4.8 (reference ceiling)* | — | *96.6%* | *81.5%* |
|
| 51 |
+
|
| 52 |
+
<sub>pass@1 = 8/146 problems solved. 95% binomial CI ≈ [2.4%, 10.5%] — low absolute, as expected for
|
| 53 |
+
a 390M model on an execution benchmark; the point is the *relative* result vs the 7B baselines on the
|
| 54 |
+
identical harness.</sub>
|
| 55 |
+
|
| 56 |
+
**Why this comparison is trustworthy:** our measured baseline scores match the published
|
| 57 |
+
literature (StarCoder2 ~0%, CodeLlama ~0%, Qwen2.5-Coder ~0.68% on COBOLEval). The harness does
|
| 58 |
+
**not** favor us — it reproduces the competitors' official numbers, and on that same harness the
|
| 59 |
+
specialized 390M wins.
|
| 60 |
+
|
| 61 |
+
**What the numbers mean.** The general 7B models often write *pseudo-COBOL* — they call `mod()`,
|
| 62 |
+
`substr()`, `abs()` (functions from Python/Java that don't exist in COBOL), so their code looks
|
| 63 |
+
right but doesn't compile. SkylarCobol writes *real* COBOL: it compiles 82% of the time and solves
|
| 64 |
+
the most problems. This is the value of specialization.
|
| 65 |
+
|
| 66 |
+
## Decontamination
|
| 67 |
+
|
| 68 |
+
We audited overlap between training data and the COBOLEval test set. 4 problems
|
| 69 |
+
(`below_zero`, `count_upper`, `find_max`, `is_sorted`) appeared in both; we **removed them from the
|
| 70 |
+
training set and retrained** so the released model has never seen any test problem. The numbers
|
| 71 |
+
above (5.5% / 82.2%) are reported on this clean model — and as a sanity check, **none of the 4
|
| 72 |
+
formerly-overlapping problems are among the solved ones**, confirming the score carries no leakage.
|
| 73 |
+
|
| 74 |
+
## Intended use & limitations
|
| 75 |
+
|
| 76 |
+
**Intended use:** a *supervised assistant* for COBOL developers — scaffolding, boilerplate,
|
| 77 |
+
DIVISION/LINKAGE structure, syntax, completion — where a human reviews the output.
|
| 78 |
+
|
| 79 |
+
**Limitations (read this):**
|
| 80 |
+
- **pass@1 is 5.5% in absolute terms — low.** COBOLEval is hard (real execution), but this model
|
| 81 |
+
is **not** capable of autonomously writing correct COBOL programs end-to-end. It is **capacity-
|
| 82 |
+
limited**: it compiles well (82%) but its algorithmic reasoning is weak.
|
| 83 |
+
- **Do not** use it unsupervised or for safety-critical code.
|
| 84 |
+
- English/COBOL only; not a general chat model.
|
| 85 |
+
|
| 86 |
+
## How it was built
|
| 87 |
+
|
| 88 |
+
1. **Pretrain (from scratch):** 8.19B tokens, mix of permissive code (oversampled), Italian/EU
|
| 89 |
+
legal text, and COBOL, Chinchilla-optimal, code-aware BPE tokenizer (vocab 32768).
|
| 90 |
+
2. **SFT:** instruction tuning on COBOL completion, with **verified distillation** — a strong
|
| 91 |
+
teacher solves COBOL problems, each solution is kept **only if it compiles and passes its
|
| 92 |
+
tests**, then used as training data. Plus targeted synthetic data for structural gaps.
|
| 93 |
+
3. **Decontamination + clean retrain** (see above).
|
| 94 |
+
|
| 95 |
+
## Roadmap
|
| 96 |
+
|
| 97 |
+
This 390M is the **first step**. A larger model (~1B) with more code pretraining and longer context
|
| 98 |
+
is in progress — that is the version intended to become a genuinely usable COBOL assistant.
|
| 99 |
+
|
| 100 |
+
## Usage
|
| 101 |
+
|
| 102 |
+
The easiest way — the `skylar` package (CLI + loader, auto-downloads the weights):
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
pip install skylar
|
| 106 |
+
skylar cobol --example # complete a sample COBOL stub into a full program
|
| 107 |
+
skylar chat # interactive REPL
|
| 108 |
+
skylar generate --prompt "..." # one-shot
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
import skylar
|
| 113 |
+
m = skylar.load("Sophia-AI/SkylarCobol-390M")
|
| 114 |
+
print(m.complete_cobol(my_stub)) # reassembles a full, compilable program
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
`import skylar` also registers the architecture with 🤗 Transformers, so
|
| 118 |
+
`AutoModelForCausalLM.from_pretrained("Sophia-AI/SkylarCobol-390M")` works too. The weights
|
| 119 |
+
(`model.safetensors`) and `tokenizer.json` are standard; the architecture is a custom decoder
|
| 120 |
+
(`NanoTransformer`, `model_type: nano-transformer` — Qwen3-style RMSNorm + RoPE + GQA + QK-Norm +
|
| 121 |
+
SwiGLU), described in full in the accompanying paper.
|
| 122 |
+
|
| 123 |
+
**Note** — this model expects a COBOLEval-style stub (a fixed-format skeleton with the task as
|
| 124 |
+
comments, ending at `WORKING-STORAGE SECTION.`); `skylar`'s `complete_cobol` / `skylar cobol` wrap
|
| 125 |
+
the prompt and reassemble the program for you.
|
| 126 |
+
|
| 127 |
+
## License & attribution
|
| 128 |
+
|
| 129 |
+
Apache-2.0. IP: A. Ivanovitch (Sophia AI). Built in-house, no third-party pretrained weights.
|
config.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_d_head": 128,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"NanoTransformer"
|
| 5 |
+
],
|
| 6 |
+
"bias": false,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"d_ff": 3456,
|
| 9 |
+
"d_model": 1280,
|
| 10 |
+
"dropout": 0.1,
|
| 11 |
+
"eos_token_id": 2,
|
| 12 |
+
"max_seq_len": 16384,
|
| 13 |
+
"model_type": "nano-transformer",
|
| 14 |
+
"mup_base_d_model": null,
|
| 15 |
+
"n_heads": 10,
|
| 16 |
+
"n_kv_heads": 2,
|
| 17 |
+
"n_layers": 20,
|
| 18 |
+
"pad_token_id": 0,
|
| 19 |
+
"qk_norm": true,
|
| 20 |
+
"rope_theta": 1000000.0,
|
| 21 |
+
"tie_weights": true,
|
| 22 |
+
"torch_dtype": "float32",
|
| 23 |
+
"transformers_version": "4.52.4",
|
| 24 |
+
"vocab_size": 32768
|
| 25 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2399c6f4098ec5900ff8a3a4281a22c6acfb0c784079a4f4e631e7fdd46585f
|
| 3 |
+
size 1544287336
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|