← 开源
microsoft

Samba

[ICLR 2025] Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
978
Star
52
Fork
+-1
本周
4
贡献者
创建于 2024-06-05 · 更新于 2026-10-14 · 今日第 12268 名
主要开发者
renlleltociearyelongshen

microsoft/Samba 排名第 12,268,有 978 个星标。

同类别比较

microsoft/Samba 排名第 12,268,此处有 8 个同类条目;google-research/batch-ppo 排名第 12,267。

同类别比较
名称排名指标
NVIDIA/NVFlare12,252
语言:
Python
星标数:
981
分叉数:
294
简介:
NVIDIA Federated Learning Application Runtime Environment
facebookresearch/classifier-balancing12,254
语言:
Python
星标数:
980
分叉数:
137
简介:
This repository contains code for the paper "Decoupling Representation and Classifier for Long-Tailed Recognition", published at ICLR 2020
threedle/text2mesh12,261
语言:
Jupyter Notebook
星标数:
979
分叉数:
135
简介:
3D mesh stylization driven by a text input in PyTorch
google-research/batch-ppo12,267
语言:
Python
星标数:
978
分叉数:
147
简介:
Efficient Batched Reinforcement Learning in TensorFlow
timqian/bambot12,270
语言:
TypeScript
星标数:
978
分叉数:
96
简介:
Play with open source, low-cost AI robots with ease 🤖
jacobgil/keras-dcgan12,273
语言:
Python
星标数:
977
分叉数:
402
简介:
Keras implementation of Deep Convolutional Generative Adversarial Networks
facebookresearch/localrf12,279
语言:
Python
星标数:
976
分叉数:
60
简介:
An algorithm for reconstructing the radiance field of a large-scale scene from a single casually captured video.
konpatp/diffae12,294
语言:
Jupyter Notebook
星标数:
974
分叉数:
159
简介:
Official implementation of Diffusion Autoencoders
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
星标数978
分叉数52
贡献者4
创建日期2024-06-05
更新日期2026-10-14
1 天星标数0
7 天星标数-1
排名12,268
上次排名12,201
排名变化-67
7 天星标排名17,398
上次 7 天星标排名18,326
7 天星标排名变化928
总星标排名11,345
上次总星标排名11,328
总星标排名变化-17
国家USA
README 摘录

Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling Samba is a simple yet powerful hybrid model with an **unlimited** context length. Its architecture is frustratingly simple: Samba = Mamba + MLP + Sliding Window Attention + MLP stacking at the layer level. 2 trillion tokens from the Phi3 dataset, outperforming on major benchmarks (e. MMLU, GSM8K and HumanEval) by a large margin. Samba can also achieve perfect **long-context** retrieval ability with minimal instruction tuning, while still maintaining its **linear

complexity** with respect to sequence length. This ability leads to the impressive performance of on downstream tasks such as long-context summarization. 2 | We report 5-shot accuracy for MMLU, 8-shot CoT accuracy for GSM8K, 0-shot pass@1 for HumanEval and ROUGE-L for both GovReport and SQuALITY. Updates [July 9] We released the Phi-4-mini-flash-reasoning model which is based on SambaY architecture. Please check the new codebase for neural scaling experiments here! 22] Samba

has been accepted to ICLR 2025! 8] Added the evaluation script and more baseline architectures. [June 11] Released the codebase for training Samba-421M and Samba-1. Code Overview Our training infrastructure on SlimPajama is a modified version of TinyLlama and LitGPT. One can easily specify different architectual configurations through modifying the and the which includes tons of baseline architectures mentioned in the paper. Our RetNet and GLA implementations are from the awesome Flash Linear Attention repository. Pretraining Samba from

scratch Please follow the to setup the environment. The data preparation mainly follows TinyLlama except that we only use the SlimPajama dataset. Data Preparation Download the Slimpajama dataset to your chosen directory. We also provide the pre-tokenized data here. The SlimPajama dataset takes 893GB diskspace. Use the provided scripts to tokenize the datasets and divide them into chunks. Training The following script trains a default Samba-421M model on a single node of 8 GPUs with 20B tokens. 3B

" and to "tsz512x4k_100B" for training a Samba-1. We assume that you have 8 nodes each with 8 GPUs, and you can modify the number of for training on fewer gpus. Evaluation We leverage lm-evaluation-harness for the evaluation of our pretrained models. We only support non-generation based tasks for now. Citation If you find our work useful, please consider citing: Contact Liliang Ren (liliangren@microsoft.

常见问题

