kumaran commited on
Upload folder using huggingface_hub
Browse files- README.md +84 -0
- config.json +14 -0
- model.safetensors +3 -0
- token_bytes.pt +3 -0
- tokenizer.pkl +3 -0
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- medical
|
| 5 |
+
- gpt
|
| 6 |
+
- autoresearch
|
| 7 |
+
- causal-lm
|
| 8 |
+
- from-scratch
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
library_name: pytorch
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Medical GPT-50M
|
| 16 |
+
|
| 17 |
+
A 50M-parameter medical language model trained from scratch on 2.9M medical Q&A examples using the [autoresearch](https://github.com/karpathy/autoresearch) methodology.
|
| 18 |
+
|
| 19 |
+
## Model Details
|
| 20 |
+
|
| 21 |
+
| Parameter | Value |
|
| 22 |
+
|-----------|-------|
|
| 23 |
+
| Parameters | 50.3M |
|
| 24 |
+
| Architecture | GPT (RoPE, RMS norm, sliding window, ReluSquared MLP) |
|
| 25 |
+
| Vocabulary | Medical BPE (8192 tokens) |
|
| 26 |
+
| Context length | 2048 tokens |
|
| 27 |
+
| Layers | 8 |
|
| 28 |
+
| Heads | 8 |
|
| 29 |
+
| Head dim | 128 |
|
| 30 |
+
| Window pattern | SSSL |
|
| 31 |
+
| Optimizer | MuonAdamW (Muon for matrices, AdamW for embeddings) |
|
| 32 |
+
| Validation BPB | 1.1217 |
|
| 33 |
+
| Training tokens | 37.0M |
|
| 34 |
+
|
| 35 |
+
## Training Data
|
| 36 |
+
|
| 37 |
+
Trained on 3 medical Q&A datasets (2.9M examples, 17.4GB JSONL):
|
| 38 |
+
- **OpenMed/Medical-Reasoning-SFT-Mega** (1.78M rows) — multi-domain medical reasoning with chain-of-thought
|
| 39 |
+
- **lingshu-medical-mllm/ReasonMed** (1.11M rows) — medical reasoning Q&A
|
| 40 |
+
- **FreedomIntelligence/medical-o1-reasoning-SFT** [en] (19.7K rows) — used as validation set
|
| 41 |
+
|
| 42 |
+
## Experiment Insights
|
| 43 |
+
|
| 44 |
+
This model was trained using the autoresearch autonomous experimentation loop. Key findings from ~25 experiments:
|
| 45 |
+
|
| 46 |
+
| Experiment | val_bpb | Insight |
|
| 47 |
+
|-----------|---------|---------|
|
| 48 |
+
| Baseline (batch=128, OOM) | - | L4 has 24GB, not H100's 80GB |
|
| 49 |
+
| batch=32 | 1.252 | First working baseline on L4 |
|
| 50 |
+
| batch=32 + mlr=0.06 + warmdown=0.3 | 1.160 | Higher matrix LR helps medical text |
|
| 51 |
+
| total_batch=2^16, batch=8 | 1.125 | **Key finding**: 4x more optimizer steps >> throughput |
|
| 52 |
+
| + unembedding_lr=0.008 | 1.123 | Small gain from discriminative LRs |
|
| 53 |
+
| + embedding_lr=1.2 | 1.115 | Medical vocabulary needs faster embedding adaptation |
|
| 54 |
+
|
| 55 |
+
**Key insight**: On time-budgeted training (5 min), smaller total batch size = more optimizer steps = dramatically better val_bpb. This is the single biggest lever.
|
| 56 |
+
|
| 57 |
+
## How to Use
|
| 58 |
+
|
| 59 |
+
This is a raw pretrained model with a custom architecture (not HuggingFace Transformers compatible). Load with PyTorch:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import torch
|
| 63 |
+
import safetensors.torch
|
| 64 |
+
state_dict = safetensors.torch.load_file("model.safetensors")
|
| 65 |
+
# Architecture details in config.json
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Limitations
|
| 69 |
+
|
| 70 |
+
- **Not instruction-tuned** — this is a base pretrained model
|
| 71 |
+
- **5-minute training budget** — trained for research/exploration, not production
|
| 72 |
+
- **50M parameters** — small model, intended as foundation for embedding/classification experiments
|
| 73 |
+
- **Custom architecture** — not directly compatible with HuggingFace Transformers
|
| 74 |
+
|
| 75 |
+
## Citation
|
| 76 |
+
|
| 77 |
+
```
|
| 78 |
+
@misc{medical-gpt-50m,
|
| 79 |
+
title={Medical GPT-50M: Autonomous Medical LM Research},
|
| 80 |
+
author={Axone AI},
|
| 81 |
+
year={2026},
|
| 82 |
+
url={https://huggingface.co/axonee/medical-gpt-50m}
|
| 83 |
+
}
|
| 84 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "gpt-medical",
|
| 3 |
+
"architecture": "autoresearch-gpt",
|
| 4 |
+
"vocab_size": 8192,
|
| 5 |
+
"max_seq_len": 2048,
|
| 6 |
+
"depth": 8,
|
| 7 |
+
"num_heads": 8,
|
| 8 |
+
"head_dim": 128,
|
| 9 |
+
"aspect_ratio": 64,
|
| 10 |
+
"window_pattern": "SSSL",
|
| 11 |
+
"num_params_M": 50.3,
|
| 12 |
+
"val_bpb": 1.121693739215597,
|
| 13 |
+
"total_tokens_M": 37.0
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81b341c16bb33e34d7aae9f5cb7ba75f54469974b824517ef41946a1280d071e
|
| 3 |
+
size 159392432
|
token_bytes.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc27e313a03c6dd716304d3ef9261028799abe9643747da6bff6fd43c45ed6aa
|
| 3 |
+
size 34373
|
tokenizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5a6333a6cb981f3f7b61cb266ba8b370bb87c93cf4029ebfdcfb72604bad1d27
|
| 3 |
+
size 94629
|