An experimental bilingual (Russian + English) 1.03B total / 304M active Sparse MoE model trained from scratch on a tiny indie budget (~$44 of rented cloud GPUs), with both Vision and Audio bolted directly into a single AutoModelForCausalLM checkpoint.
This is a genuine small-scale research project, not a benchmark-chasing giant. Everything from the custom 32k RU+EN BPE tokenizer to the MoE architecture and multimodal projectors was built and debugged by hand.
hidden_size=1024, 16 routed experts top-2 + 1 shared expert, ~304M active params per token, GQA 16/4, RoPE).google/siglip2-so400m-patch16-512 (512x512 aspect-preserving letterbox) → multi-layer feature fusion ([-8, -2]) → 2x2 PixelShuffle (1024 → 256 tokens) → 2-layer GELU MLP.openai/whisper-large-v3-turbo encoder-only (128-mel) → 4x Conv1d temporal downsampler (50 Hz → 12.5 Hz, sliced to exact clip duration) → 2-layer GELU MLP.IDs 4..9 for <|image|>, <|audio|>, and start/end markers), so adding vision and audio didn't touch the embedding table.<think>...</think> when given the thinking system prompt.bfloat16 (runs at ~28–30 tok/s on an RTX 4070 8GB Laptop GPU).1.60B tokens): BTX-style MoE upcycle + knowledge pretraining using NorMuon + Adafactor (which beat fused AdamW in our local A/B sweeps while cutting optimizer VRAM).<think> traces, and multi-turn chat with protected lower LR on embeddings, shared experts, and base experts.LLaVA-ReCap-558K, the_cauldron, d0rj/LLaVA-OneVision-Data-ru, and 512px synthetic OCR/chart/count/anti-hallucination data.sberdevices_golos, librispeech_asr, AudioCaps) + 3.5B spoken QA (Vikhrmodels/Speech-Instructions, VoiceAssistant-400K) with vision + text replay.t-tech/T-Wix, t-tech/T-math, frontier reasoning traces) + vision/audio preservation replay.Being straight about what works and what doesn't at 1.60B pretrain tokens:
12.66% WER on held-out LibriSpeech clips, decent noisy Russian speech recognition, and basic direct spoken QA without a separate ASR pipeline.Direct / <think> separation (95–100% format compliance), 7/7 on synthetic POPE-style yes/no anti-hallucination, 5/5 on simple object counting, ~42% on synthetic 512px OCR, and healthy MoE load balancing (aux ~ 1.01).1.60B pretrain tokens is tiny compared to multi-trillion-token small models, so deep factual knowledge (physics, niche trivia) and nontrivial coding from scratch will hallucinate.~1.15) or no_repeat_ngram_size=5 during long free-form generation.import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "nekonode/NekoLM-1B-V4-Omni-Instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(
repo,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="auto",
).eval()
messages = [{"role": "user", "content": "Столица Франции и столица Японии?"}]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=160,
do_sample=True,
temperature=0.45,
top_p=0.9,
repetition_penalty=1.15,
no_repeat_ngram_size=5,
eos_token_id=1,
pad_token_id=2,
)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
(For Vision and Audio inference, pass pixel_values via pil_to_pixel_values() with <|vision_start|><|image|>*256<|vision_end|> or audio_features + audio_token_lengths via waveform_to_whisper_mel() with <|audio_start|><|audio|>*N<|audio_end|> — see modeling_nekolm_v4_omni.py in this repo.)
nekonode/NekoLM-300M-V3-Base, Instruct, Thinking, Looped, Vision.~2B) on way more tokens (targeting 30B+ text + full 558k vision alignment).