记录了多少星标和分叉?

microsoft/Samba 有 978 个星标和 52 个分叉。

仓库排名是多少?

microsoft/Samba 排名第 12,268。

记录的语言和类别是什么?

microsoft/Samba 有 978 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

microsoft/Samba 与 google-research/batch-ppo 比较,后者排名第 12,267,有 978 个星标。

README

Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling

Samba is a simple yet powerful hybrid model with an unlimited context length. Its architecture is frustratingly simple:

Samba = Mamba + MLP + Sliding Window Attention + MLP stacking at the layer level.

Our largest model, Samba-3.8B, is trained on 3.2 trillion tokens from the Phi3 dataset, outperforming Phi3-mini on major benchmarks (e.g. MMLU, GSM8K and HumanEval) by a large margin. Samba can also achieve perfect long-context retrieval ability with minimal instruction tuning, while still maintaining its linear complexity with respect to sequence length. This ability leads to the impressive performance of Samba-3.8B-instruct on downstream tasks such as long-context summarization.

Performance :rocket:

Model MMLU GSM8K HumanEval GovReport SQuALITY
Phi-3-mini-4K-instruct 68.8 82.5 58.5 14.4 21.6
Samba-3.8B-instruct (preview) 71.9 87.6 62.8 18.9 21.2

We report 5-shot accuracy for MMLU, 8-shot CoT accuracy for GSM8K, 0-shot pass@1 for HumanEval and ROUGE-L for both GovReport and SQuALITY.

Updates

  • [July 9] We released the Phi-4-mini-flash-reasoning model which is based on SambaY architecture. Please check the new codebase for neural scaling experiments here!
  • [Jan. 22] Samba has been accepted to ICLR 2025!
  • [Dec. 8] Added the evaluation script and more baseline architectures.
  • [June 11] Released the codebase for training Samba-421M and Samba-1.3B on SlimPajama.

Code Overview

Our training infrastructure on SlimPajama is a modified version of TinyLlama and LitGPT. One can easily specify different architectual configurations through modifying the model_name and the config file which includes tons of baseline architectures mentioned in the paper. Our RetNet and GLA implementations are from the awesome Flash Linear Attention repository.

Pretraining Samba from scratch

Please follow the Dockerfile to setup the environment. The data preparation mainly follows TinyLlama except that we only use the SlimPajama dataset.

Data Preparation

Download the Slimpajama dataset to your chosen directory. We also provide the pre-tokenized data here.

cd /path/to/dataset
git lfs install
git clone https://huggingface.co/datasets/cerebras/SlimPajama-627B

The SlimPajama dataset takes 893GB diskspace. Use the provided scripts to tokenize the datasets and divide them into chunks.

python scripts/prepare_slimpajama.py --source_path /path/to/SlimPajama --tokenizer_path data/llama  --destination_path data/slim --split validation --percentage 1.0
python scripts/prepare_slimpajama.py --source_path /path/to/SlimPajama --tokenizer_path data/llama  --destination_path data/slim --split train --percentage 1.0

You are now ready to launch a job!

Training

The following script trains a default Samba-421M model on a single node of 8 GPUs with 20B tokens.

torchrun --nnodes=1 --nproc_per_node=8 --rdzv_id=samba-421M --rdzv_backend=c10d  --rdzv_endpoint=${MASTER_ADDR}:${MASTER_PORT} pretrain.py --train_data_dir data/slim --val_data_dir data/slim 

You can modify model_name to "Samba_1.3B" and train_config to "tsz512x4k_100B" for training a Samba-1.3B model with 100B tokens. We assume that you have 8 nodes each with 8 GPUs, and you can modify the number of nodes for training on fewer gpus.

Evaluation

We leverage lm-evaluation-harness for the evaluation of our pretrained models. We only support non-generation based tasks for now.

pip install lm-eval
python eval.py --model Samba \
          --model_args pretrained=path/to/ckpt.pth,config="Samba_1.3B" \
          --tasks lambada_openai,arc_easy,winogrande,hellaswag,piqa --device cuda:0 --batch_size 1 --trust_remote_code 

Citation

If you find our work useful, please consider citing:

@article{ren2024samba,
      title={Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling}, 
      author={Liliang Ren and Yang Liu and Yadong Lu and Yelong Shen and Chen Liang and Weizhu Chen},
      journal = {arXiv preprint},
      year={2024},
      url={https://arxiv.org/abs/2406.07522}
}

Contact

Liliang Ren (liliangren@microsoft.com)

排名相邻
同类项目