CoolFace
Modelpublic

BananaMind/BananaMind-2-Medium

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
17likes913downloads
Model Card

[image]

BananaMind-2-Medium

BananaMind-2-Medium is a decoder-only causal language model trained from scratch by BananaMind on a 50B-token curriculum.

The model has 49,559,552 parameters, a 3,072-token context window, and a custom 12,288-token digit-aware byte-level BPE tokenizer. It uses grouped-query attention, QK normalization, RoPE, SwiGLU, RMSNorm, tied input/output embeddings, and a KV cache for generation.

<img src="benchmarks.png" alt="BananaMind 2 Medium benchmark comparison" width="100%">

Model Details

FieldValue
Parameters49,559,552
ArchitectureBananaMind2Medium decoder-only Transformer
Layers12
Hidden size512
Intermediate size1,920
Attention heads8
KV heads2
Head dim64
Attention styleGrouped-query attention with QK norm
MLPSwiGLU
Position embeddingsRoPE
RoPE theta100,000
NormalizationRMSNorm
RMSNorm epsilon1e-6
Vocabulary size12,288
Context length3,072
EmbeddingsTied input/output embeddings
Generation cacheKV cache supported
Weight formatsafetensors
HF architectureBananaMind2MediumForCausalLM
HF model typebananamind2_medium
Final checkpointruns/bananamind2-medium/final.pt
Final training step90,421
Tokens seen49,999,749,120

Tokenizer

BananaMind-2-Medium uses a custom 12,288-token byte-level BPE tokenizer trained on 50 GiB of representative FineWeb-Edu, DCLM, Cosmopedia-v2, FineMath-4+, and NPSet-2 Python educational data. It uses NFKC normalization and digit-aware pre-tokenization.

Digits are isolated before byte-level BPE, preventing the tokenizer from merging entire numbers into large number tokens.

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

The 50B-token training mix combines educational web text, broad web text, synthetic textbook material, mathematics, and the complete local NPSet-2 Python educational corpus.

DatasetTarget TokensAggregate Share
FineWeb-Edu22.836B45.67%
DCLM10.942B21.88%
Cosmopedia-v28.564B17.13%
FineMath-4+5.233B10.47%
NPSet-2 Python Edu2.424B4.85%
Total50.000B100%

The run used a capacity-aware curriculum rather than sampling the aggregate mix uniformly from the first token.

PhaseToken RangeFineWeb-EduDCLMCosmopedia-v2FineMath-4+NPSet-2 Python Edu
Foundation0B to 10B56.47%28.52%9.11%5.29%0.61%
Skill ramp10B to 20B56.47% -> 38.47%28.52% -> 18.52%9.11% -> 22.11%5.29% -> 13.59%0.61% -> 7.31%
Reasoning hold20B to 36B38.47%18.52%22.11%13.59%7.31%
Rebalance36B to 46B38.47% -> 48.47%18.52% -> 20.52%22.11% -> 16.11%13.59% -> 10.09%7.31% -> 4.81%
Quality cooldown46B to 50B48.47%20.52%16.11%10.09%4.81%

Training Setup

FieldValue
Sequence length3,072
Micro batch12
Gradient accumulation15
Effective batch180 sequences
Tokens per optimizer step552,960
Planned optimizer steps90,422
Actual final step90,421
OptimizerAdamW
Betas0.9, 0.95
Peak learning rate1.8e-3
Warmup steps2,000
LR scheduleWarmup-stable-decay with cosine decay
Decay ratio0.15
Weight decay0.1, then 0.01 after 20B tokens
Gradient clipping1.0
Z-loss coefficient1e-4 until 20B tokens, then off
CompilePyTorch compile enabled
Seed1337

Benchmarks

Self-reported scores using lm_eval and the official ArithMark 2.0 script. Scores may vary slightly by evaluation setup.

ModelAverageHellaSwagARC EasyARC ChallengePIQAArithMark 2.0
BananaMind-2-Medium39.2732.4343.8125.3461.8628.20
Supra 1.5 Base39.5229.7848.4025.5160.0131.32
Supra 50M Base39.2131.8345.8825.0062.5127.04
Veyra2-Apricot-50M-Base38.8131.2842.4723.2962.1328.96
BananaMind-2-Mini37.6729.8039.0625.3459.4129.28

ARC Easy, ARC Challenge, PIQA, and HellaSwag use acc_norm,none. Independent Open SLM Leaderboard evaluation is not yet included.

Repository Files

FileDescription
config.jsonTransformers config for bananamind2_medium
model.safetensorsFinal exported model weights
tokenizer.jsonCustom 12,288-token digit-aware tokenizer
tokenizer_config.jsonTokenizer metadata
generation_config.jsonDefault generation config with KV caching enabled
configuration_bananamind2medium.pyCustom Transformers config class
modeling_bananamind2medium.pyCustom Transformers model class
checkpoint_metadata.jsonFinal source checkpoint, step, and token metadata
banner.pngBananaMind 2 Medium model-card banner
benchmarks.pngBase-model benchmark comparison chart

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 AutoModelForCausalLM, AutoTokenizer

model_id = "BananaMind/BananaMind-2-Medium"

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,
        use_cache=True,
    )

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-Medium is a base model intended for language-model research, local experimentation, text continuation, tokenizer research, arithmetic evaluation, 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

Benchmark Average Formula

The benchmark average groups both ARC tasks into one component:

text
ARC average = (ARC Easy + ARC Challenge) / 2
Average = (HellaSwag + ARC average + PIQA + ArithMark 2.0) / available component count

Missing components are omitted. If only one ARC score is available, that score is used as the ARC component. An average is reported only when at least two components are available.