/ Модель

Характеристики

Контекст
131 072 токена
Параметры
3,7 млрд
Размер весов
17 ГБ
Лицензия
Apache 2.0
Архитектура
qwen3 · dense
Библиотека
transformers
Опубликована
4 ноя 2026

KSA-V2-4B-base

Генерация текстаТекст → текст3 профессии

Базовая языковая модель KSA V2 на 3,7 млрд параметров для генерации текста и работы с длинным контекстом до 131 072 токенов.

144скачиваний за 30 дней1лайквеса обновлены4 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

KSA-V2-4B-base — базовая языковая модель OpenOneRec с архитектурой Kwai Summary Attention V2 (KSA V2), предназначенной для эффективной работы с длинным контекстом. В её основе — гибридный 4B-чекпойнт KSA, продолжительно дообученный на базе Qwen3-4B; модель не проходила инструкционное дообучение. В метаданных указаны 3,7 млрд параметров и контекст до 131 072 токенов.

KSA V2 сочетает сжатие ключей и значений сводных токенов для дальней памяти с разреженным выбором блоков контекста, к которым основное внимание обращается напрямую. Модель предназначена для продолжения текста и экспериментов с длинноконтекстным моделированием; метаданные также отмечают чат и интерфейс вызова инструментов. Для работы README описывает Linux, Python 3.12 и ускорители H100/H800, а также необходимость использовать каталог модели с включёнными ядрами. Веса распространяются по лицензии Apache-2.0. Поскольку модель не настроена на выполнение инструкций, качество диалоговых ответов и вызова инструментов не гарантируется карточкой.

Сценарии применения

  • генерация продолжения длинного текста
  • извлечение удалённых сведений из длинного контекста
  • эксперименты с эффективным длинноконтекстным моделированием
  • исследование сжатия контекста и разреженного внимания

Ограничения

Это базовая модель без инструкционного дообучения, поэтому она не предназначена для надёжного следования пользовательским инструкциям. Для описанного в README запуска требуются Linux, Python 3.12, ускоритель H100 или H800 и полный каталог модели с kernel/.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

📖 Introduction

Kwai Summary Attention (KSA) is our attention architecture for efficient long-context modeling. Learnable Summary tokens at fixed chunk boundaries preserve a compressed representation of distant history.

KSA V2 gives these Summaries two complementary roles:

  • Compressed KSA (C-KSA) aggregates Summary KV into compact Meta KV for more efficient long-range memory.
  • Sparse KSA (S-KSA) uses Summaries to build block-level routing keys. A lightweight Indexer selects relevant blocks, whose original KV is read directly by the main attention.

We retain Hybrid KSA's 3:1 layer layout, replacing KSA layers with C-KSA and Full layers with S-KSA.

This base model builds on our 4B Hybrid KSA backbone continually pretrained from Qwen3-4B. It is not an instruction-tuned model.

🔥 News

✨ Method

C-KSA: Summary → Meta KV. Learnable dimension-wise pooling compresses groups of Summary KV within each attention layer. Summary tokens continue through the backbone at their original chunk granularity; stronger KV compression does not require a new large-chunk backbone. Each query attends to remote Meta, boundary Summary and local text KV. Meta entries remain local to the layer that constructs them; they are not propagated as new tokens.

S-KSA: Summary → block index. A Summary query aggregates each text block into a representation for low-dimensional routing. Main attention reads the selected blocks' original KV together with sinks and local context. A blockwise-max dense-attention teacher supervises the Indexer.

Three adaptation stages. Compression-module warmup → full-parameter C-KSA CPT → S-KSA aggregation and Indexer warmup. The final stage freezes inherited parameters; its checkpoint is exported directly for sparse inference.

🤖 Model configuration

This directory contains KSA-v2-4B.

ConfigurationKSA-v2-1.9BKSA-v2-4B
Number of layers2436
Hidden size20482560
Intermediate size61449728
Attention heads (Q / KV)16 / 16 (MHA)32 / 8 (GQA)
Head dimension128128
Hybrid ratio (C-KSA : S-KSA)3 : 13 : 1
Maximum context (text tokens)131072131072
Summary chunk size88
C-KSA sliding chunk number128128
C-KSA group size12832
S-KSA block size44
S-KSA remote token budget40964096
Sink tokens88
S-KSA local window (text tokens)10241024
Indexer heads × head dimension8 × 1288 × 128
Indexer query rank512512
Indexer RoPE dimension6464
Indexer Q/K RMSNormFalseTrue
Teacher poolingmaxmax
Tied embeddingsFalseTrue

