Module nllb

Module nllb 

Source
Expand description

Served NLLB-200 / M2M-100 encoder-decoder translation model.

Atlas’s production engine is decoder-only + GPU-only; NLLB is seq2seq (bidirectional encoder + decoder cross-attention + sinusoidal positions + ReLU FFN + biased LayerNorm). This module promotes the validated bf16 CUDA runtime (examples/nllb_cuda_bf16) into a first-class crate::traits::Model so spark serve --model <nllb-dir> translates through the SAME scheduler, OpenAI API, sampling and (later) LoRA path as every other model — no parallel server, no hardcoded paths (weights come from the standard --model store).

The model owns ALL its KV (the scheduler’s paged block cache is unused): a per-sequence decoder self-attn cache that grows one row per token plus a fixed cross-attn cache computed once from the encoder. See the kv module. Logits are bf16 — the scheduler’s default sampling path — so no fp32 overrides are needed.

Structs§

NllbGpuModel
The served NLLB encoder-decoder model. Send + Sync: every field is either immutable after construction or behind a Mutex; DevicePtr is a Copy device handle and the GPU-side buffers are driven only through &self.
NllbLang
Resolved per-deployment translation tokens. src_lang_id/tgt_lang_id come from --src-lang/--tgt-lang (or a recipe default) resolved through the tokenizer at serve start; the rest are M2M-100/NLLB architectural constants.