--- license: apache-2.0 base_model: soketlabs/EKA-1 base_model_relation: quantized library_name: transformers pipeline_tag: text-generation tags: - eka - raslnet - mamba2 - moe - mla - int4 - int4 - weight-only --- # EKA-1 · INT4 (weight-only, W4A16 g64) This repository is a **4-bit weight-only quantized** build of [`soketlabs/EKA-1`](https://huggingface.co/soketlabs/EKA-1) (RASLNet: Mamba-2 + latent MoE + MLA, 26.3B total / 3.6B active parameters, 64K context, 256K vocab). Unlike GPTQ/AWQ/bitsandbytes builds, this checkpoint keeps the original EKA module graph and stores every eligible `nn.Linear` as a packed integer tensor plus scales, decoded by the `EkaQuantLinear` module shipped in `modeling_eka.py`. It loads with the model's own `trust_remote_code`, no external quantization library. ## Quantization spec | | | |---|---| | Scheme | symmetric weight-only, 4-bit | | INT8 | per-output-channel scale (`amax/127`) | | INT4 | group-wise, group size **64**, symmetric (`amax/7`), two nibbles per byte | | Quantized | all `nn.Linear` in attention, Mamba projections, shared experts and the 23 × 128 routed experts | | Kept BF16/FP32 | token embeddings, LM head (`output_layer`), router gate and `e_score_correction_bias` (FP32, required for routing), norms, Mamba `conv1d`/`A_log`/`D`/`dt_bias`, MLA norms | | Size on disk | **16 GB** (BF16 base: 52.6 GB) | | Dequantization | lazy, on first forward per module; VRAM then approaches the BF16 footprint | > **Hub metadata:** the parameter counter shows ~14.5B because packed `uint4` tensors store two weights per byte; the model has **26.3B** parameters (24.2B of them in 4-bit). ## Files ``` config.json configuration_eka.py generation_config.json modeling_eka.py # + EkaQuantLinear / replace_linear_with_quant model-00001-of-00003.safetensors model-00002-of-00003.safetensors model-00003-of-00003.safetensors model.safetensors.index.json tokenizer.json tokenizer.model tokenizer_config.json special_tokens_map.json chat_template.jinja README.md EKA-1_banner_light.svg eka_architecture.svg ``` `config.json` carries `eka_quantization: {"bits": 4, "group_size": 64, ...}`; `modeling_eka.py` builds `EkaQuantLinear` layers only when that key is present, so the same code file also serves the BF16 base model. ## Usage (tested) Requires **transformers 5.10.0** — EKA's hybrid cache (`build_eka_cache`) is not compatible with the 4.x cache API nor with 5.17's revised `Cache`/`ConvCache` protocol. Python 3.12, torch 2.13. ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer repo = "Dev9124/EKA-1-INT4" tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( repo, trust_remote_code=True, dtype=torch.bfloat16, device_map="auto" ).eval() messages = [{"role": "user", "content": "What is 17*23? Answer with the number only."}] inputs = tok.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt", return_dict=True ).to(model.device) with torch.no_grad(): out = model.generate(**inputs, max_new_tokens=128, do_sample=False) print(tok.decode(out[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True)) ``` Smoke-tested output (greedy, 16 tokens): `Okay, let's see. I need to calculate 17 multiplied by 23.` ## Quantization fidelity vs BF16 Single forward pass, same 12-token chat prompt, last-position logits compared with the BF16 checkpoint on the same stack: | Metric | INT8 | INT4 | |---|---|---| | cosine similarity (logits) | **0.99991** | **0.99623** | | max abs logit delta | 1.375 | 14.969 | | top-50 token overlap | 47 / 50 | 37 / 50 | | argmax token | same as BF16 | same as BF16 | This is a numerical sanity check, not a benchmark. ## Benchmarks The base model card reports (BF16): GSM8K **92.0**, MMLU-Redux **80.5**, IFEval **72.6 / 80.2** (prompt / instruction). gBench (`gsm8k`, `mmlu_redux`, `ifeval`) was run on this box against a **different 8-bit build** (vLLM online quantization: INT8 W8A16 routed experts + FP8 W8A8 linears), not against this exact checkpoint: | Suite | BF16 (model card) | 8-bit vLLM build (measured) | |---|---|---| | GSM8K | 92.0 | 68.23 strict / 81.35 flexible | | MMLU-Redux | 80.5 | 61.39 | | IFEval | 72.6 / 80.2 | 64.33 prompt-strict | The BF16 baseline was not re-run on this harness, so the gap mixes quantization and harness differences; it is **not** a like-for-like quantization-loss table. No evaluation of this INT4 checkpoint has been run yet. ## GGUF No GGUF is provided. `EkaV1ForCausalLM` (RASLNet: Mamba-2 + latent MoE + MLA) has no implementation in llama.cpp / ggml, so `convert_hf_to_gguf.py` rejects it (`Model EkaV1ForCausalLM is not supported`) and Unsloth's exporter — which wraps the same converter — cannot convert it either. A GGUF port needs a new `LLM_ARCH` (graph + kernels + tensor mapping), not just a conversion script. ## Provenance - Base: `soketlabs/EKA-1` @ `main`, 52.6 GB BF16 safetensors, Apache-2.0. - Quantizer: in-repo `EkaQuantLinear` + `replace_linear_with_quant` (`modeling_eka.py`), weight-only symmetric, no calibration data. - Hardware used: 1 × NVIDIA RTX PRO 6000 Blackwell (96 GB), CUDA 13.2.