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 +27 -3
configuration_neollm.py
CHANGED
|
@@ -349,6 +349,20 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 349 |
is less rich than the full hidden representation. Ignored
|
| 350 |
when ``use_repo=False``.
|
| 351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
use_laurel (:obj:`bool`, *optional*, defaults to ``False``):
|
| 353 |
Enable the Learned Augmented Residual Layer (LAUREL) framework
|
| 354 |
(Menghani, Kumar & Kumar, ICML 2025). LAUREL generalises the
|
|
@@ -426,7 +440,7 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 426 |
training (handled automatically by ``setup_model``).
|
| 427 |
- ``repo_start_layer`` must satisfy
|
| 428 |
``0 <= repo_start_layer < num_hidden_layers`` when
|
| 429 |
-
``use_repo=True``.
|
| 430 |
- ``use_laurel=True`` is incompatible with ``use_attn_res=True``.
|
| 431 |
- When ``use_laurel=True``, at least one of ``use_laurel_rw`` or
|
| 432 |
``use_laurel_lr`` must be ``True``.
|
|
@@ -462,6 +476,11 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 462 |
... # repo_d_p defaults to hidden_size // 8 = 64
|
| 463 |
... )
|
| 464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
References:
|
| 466 |
Bae, J. et al. (2026). *Affine-Scaled Attention: Towards Flexible and
|
| 467 |
Stable Transformer Attention.* arXiv:2602.23057.
|
|
@@ -486,6 +505,9 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 486 |
Li, H., Zhao, T., Cai, D. & Sproat, R. (2026). *REPO: Language Models
|
| 487 |
with Context Re-Positioning.* arXiv:2512.14391.
|
| 488 |
|
|
|
|
|
|
|
|
|
|
| 489 |
Menghani, G., Kumar, R. & Kumar, S. (2025). *LAUREL: Learned Augmented
|
| 490 |
Residual Layer.* ICML 2025. arXiv:2411.07501.
|
| 491 |
"""
|
|
@@ -560,6 +582,7 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 560 |
use_repo=True,
|
| 561 |
repo_start_layer=None,
|
| 562 |
repo_d_p=None,
|
|
|
|
| 563 |
# ── VersatileFFN (Nie et al., 2026) ───────────────────────────────
|
| 564 |
use_versatile_ffn=False,
|
| 565 |
versatile_total_experts=4,
|
|
@@ -575,7 +598,7 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 575 |
use_laurel_lr=False,
|
| 576 |
laurel_lr_rank=32,
|
| 577 |
# ── Interleaved Head Attention (Duvvuri et al., 2026) ─────────────
|
| 578 |
-
use_iha=
|
| 579 |
iha_num_pseudo_heads=2, # P=2 → 2×2=4 patrones por head
|
| 580 |
iha_local_global_pattern="LLLLG", # 4 locales + 1 global (paper §5.1)
|
| 581 |
iha_sliding_window=None, # auto = N // (2*P^2) usando la longitud real del batch
|
|
@@ -619,7 +642,7 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 619 |
repo_start_layer = num_hidden_layers // 3
|
| 620 |
if repo_d_p is None:
|
| 621 |
repo_d_p = hidden_size // 8
|
| 622 |
-
if use_repo and not (0 <= repo_start_layer < num_hidden_layers):
|
| 623 |
raise ValueError(
|
| 624 |
f"`repo_start_layer` must satisfy "
|
| 625 |
f"0 <= repo_start_layer < num_hidden_layers, "
|
|
@@ -765,6 +788,7 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 765 |
self.use_repo = use_repo
|
| 766 |
self.repo_start_layer = repo_start_layer
|
| 767 |
self.repo_d_p = repo_d_p
|
|
|
|
| 768 |
|
| 769 |
# ── VersatileFFN (Nie et al., 2026) ───────────────────────────────
|
| 770 |
self.use_versatile_ffn = use_versatile_ffn
|
|
|
|
| 349 |
is less rich than the full hidden representation. Ignored
|
| 350 |
when ``use_repo=False``.
|
| 351 |
|
| 352 |
+
use_repo_grape (:obj:`bool`, *optional*, defaults to ``False``):
|
| 353 |
+
Enable the proposed REPO-GRAPE positional operator. This reuses
|
| 354 |
+
the REPO coordinate module ``f_ϕ`` and replaces the RoPE action
|
| 355 |
+
with a GRAPE-M action using a learned per-head/per-plane angular
|
| 356 |
+
spectrum:
|
| 357 |
+
|
| 358 |
+
.. math::
|
| 359 |
+
u_i^{(h)} = z_i^{(h)}, \\quad
|
| 360 |
+
\\theta_{h,r}=\\theta^0_r\\exp(s_{h,r})
|
| 361 |
+
|
| 362 |
+
When enabled, REPO-GRAPE activates the REPO coordinate path at
|
| 363 |
+
``repo_start_layer`` even if ``use_repo=False``. Lower layers keep
|
| 364 |
+
standard integer RoPE.
|
| 365 |
+
|
| 366 |
use_laurel (:obj:`bool`, *optional*, defaults to ``False``):
|
| 367 |
Enable the Learned Augmented Residual Layer (LAUREL) framework
|
| 368 |
(Menghani, Kumar & Kumar, ICML 2025). LAUREL generalises the
|
|
|
|
| 440 |
training (handled automatically by ``setup_model``).
|
| 441 |
- ``repo_start_layer`` must satisfy
|
| 442 |
``0 <= repo_start_layer < num_hidden_layers`` when
|
| 443 |
+
``use_repo=True`` or ``use_repo_grape=True``.
|
| 444 |
- ``use_laurel=True`` is incompatible with ``use_attn_res=True``.
|
| 445 |
- When ``use_laurel=True``, at least one of ``use_laurel_rw`` or
|
| 446 |
``use_laurel_lr`` must be ``True``.
|
|
|
|
| 476 |
... # repo_d_p defaults to hidden_size // 8 = 64
|
| 477 |
... )
|
| 478 |
|
| 479 |
+
>>> # Proposed REPO-GRAPE-M: REPO coordinates + learned GRAPE spectrum
|
| 480 |
+
>>> config_repo_grape = NeoLLMConfig(
|
| 481 |
+
... use_repo_grape=True,
|
| 482 |
+
... )
|
| 483 |
+
|
| 484 |
References:
|
| 485 |
Bae, J. et al. (2026). *Affine-Scaled Attention: Towards Flexible and
|
| 486 |
Stable Transformer Attention.* arXiv:2602.23057.
|
|
|
|
| 505 |
Li, H., Zhao, T., Cai, D. & Sproat, R. (2026). *REPO: Language Models
|
| 506 |
with Context Re-Positioning.* arXiv:2512.14391.
|
| 507 |
|
| 508 |
+
Zhang, Y. et al. (2026). *Group Representational Position Encoding.*
|
| 509 |
+
ICLR 2026 / arXiv:2512.07805.
|
| 510 |
+
|
| 511 |
Menghani, G., Kumar, R. & Kumar, S. (2025). *LAUREL: Learned Augmented
|
| 512 |
Residual Layer.* ICML 2025. arXiv:2411.07501.
|
| 513 |
"""
|
|
|
|
| 582 |
use_repo=True,
|
| 583 |
repo_start_layer=None,
|
| 584 |
repo_d_p=None,
|
| 585 |
+
use_repo_grape=True,
|
| 586 |
# ── VersatileFFN (Nie et al., 2026) ───────────────────────────────
|
| 587 |
use_versatile_ffn=False,
|
| 588 |
versatile_total_experts=4,
|
|
|
|
| 598 |
use_laurel_lr=False,
|
| 599 |
laurel_lr_rank=32,
|
| 600 |
# ── Interleaved Head Attention (Duvvuri et al., 2026) ─────────────
|
| 601 |
+
use_iha=False,
|
| 602 |
iha_num_pseudo_heads=2, # P=2 → 2×2=4 patrones por head
|
| 603 |
iha_local_global_pattern="LLLLG", # 4 locales + 1 global (paper §5.1)
|
| 604 |
iha_sliding_window=None, # auto = N // (2*P^2) usando la longitud real del batch
|
|
|
|
| 642 |
repo_start_layer = num_hidden_layers // 3
|
| 643 |
if repo_d_p is None:
|
| 644 |
repo_d_p = hidden_size // 8
|
| 645 |
+
if (use_repo or use_repo_grape) and not (0 <= repo_start_layer < num_hidden_layers):
|
| 646 |
raise ValueError(
|
| 647 |
f"`repo_start_layer` must satisfy "
|
| 648 |
f"0 <= repo_start_layer < num_hidden_layers, "
|
|
|
|
| 788 |
self.use_repo = use_repo
|
| 789 |
self.repo_start_layer = repo_start_layer
|
| 790 |
self.repo_d_p = repo_d_p
|
| 791 |
+
self.use_repo_grape = use_repo_grape
|
| 792 |
|
| 793 |
# ── VersatileFFN (Nie et al., 2026) ───────────────────────────────
|
| 794 |
self.use_versatile_ffn = use_versatile_ffn
|