Text Generation
Transformers
Safetensors
PyTorch
English
neollm
causal-lm
research
bf16
attention
normalization
conversational
custom_code
Instructions to use KitsuVp/NeoLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KitsuVp/NeoLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KitsuVp/NeoLLM", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("KitsuVp/NeoLLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KitsuVp/NeoLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KitsuVp/NeoLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KitsuVp/NeoLLM
- SGLang
How to use KitsuVp/NeoLLM 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 "KitsuVp/NeoLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "KitsuVp/NeoLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KitsuVp/NeoLLM with Docker Model Runner:
docker model run hf.co/KitsuVp/NeoLLM
Update configuration_neollm.py
Browse files- configuration_neollm.py +89 -1
configuration_neollm.py
CHANGED
|
@@ -363,6 +363,50 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 363 |
Reference: Rabe, Clymo & Dong (2026). *Spelling Bee Embeddings for
|
| 364 |
Language Modeling.* arXiv:2601.18030.
|
| 365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
use_hadamard_o_proj (:obj:`bool`, *optional*, defaults to ``False``):
|
| 367 |
Replace the dense ``W_O ∈ R^{d×d}`` output projection in every
|
| 368 |
multi-head attention block with a fixed Walsh–Hadamard Transform
|
|
@@ -523,6 +567,11 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 523 |
- ``use_spelling_bee_embeddings=True`` requires calling
|
| 524 |
``model.model.spelling_bee.set_byte_table(tokenizer)`` before
|
| 525 |
training (handled automatically by ``setup_model``).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
- ``repo_start_layer`` must satisfy
|
| 527 |
``0 <= repo_start_layer < num_hidden_layers`` when
|
| 528 |
``use_repo=True``, ``use_repo_grape=True`` or
|
|
@@ -698,6 +747,12 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 698 |
polynorm_exclusive=False,
|
| 699 |
# ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
|
| 700 |
use_spelling_bee_embeddings=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
# ── Context Re-Positioning (Li et al., 2026) ──────────────────────
|
| 702 |
use_repo=True,
|
| 703 |
repo_start_layer=None,
|
|
@@ -776,6 +831,30 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 776 |
f"got jtokm_top_k={jtokm_top_k}, jtokm_num_experts={jtokm_num_experts}."
|
| 777 |
)
|
| 778 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 779 |
# ── DCA: validate k-DCA source selection ──────────────────────────
|
| 780 |
if use_dca and dca_past_layers_k < 1:
|
| 781 |
raise ValueError(
|
|
@@ -866,12 +945,14 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 866 |
"use_laurel": bool(use_laurel),
|
| 867 |
"use_attn_res": bool(use_attn_res),
|
| 868 |
"use_stack_memory": bool(use_stack_memory),
|
|
|
|
| 869 |
}
|
| 870 |
_active_residual_flow = [name for name, enabled in _residual_flow_flags.items() if enabled]
|
| 871 |
if len(_active_residual_flow) > 1:
|
| 872 |
raise ValueError(
|
| 873 |
"Enable at most one residual-flow mechanism among "
|
| 874 |
-
"`use_dca`, `use_laurel`, `use_attn_res`,
|
|
|
|
| 875 |
f"Active flags: {_active_residual_flow}."
|
| 876 |
)
|
| 877 |
|
|
@@ -1015,6 +1096,13 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 1015 |
# ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
|
| 1016 |
self.use_spelling_bee_embeddings = use_spelling_bee_embeddings
|
| 1017 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1018 |
# ── Context Re-Positioning (Li et al., 2026) ──────────────────────
|
| 1019 |
self.use_repo = use_repo
|
| 1020 |
self.repo_start_layer = repo_start_layer
|
|
|
|
| 363 |
Reference: Rabe, Clymo & Dong (2026). *Spelling Bee Embeddings for
|
| 364 |
Language Modeling.* arXiv:2601.18030.
|
| 365 |
|
| 366 |
+
use_yurii_spelling_velocity (:obj:`bool`, *optional*, defaults to ``False``):
|
| 367 |
+
Enable the price-quality YuriiFormer × Spelling Bee variant used in
|
| 368 |
+
``modeling_neollm.py``. The original Spelling Bee embedding is kept
|
| 369 |
+
unchanged:
|
| 370 |
+
|
| 371 |
+
.. math::
|
| 372 |
+
X_0(t)=\frac{1}{2}\left(E_{\text{tok}}[t]+S_x(t)\right)
|
| 373 |
+
|
| 374 |
+
and an additional byte table builds a spelling-only velocity seed:
|
| 375 |
+
|
| 376 |
+
.. math::
|
| 377 |
+
V_0(t)=\frac{\lambda_v}{2}\left(S_x(t)+S_v(t)\right)
|
| 378 |
+
|
| 379 |
+
where ``S_x`` is the existing Spelling Bee character embedding and
|
| 380 |
+
``S_v`` is built from a new ``256 × hidden_size`` byte table. The
|
| 381 |
+
decoder then uses the Nesterov + Lie--Trotter update from
|
| 382 |
+
YuriiFormer, the article's best loss/price variant because it keeps
|
| 383 |
+
one attention call and one MLP call per block while adding only a
|
| 384 |
+
velocity stream, learned scalar coefficients and velocity LayerNorms.
|
| 385 |
+
This avoids YuriiFormer's full vocabulary velocity table
|
| 386 |
+
``vocab_size × hidden_size``.
|
| 387 |
+
|
| 388 |
+
Requires ``use_spelling_bee_embeddings=True`` because the velocity
|
| 389 |
+
branch intentionally reuses the original Spelling Bee spelling table
|
| 390 |
+
``S_x`` instead of replacing it.
|
| 391 |
+
|
| 392 |
+
yurii_spelling_velocity_scale (:obj:`float`, *optional*, defaults to ``0.10``):
|
| 393 |
+
Multiplicative scale ``λ_v`` applied to the initial spelling
|
| 394 |
+
velocity. Keep this small when combining with the original SBE path
|
| 395 |
+
because ``S_x`` contributes to both ``X_0`` and ``V_0``.
|
| 396 |
+
|
| 397 |
+
yurii_mu_init (:obj:`float`, *optional*, defaults to ``0.50``):
|
| 398 |
+
Initial value for the learned Nesterov lookahead coefficients
|
| 399 |
+
``μ`` in the attention and MLP substeps. Stored as logits and
|
| 400 |
+
constrained to ``(0, 1)`` during forward.
|
| 401 |
+
|
| 402 |
+
yurii_beta_init (:obj:`float`, *optional*, defaults to ``0.90``):
|
| 403 |
+
Initial value for the learned velocity carry coefficients ``β``.
|
| 404 |
+
Stored as logits and constrained to ``(0, 1)`` during forward.
|
| 405 |
+
|
| 406 |
+
yurii_gamma_init (:obj:`float`, *optional*, defaults to ``1.00``):
|
| 407 |
+
Initial value for the positive learned oracle scale coefficients
|
| 408 |
+
``γ``. Stored through an inverse-softplus parameterization.
|
| 409 |
+
|
| 410 |
use_hadamard_o_proj (:obj:`bool`, *optional*, defaults to ``False``):
|
| 411 |
Replace the dense ``W_O ∈ R^{d×d}`` output projection in every
|
| 412 |
multi-head attention block with a fixed Walsh–Hadamard Transform
|
|
|
|
| 567 |
- ``use_spelling_bee_embeddings=True`` requires calling
|
| 568 |
``model.model.spelling_bee.set_byte_table(tokenizer)`` before
|
| 569 |
training (handled automatically by ``setup_model``).
|
| 570 |
+
- ``use_yurii_spelling_velocity=True`` requires
|
| 571 |
+
``use_spelling_bee_embeddings=True`` and uses the same tokenizer byte
|
| 572 |
+
table through ``model.model.spelling_bee``. It is mutually exclusive
|
| 573 |
+
with DCA, AttnRes, LAuReL and StackMemory because it changes the
|
| 574 |
+
residual update rule into a two-stream YuriiFormer update.
|
| 575 |
- ``repo_start_layer`` must satisfy
|
| 576 |
``0 <= repo_start_layer < num_hidden_layers`` when
|
| 577 |
``use_repo=True``, ``use_repo_grape=True`` or
|
|
|
|
| 747 |
polynorm_exclusive=False,
|
| 748 |
# ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
|
| 749 |
use_spelling_bee_embeddings=True,
|
| 750 |
+
# ── YuriiFormer × Spelling Bee velocity seed (Zimin et al., 2026) ──
|
| 751 |
+
use_yurii_spelling_velocity=True,
|
| 752 |
+
yurii_spelling_velocity_scale=0.10,
|
| 753 |
+
yurii_mu_init=0.50,
|
| 754 |
+
yurii_beta_init=0.90,
|
| 755 |
+
yurii_gamma_init=1.00,
|
| 756 |
# ── Context Re-Positioning (Li et al., 2026) ──────────────────────
|
| 757 |
use_repo=True,
|
| 758 |
repo_start_layer=None,
|
|
|
|
| 831 |
f"got jtokm_top_k={jtokm_top_k}, jtokm_num_experts={jtokm_num_experts}."
|
| 832 |
)
|
| 833 |
|
| 834 |
+
# ── YuriiFormer × Spelling Bee velocity consistency ───────────────
|
| 835 |
+
if use_yurii_spelling_velocity and not use_spelling_bee_embeddings:
|
| 836 |
+
raise ValueError(
|
| 837 |
+
"`use_yurii_spelling_velocity=True` requires "
|
| 838 |
+
"`use_spelling_bee_embeddings=True`. The velocity seed is "
|
| 839 |
+
"defined as V0 = λ/2 · (S_x + S_v), so the original Spelling "
|
| 840 |
+
"Bee character table S_x must remain active."
|
| 841 |
+
)
|
| 842 |
+
if yurii_spelling_velocity_scale < 0.0:
|
| 843 |
+
raise ValueError(
|
| 844 |
+
f"`yurii_spelling_velocity_scale` must be >= 0, "
|
| 845 |
+
f"got {yurii_spelling_velocity_scale}."
|
| 846 |
+
)
|
| 847 |
+
for _name, _value in {
|
| 848 |
+
"yurii_mu_init": yurii_mu_init,
|
| 849 |
+
"yurii_beta_init": yurii_beta_init,
|
| 850 |
+
}.items():
|
| 851 |
+
if not (0.0 < float(_value) < 1.0):
|
| 852 |
+
raise ValueError(f"`{_name}` must satisfy 0 < value < 1, got {_value}.")
|
| 853 |
+
if float(yurii_gamma_init) <= 0.0:
|
| 854 |
+
raise ValueError(
|
| 855 |
+
f"`yurii_gamma_init` must be > 0, got {yurii_gamma_init}."
|
| 856 |
+
)
|
| 857 |
+
|
| 858 |
# ── DCA: validate k-DCA source selection ──────────────────────────
|
| 859 |
if use_dca and dca_past_layers_k < 1:
|
| 860 |
raise ValueError(
|
|
|
|
| 945 |
"use_laurel": bool(use_laurel),
|
| 946 |
"use_attn_res": bool(use_attn_res),
|
| 947 |
"use_stack_memory": bool(use_stack_memory),
|
| 948 |
+
"use_yurii_spelling_velocity": bool(use_yurii_spelling_velocity),
|
| 949 |
}
|
| 950 |
_active_residual_flow = [name for name, enabled in _residual_flow_flags.items() if enabled]
|
| 951 |
if len(_active_residual_flow) > 1:
|
| 952 |
raise ValueError(
|
| 953 |
"Enable at most one residual-flow mechanism among "
|
| 954 |
+
"`use_dca`, `use_laurel`, `use_attn_res`, `use_stack_memory`, "
|
| 955 |
+
"and `use_yurii_spelling_velocity`. "
|
| 956 |
f"Active flags: {_active_residual_flow}."
|
| 957 |
)
|
| 958 |
|
|
|
|
| 1096 |
# ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
|
| 1097 |
self.use_spelling_bee_embeddings = use_spelling_bee_embeddings
|
| 1098 |
|
| 1099 |
+
# ── YuriiFormer × Spelling Bee velocity seed (Zimin et al., 2026) ──
|
| 1100 |
+
self.use_yurii_spelling_velocity = bool(use_yurii_spelling_velocity)
|
| 1101 |
+
self.yurii_spelling_velocity_scale = float(yurii_spelling_velocity_scale)
|
| 1102 |
+
self.yurii_mu_init = float(yurii_mu_init)
|
| 1103 |
+
self.yurii_beta_init = float(yurii_beta_init)
|
| 1104 |
+
self.yurii_gamma_init = float(yurii_gamma_init)
|
| 1105 |
+
|
| 1106 |
# ── Context Re-Positioning (Li et al., 2026) ──────────────────────
|
| 1107 |
self.use_repo = use_repo
|
| 1108 |
self.repo_start_layer = repo_start_layer
|