Update Quick Start to include setup.py step (fixes NameError)"
Browse files
README.md
CHANGED
|
@@ -6,7 +6,35 @@ tags:
|
|
| 6 |
|
| 7 |
> A domain-specific AI architecture that generates truly creative, novel names for brands, YouTube channels, social media handles, and more β using **Uniform Discrete Language Diffusion** instead of autoregressive LLMs.
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
## π― The Problem We Solve
|
| 12 |
|
|
@@ -32,46 +60,6 @@ NeuroLex v4 (WORKS):
|
|
| 32 |
(different noise each time = different output each time)
|
| 33 |
```
|
| 34 |
|
| 35 |
-
### Architecture Overview
|
| 36 |
-
|
| 37 |
-
```
|
| 38 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 39 |
-
β NeuroLex v4 Architecture β
|
| 40 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 41 |
-
β β
|
| 42 |
-
β Input: Random noise tokens (uniform over charset) β
|
| 43 |
-
β + Conditions: [domain] [style] [language] [length] β
|
| 44 |
-
β + Time step: t β [0,1] (noise level) β
|
| 45 |
-
β β
|
| 46 |
-
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 47 |
-
β β Conditioning System β β
|
| 48 |
-
β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β β
|
| 49 |
-
β β β Domain β β Style β β Language β β Length β β β
|
| 50 |
-
β β β Embed β β Embed β β Embed β β Embed β β β
|
| 51 |
-
β β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β β
|
| 52 |
-
β β βββββββββββββββ΄βββββββββββββ΄ββββββββββββββ β β
|
| 53 |
-
β β β concat β β
|
| 54 |
-
β β ββββββ΄βββββ β β
|
| 55 |
-
β β β + Time β β Sinusoidal embedding β β
|
| 56 |
-
β β β Embed β β β
|
| 57 |
-
β β ββββββ¬βββββ β β
|
| 58 |
-
β β β β adaLN (scale/shift per layer) β β
|
| 59 |
-
β βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
|
| 60 |
-
β β β
|
| 61 |
-
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 62 |
-
β β 8Γ DiT Blocks (Bidirectional Transformer) β β
|
| 63 |
-
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
|
| 64 |
-
β β β adaLN β Multi-Head Self-Attention (NO causal mask) β β β
|
| 65 |
-
β β β adaLN β Feed-Forward (GELU) β β β
|
| 66 |
-
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
|
| 67 |
-
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 68 |
-
β β β
|
| 69 |
-
β Output: Logits over character vocab at ALL positions β
|
| 70 |
-
β β Predict clean name from noisy input β
|
| 71 |
-
β β
|
| 72 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
### Key Innovations
|
| 76 |
|
| 77 |
| Innovation | What It Does | Based On |
|
|
@@ -90,131 +78,37 @@ NeuroLex v4 (WORKS):
|
|
| 90 |
| Parameters | ~12M (base) |
|
| 91 |
| Vocabulary | 72 characters (a-z, A-Z, 0-9, specials) |
|
| 92 |
| Max name length | 24 characters |
|
| 93 |
-
| Languages | 25
|
| 94 |
-
| Domains | 20
|
| 95 |
-
| Styles | 10
|
| 96 |
| Training time | ~25 min on free Colab T4 |
|
| 97 |
| GPU memory | <8 GB |
|
| 98 |
| Target diversity | 90%+ uniqueness |
|
| 99 |
|
| 100 |
-
## π Quick Start
|
| 101 |
-
|
| 102 |
-
### In Google Colab (Recommended)
|
| 103 |
-
|
| 104 |
-
```python
|
| 105 |
-
# Clone and setup
|
| 106 |
-
!git clone https://huggingface.co/krystv/neurolex-v4-creative-name-diffusion
|
| 107 |
-
%cd neurolex-v4-creative-name-diffusion
|
| 108 |
-
|
| 109 |
-
# Train (takes ~25 minutes)
|
| 110 |
-
!python train.py --size base --epochs 30 --batch_size 256
|
| 111 |
-
|
| 112 |
-
# Generate names
|
| 113 |
-
from neurolex_v4_model import *
|
| 114 |
-
checkpoint = torch.load('./checkpoints/neurolex_v4_best.pt')
|
| 115 |
-
config = NeuroLexConfig(**checkpoint['config'])
|
| 116 |
-
model = NeuroLexV4(config).cuda()
|
| 117 |
-
model.load_state_dict(checkpoint['state_dict'])
|
| 118 |
-
model.eval()
|
| 119 |
-
|
| 120 |
-
names = model.generate(
|
| 121 |
-
domain_id=DOMAIN_TO_ID['tech'],
|
| 122 |
-
style_id=STYLE_TO_ID['sharp'],
|
| 123 |
-
lang_id=LANG_TO_ID['english'],
|
| 124 |
-
target_length=8,
|
| 125 |
-
batch_size=20,
|
| 126 |
-
cfg_scale=2.5,
|
| 127 |
-
temperature=0.9,
|
| 128 |
-
n_steps=80,
|
| 129 |
-
odd_alpha=8.0,
|
| 130 |
-
device='cuda'
|
| 131 |
-
)
|
| 132 |
-
print(names)
|
| 133 |
-
```
|
| 134 |
-
|
| 135 |
-
### Generation Parameters
|
| 136 |
-
|
| 137 |
-
| Parameter | Range | Effect |
|
| 138 |
-
|-----------|-------|--------|
|
| 139 |
-
| `cfg_scale` | 1.0 - 5.0 | Higher = more faithful to conditions |
|
| 140 |
-
| `temperature` | 0.5 - 1.5 | Higher = more creative/wild |
|
| 141 |
-
| `odd_alpha` | 0.0 - 20.0 | Higher = more diversity between samples |
|
| 142 |
-
| `n_steps` | 40 - 150 | More = better quality (diminishing returns >100) |
|
| 143 |
-
| `target_length` | 3 - 14 | Desired name length in characters |
|
| 144 |
-
|
| 145 |
-
## π§ͺ Why Diffusion Beats Autoregressive for Naming
|
| 146 |
-
|
| 147 |
-
### The Mathematical Argument
|
| 148 |
-
|
| 149 |
-
**Autoregressive models** learn `P(x_t | x_{<t})` β the probability of the next character given previous ones. This creates a **directed acyclic graph** of generation paths. Once you enter a high-probability path (like "Nexβaβfβlβoβw"), you're stuck. Temperature scaling doesn't help β it just scales the same collapsed distribution.
|
| 150 |
-
|
| 151 |
-
**Diffusion models** learn `P(x_0 | x_t, t)` β how to denoise. Each sample starts from **independent random noise**, follows a **unique denoising trajectory**, and ends at a different output. There is no "most likely path" because denoising is parallel across all positions.
|
| 152 |
-
|
| 153 |
-
### Empirical Evidence
|
| 154 |
-
|
| 155 |
-
From our research:
|
| 156 |
-
- **Holtzman et al. 2019** ("Neural Text Degeneration"): AR models have a positive feedback loop where `P(repeated phrase) > P(same phrase | no context)`. This is unfixable within the AR paradigm.
|
| 157 |
-
- **MDLM (NeurIPS 2024)**: Discrete diffusion achieves near-AR perplexity while maintaining structural diversity
|
| 158 |
-
- **ODD (2025)**: Adding orthogonal repulsion during batch sampling increases diversity by +14.8% on code generation tasks with no quality loss
|
| 159 |
-
|
| 160 |
## π Repository Structure
|
| 161 |
|
| 162 |
```
|
| 163 |
-
.
|
| 164 |
-
βββ
|
| 165 |
-
βββ neurolex_v4_dataset.py # Built-in dataset (25 languages, 20 domains, augmentation)
|
| 166 |
βββ train.py # Training script (CLI)
|
|
|
|
|
|
|
|
|
|
| 167 |
βββ NeuroLex_v4_Training.ipynb # Complete Colab notebook
|
| 168 |
βββ README.md # This file
|
| 169 |
```
|
| 170 |
|
| 171 |
## π¬ Research Foundation
|
| 172 |
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
7. **ByT5** β Xue et al., 2022 ([arxiv:2105.13626](https://arxiv.org/abs/2105.13626)): Token-free multilingual models
|
| 182 |
-
8. **SimCTG** β Su et al., NeurIPS 2022 ([arxiv:2202.06417](https://arxiv.org/abs/2202.06417)): Contrastive framework for text generation diversity
|
| 183 |
-
|
| 184 |
-
## π― Use Cases
|
| 185 |
-
|
| 186 |
-
- **Brand naming**: Generate unique brand names for startups, products, services
|
| 187 |
-
- **YouTube channels**: Creative channel names that stand out
|
| 188 |
-
- **Social media handles**: Short, punchy, available-sounding usernames
|
| 189 |
-
- **Game characters/worlds**: Fantasy names with specific cultural vibes
|
| 190 |
-
- **Domain names**: Web-friendly creative names
|
| 191 |
-
- **Music projects**: Artist/band names with specific phonetic feels
|
| 192 |
-
- **Crypto/DeFi projects**: Futuristic-sounding protocol names
|
| 193 |
|
| 194 |
## π License
|
| 195 |
|
| 196 |
Apache 2.0
|
| 197 |
-
|
| 198 |
-
## π Acknowledgments
|
| 199 |
-
|
| 200 |
-
Built on research from: Kuleshov Group (Cornell), Bengio Lab (Mila), Google Brain (ByT5), and the broader discrete diffusion community.
|
| 201 |
-
|
| 202 |
-
<!-- ml-intern-provenance -->
|
| 203 |
-
## Generated by ML Intern
|
| 204 |
-
|
| 205 |
-
This model repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub.
|
| 206 |
-
|
| 207 |
-
- Try ML Intern: https://smolagents-ml-intern.hf.space
|
| 208 |
-
- Source code: https://github.com/huggingface/ml-intern
|
| 209 |
-
|
| 210 |
-
## Usage
|
| 211 |
-
|
| 212 |
-
```python
|
| 213 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 214 |
-
|
| 215 |
-
model_id = "krystv/neurolex-v4-creative-name-diffusion"
|
| 216 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 217 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 218 |
-
```
|
| 219 |
-
|
| 220 |
-
For non-causal architectures, replace `AutoModelForCausalLM` with the appropriate `AutoModel` class.
|
|
|
|
| 6 |
|
| 7 |
> A domain-specific AI architecture that generates truly creative, novel names for brands, YouTube channels, social media handles, and more β using **Uniform Discrete Language Diffusion** instead of autoregressive LLMs.
|
| 8 |
|
| 9 |
+
## π Quick Start (Colab)
|
| 10 |
+
|
| 11 |
+
```python
|
| 12 |
+
# Clone and setup
|
| 13 |
+
!git clone https://huggingface.co/krystv/neurolex-v4-creative-name-diffusion
|
| 14 |
+
%cd neurolex-v4-creative-name-diffusion
|
| 15 |
+
!python setup.py # β IMPORTANT: fixes imports
|
| 16 |
+
|
| 17 |
+
# Train (~25 minutes on free T4)
|
| 18 |
+
!python train.py --size base --epochs 30 --batch_size 256
|
| 19 |
+
|
| 20 |
+
# Generate names
|
| 21 |
+
from neurolex_v4_model import *
|
| 22 |
+
checkpoint = torch.load('./checkpoints/neurolex_v4_best.pt')
|
| 23 |
+
config = NeuroLexConfig(**checkpoint['config'])
|
| 24 |
+
model = NeuroLexV4(config).cuda()
|
| 25 |
+
model.load_state_dict(checkpoint['state_dict'])
|
| 26 |
+
model.eval()
|
| 27 |
+
|
| 28 |
+
names = model.generate(
|
| 29 |
+
domain_id=DOMAIN_TO_ID['tech'],
|
| 30 |
+
style_id=STYLE_TO_ID['sharp'],
|
| 31 |
+
lang_id=LANG_TO_ID['english'],
|
| 32 |
+
target_length=8, batch_size=20,
|
| 33 |
+
cfg_scale=2.5, temperature=0.9,
|
| 34 |
+
n_steps=80, odd_alpha=8.0, device='cuda'
|
| 35 |
+
)
|
| 36 |
+
print(names)
|
| 37 |
+
```
|
| 38 |
|
| 39 |
## π― The Problem We Solve
|
| 40 |
|
|
|
|
| 60 |
(different noise each time = different output each time)
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
### Key Innovations
|
| 64 |
|
| 65 |
| Innovation | What It Does | Based On |
|
|
|
|
| 78 |
| Parameters | ~12M (base) |
|
| 79 |
| Vocabulary | 72 characters (a-z, A-Z, 0-9, specials) |
|
| 80 |
| Max name length | 24 characters |
|
| 81 |
+
| Languages | 25 |
|
| 82 |
+
| Domains | 20 |
|
| 83 |
+
| Styles | 10 |
|
| 84 |
| Training time | ~25 min on free Colab T4 |
|
| 85 |
| GPU memory | <8 GB |
|
| 86 |
| Target diversity | 90%+ uniqueness |
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
## π Repository Structure
|
| 89 |
|
| 90 |
```
|
| 91 |
+
βββ neurolex_v4_model.py # Core UDLM architecture (DiT + CFG + ODD)
|
| 92 |
+
βββ neurolex_v4_dataset.py # Built-in dataset (25 languages, 20 domains)
|
|
|
|
| 93 |
βββ train.py # Training script (CLI)
|
| 94 |
+
βββ generate.py # Interactive generation script
|
| 95 |
+
βββ test_model.py # Validation tests
|
| 96 |
+
βββ setup.py # Run first to fix imports
|
| 97 |
βββ NeuroLex_v4_Training.ipynb # Complete Colab notebook
|
| 98 |
βββ README.md # This file
|
| 99 |
```
|
| 100 |
|
| 101 |
## π¬ Research Foundation
|
| 102 |
|
| 103 |
+
1. **MDLM** β NeurIPS 2024 ([arxiv:2406.07524](https://arxiv.org/abs/2406.07524))
|
| 104 |
+
2. **Discrete CFG** β ([arxiv:2412.10193](https://arxiv.org/abs/2412.10193))
|
| 105 |
+
3. **ODD** β ([arxiv:2603.04893](https://arxiv.org/abs/2603.04893))
|
| 106 |
+
4. **DiT** β Peebles & Xie, 2023
|
| 107 |
+
5. **GFlowNet** β NeurIPS 2021 ([arxiv:2106.04399](https://arxiv.org/abs/2106.04399))
|
| 108 |
+
6. **Sound Symbolism** β ([arxiv:2310.16781](https://arxiv.org/abs/2310.16781))
|
| 109 |
+
7. **ByT5** β ([arxiv:2105.13626](https://arxiv.org/abs/2105.13626))
|
| 110 |
+
8. **SimCTG** β NeurIPS 2022 ([arxiv:2202.06417](https://arxiv.org/abs/2202.06417))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
## π License
|
| 113 |
|
| 114 |
Apache 2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|