CoolFace
Modelpublic

BananaMind/BananaMind-2-Mini

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
14likes339downloads
Model Card

[image]

BananaMind-2-Mini

BananaMind-2-Mini is a small decoder-only causal language model trained from scratch by BananaMind on a 30B-token curriculum. It is our first model in the BananaMind 2 Series!

The model has 25,178,752 parameters, a 4,096 token context window, and a custom 8k-token digit-aware byte-level BPE tokenizer.

Model Details

FieldValue
Parameters25,178,752
ArchitectureBananaMind2Mini decoder-only Transformer
Layers14
Hidden size384
Intermediate size1,024
Attention heads6
KV heads2
Head dim64
Attention styleGrouped-query attention with QK norm
MLPSwiGLU
Position embeddingsRoPE
RoPE theta100,000
NormalizationRMSNorm
RMSNorm epsilon1e-6
Vocab size8,192
Context length4,096
EmbeddingsTied input/output embeddings
Weight formatsafetensors
HF architectureBananaMind2MiniForCausalLM
HF model typebananamind2_mini
Final checkpointruns/bananamind2-mini/final.pt
Final training step55,485
Tokens seen29,999,726,592

Credits to AxiomicLabs and GPT X2 125M for the architecture inspiration.

Tokenizer

BananaMind-2-Mini uses a custom 8k byte-level BPE tokenizer trained from FineWeb-Edu text with digit-aware pre-tokenization.

Digits are kept as separate tokens so numbers do not collapse into large number tokens during tokenization.

Digit IDs:

TokenID
019
120
221
322
423
524
625
726
827
928

Examples:

text
18  -> [20, 27]
227 -> [21, 21, 26]

Special token IDs:

TokenID
<pad>0
<bos>1
<eos>2
<unk>3

Training Data

BananaMind-2-Mini was trained on a 30B-token mix of web, educational, synthetic textbook, and math data.

DatasetTarget TokensShare
FineWeb-Edu16.5B55%
DCLM9.0B30%
Cosmopedia-v23.0B10%
FineMath-4+1.5B5%
Total30.0B100%

The run used a progressive curriculum rather than sampling the final aggregate mix from the first token.

PhaseToken RangeMix
Web-heavy start0B to 7.2B60% FineWeb-Edu, 38% DCLM, 1% Cosmopedia-v2, 1% FineMath-4+
Curriculum ramp7.2B to 8.0BRamps toward more synthetic and math data
Main mix8.0B to 18.0B55% FineWeb-Edu, 32% DCLM, 8% Cosmopedia-v2, 5% FineMath-4+
Aggregate taper18.0B to 23.2BTapers toward the final aggregate target
Final mix23.2B to 30.0B50.957% FineWeb-Edu, 20.766% DCLM, 20.043% Cosmopedia-v2, 8.234% FineMath-4+

Training Setup

FieldValue
Sequence length4,096
Micro batch12
Gradient accumulation11
Effective batch132 sequences
Tokens per optimizer step540,672
Planned optimizer steps55,486
Actual final step55,485
OptimizerAdamW
Betas0.9, 0.95
Peak learning rate2.3e-3
Warmup steps1,750
LR scheduleWarmup-stable-decay with cosine decay
Decay ratio0.15
Weight decay0.1, then 0.01 after 12B tokens
Gradient clipping1.0
Z-loss coefficient1e-4 until 12B tokens, then off
CompilePyTorch compile enabled
Seed1337

Evaluation

Self-reported benchmark scores using lm_eval. Scores may vary a bit depending on harness version, runtime settings, dtype, and evaluation environment.

All task scores below use acc_norm,none. Average is the mean over ARC Easy, PIQA, ARC Challenge, and HellaSwag.

ModelAverageARC EasyPIQAARC ChallengeHellaSwag
BananaMind-2-Mini38.7239.8659.6325.6829.72
Zupra-1.6-50M-Instruct-Ultra-exp39.4743.1459.4725.6029.68
BananaMind-1.5-Base39.4642.4760.6123.9830.77
MiniBananaMind-v4-9M35.0734.9755.3923.0426.87
Pythia-31M34.7934.0156.4721.4227.28

Higher is better on the y-axis, and more parameters are farther right on the x-axis. The top-left region represents the most score-efficient models.

[image]

Repository Files

FileDescription
config.jsonTransformers config for bananamind2_mini
model.safetensorsFinal exported model weights
tokenizer.jsonCustom 8k digit-aware tokenizer
tokenizer_config.jsonTokenizer metadata
generation_config.jsonDefault generation config
configuration_bananamind2mini.pyCustom Transformers config class
modeling_bananamind2mini.pyCustom Transformers model class
checkpoint_metadata.jsonSource checkpoint, step, and token metadata

Usage

This model uses custom architecture code, so load it with trust_remote_code=True.

Install dependencies:

bash
pip install -U transformers safetensors torch

Run inference:

python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "BananaMind/BananaMind-2-Mini"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)

device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = (
    torch.bfloat16
    if torch.cuda.is_available() and torch.cuda.is_bf16_supported()
    else torch.float32
)

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    torch_dtype=dtype,
).to(device).eval()

prompt = "The color of the sky is"
inputs = tokenizer(prompt, return_tensors="pt").to(device)

with torch.no_grad():
    output = model.generate(
        **inputs,
        max_new_tokens=96,
        do_sample=True,
        temperature=0.7,
        top_p=0.9,
        repetition_penalty=1.1,
        pad_token_id=tokenizer.eos_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

print(tokenizer.decode(output[0], skip_special_tokens=True))

Suggested Generation Settings

For stable continuations:

  • —do_sample=False
  • —repetition_penalty=1.1
  • —max_new_tokens=64 to 160

For more varied text:

  • —do_sample=True
  • —temperature=0.6 to 0.8
  • —top_p=0.9
  • —top_k=50
  • —repetition_penalty=1.1
  • —max_new_tokens=64 to 192

Intended Use

BananaMind-2-Mini is intended for lightweight language-model research, local experimentation, text continuation, tokenizer experiments, and small-model training comparisons.

Because this is a base model, prompts should be written as continuation prompts rather than chat messages.

License

Apache 2.0

🍌