Ill-Ness commited on
Commit
94078e4
Β·
verified Β·
1 Parent(s): b0445dc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md CHANGED
@@ -1,3 +1,143 @@
1
  ---
 
 
 
 
 
 
 
2
  license: apache-2.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - text-generation
6
+ - causal-lm
7
+ - edge-ai
8
+ - lightweight
9
  license: apache-2.0
10
+ pipeline_tag: text-generation
11
  ---
12
+
13
+ # Monad-1
14
+
15
+ Monad-1 is an ultra-compact, **7.3-million-parameter** causal language model built from scratch to explore
16
+ parameter efficiency, lightweight architectural dynamics, and foundational syntax acquisition. It is trained
17
+ entirely from the ground up β€” no distillation, no pretrained backbone β€” to test how much linguistic structure
18
+ a minimal decoder-only Transformer can internalize.
19
+
20
+ Despite its minimal footprint, Monad-1 successfully learns core English structural mechanics, grammar, and
21
+ token co-occurrence patterns, performing over **2,500Γ— better than random chance** on standard next-token
22
+ evaluation tasks.
23
+
24
+ **Disclaimer:** Monad-1 is an experimental, research-scale model. It is not intended to compete with
25
+ large-scale foundation models on knowledge-intensive or reasoning-heavy tasks β€” see
26
+ [Intended Use & Limitations](#intended-use--limitations) below.
27
+
28
+ ## Model Highlights
29
+
30
+ - **Ultra-lightweight footprint** β€” at ~7.3M parameters, Monad-1 runs effortlessly on virtually any device,
31
+ including low-power edge hardware and CPU-only environments.
32
+ - **Modern Transformer foundations** β€” built on standard GPT-2 decoder-only principles using scaled
33
+ dot-product attention, LayerNorm, and zero-bias linear layers.
34
+ - **Standard BPE tokenization** β€” uses the standard 50,257-token vocabulary, compatible with `gpt2` /
35
+ `tiktoken` encodings, so it drops into existing tooling with no custom tokenizer required.
36
+ - **Safe & fast weight serialization** β€” distributed natively in `.safetensors` format for zero-copy loading
37
+ and safe deserialization.
38
+
39
+ ## Model Details
40
+
41
+ Monad-1 is a causal language model with its own custom architecture, registered under the model type
42
+ `monad` with its own `MonadForCausalLM` class and `config.json` β€” it is not a repurposed GPT-2 checkpoint,
43
+ though it follows similar decoder-only design principles. The full model totals roughly 7.3 million
44
+ parameters, arranged across 4 transformer layers with a hidden dimension of 128 and 4 attention heads per
45
+ layer. It operates over a context window of 512 tokens and shares the standard 50,257-token vocabulary used
46
+ by GPT-2 / tiktoken encodings, which keeps it compatible with widely available tokenizers. Weights are
47
+ distributed in both float32 and float16 precision, packaged as SafeTensors (`model.safetensors`) for safe,
48
+ zero-copy loading.
49
+
50
+ ## Usage
51
+
52
+ Monad-1 is compatible with the Hugging Face πŸ€— Transformers library via `trust_remote_code`.
53
+
54
+ ### 1. Requirements
55
+
56
+ ```bash
57
+ pip install torch safetensors transformers
58
+ ```
59
+
60
+ ### 2. Loading the model
61
+
62
+ ```python
63
+ import torch
64
+ from transformers import AutoModelForCausalLM, AutoTokenizer
65
+
66
+ # Load tokenizer (standard GPT-2 BPE vocabulary)
67
+ tokenizer = AutoTokenizer.from_pretrained("gpt2")
68
+
69
+ # Load model weights from local repository or Hugging Face directory
70
+ model = AutoModelForCausalLM.from_pretrained(
71
+ "./monad-1",
72
+ trust_remote_code=True,
73
+ torch_dtype=torch.float32,
74
+ )
75
+ ```
76
+
77
+ ### 3. Generating text
78
+
79
+ ```python
80
+ prompt = "The journey of learning begins with"
81
+ inputs = tokenizer(prompt, return_tensors="pt")
82
+
83
+ output = model.generate(
84
+ **inputs,
85
+ max_new_tokens=30,
86
+ temperature=0.8,
87
+ do_sample=True,
88
+ )
89
+
90
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
91
+ ```
92
+
93
+ ## Benchmark Performance
94
+
95
+ Monad-1 was evaluated on the LAMBADA benchmark suite using zero-shot sampling (T = 1.2):
96
+
97
+ | Metric | Monad-1 Result | Random Chance Baseline |
98
+ |---|---|---|
99
+ | Accuracy (exact word completion) | 5.01% | ~0.002% |
100
+ | Perplexity | 11,600 | ~50,257 |
101
+
102
+ **Key insight:** for a 7.3M-parameter model with a 128-dimensional hidden state, scoring 5.01% exact-match
103
+ accuracy demonstrates that the model has successfully internalized core language syntax, vocabulary bounds,
104
+ and phrase construction rules β€” well beyond what would be expected from chance alone.
105
+
106
+ ## Intended Use & Limitations
107
+
108
+ ### Intended use
109
+
110
+ Monad-1 is intended for:
111
+
112
+ - Educational research into parameter-efficient language modeling
113
+ - Studying architectural dynamics and syntax acquisition at small scale
114
+ - Lightweight text completion on resource-constrained or edge devices
115
+ - Prototyping and iterating on custom Transformer architectures before scaling up
116
+
117
+ ### Limitations
118
+
119
+ Due to its 7.3M-parameter size and 128-dimensional representation layer, Monad-1 has significant limitations:
120
+
121
+ - **World knowledge:** minimal capacity for factual recall or broad world-knowledge retrieval
122
+ - **Reasoning:** not capable of complex multi-step or chain-of-thought reasoning
123
+ - **Long-form coherence:** limited long-form context memory beyond its 512-token window; may lose
124
+ coherence over longer generations
125
+ - **Hallucination:** like larger language models, Monad-1 can generate fluent but factually incorrect or
126
+ nonsensical text, and this effect is more pronounced given its limited capacity
127
+
128
+ We recommend against deploying Monad-1 in any high-stakes, safety-critical, or decision-making context. It
129
+ is best suited to research, experimentation, and lightweight on-device demos rather than production
130
+ applications requiring factual accuracy or robust reasoning.
131
+
132
+ ## Citation
133
+
134
+ If you use Monad-1 in your research, please cite:
135
+
136
+ ```bibtex
137
+ @misc{monad1,
138
+ title = {Monad-1: An Ultra-Compact 7.3M-Parameter Causal Language Model},
139
+ author = {MonadAi},
140
+ year = {2026},
141
+ url = {https://huggingface.co/MonadAi/monad-1}
142
+ }
143
+ ```