The remote budget includes eight sink tokens; the local window is additional.

Weights are stored in FP32 and loaded in BF16.

📈 Results

We evaluate KSA V2 on two Hybrid KSA backbones: a 1.9B model trained from scratch and a 4B model continually pretrained from Qwen3-4B. Both undergo three-stage adaptation; original baseline results are reused from KSA V1.

1.9B: Long-context retrieval

C-KSA uses group128 and S-KSA uses block4. Hybrid KSA is the parent model before adaptation.

Model4K8K16K32K64K128KMean
Full76.0872.8573.2469.0665.3248.7567.55
Hybrid SWA74.5471.6969.5467.8663.0356.6467.22
Hybrid SCA77.7275.2272.5567.7463.5458.0169.13
Hybrid GDN79.8376.0174.0470.4169.3959.8771.59
Pure KSA70.4465.9166.7462.5457.1339.2960.34
Hybrid KSA80.6573.3574.0772.3069.9565.3572.61
C-KSA + Full81.5272.2474.4471.9369.6166.3172.68
C-KSA + S-KSA81.4872.4275.6770.7868.9965.0172.39

4B: Scaling to a GQA backbone

C-KSA uses group32 and S-KSA uses block4, preserving the backbone's GQA structure.

Model4K8K16K32K64K128KMean
Full92.8891.3889.1284.7478.1665.8683.69
Hybrid SWA91.3088.0382.8778.9473.8866.2780.22
Hybrid SCA86.0284.2880.6776.8968.8860.9476.28
Hybrid Linear86.3983.8678.0676.4873.5067.9877.71
Pure KSA91.5586.7884.7880.3076.0966.8181.05
Hybrid KSA92.9790.5388.8686.6576.0471.6784.45
Hybrid KSA + CPT92.2289.8587.2083.0974.7472.0383.19
C-KSA + Full92.7788.1286.2782.6878.5873.9283.72
C-KSA + S-KSA93.3887.7885.4583.6080.2874.4184.15

Hybrid KSA + CPT is a continuation control with no architectural changes.

See the technical report for further ablations and inference efficiency.

Quick start

Linux, Python 3.12 and H100/H800. Download the entire model directory, including kernel/, and run from it:

python -m pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu126
python -m pip install -r requirements.txt

CUDA_VISIBLE_DEVICES=0 python generate.py \
    --prompt "The main advantage of long-context language models is" \
    --max-new-tokens 128

Omit --prompt for interactive completion. The optional --apply-chat-template only applies the tokenizer template; it does not add instruction tuning.

Transformers 5.0.0 and the bundled ksa_attn / FlashAttention CuTe sources are used. No training checkout, kernel build or FlashAttention 2 CUDA extension is required.

Transformers usage

Set the bundled kernel paths before importing Transformers:

export PYTHONPATH="$PWD/kernel:$PWD/kernel/deps${PYTHONPATH:+:$PYTHONPATH}"
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(".", local_files_only=True)
model = AutoModelForCausalLM.from_pretrained(
    ".",
    trust_remote_code=True,
    local_files_only=True,
    dtype=torch.bfloat16,
    device_map={"": "cuda:0"},
    attn_implementation="sdpa",
).eval()

inputs = tokenizer("The main advantage of long-context models is", return_tensors="pt")
inputs = inputs.to(model.device)
with torch.inference_mode():
    output = model.generate(
        **inputs,
        max_new_tokens=128,
        do_sample=False,
        pad_token_id=tokenizer.eos_token_id,
    )
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))

License and citation

Weights and our runtime: Apache-2.0. Qwen-derived files retain their copyright notices. Bundled FlashAttention CuTe retains its BSD-3-Clause license and AUTHORS; its initializer exposes CuTe without the separate FlashAttention 2 extension.

@techreport{kwai2026ksav2,
  title       = {Kwai Summary Attention V2 Technical Report},
  author      = {OneRec Team},
  year        = {2026},
  institution = {Kuaishou Technology},
  url         = {https://arxiv.org/abs/2610.18654}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
Qwen3ForCausalLM
Ревизия весов
a1111f3

0 моделей