CoolFace
Modelpublic

majentik/Gemma-4-E4B-BF16-MERaLiON-Speech-LoRA-SG-MLX

sourceHugging Faceotherupdated 1mo agoView on Hugging Face
0likes44downloads
Model Card

Gemma-4-E4B-BF16 + MERaLiON Speech LoRA for Singapore English (MLX)

A composed Singapore-English ASR model that connects the MERaLiON-3 speech encoder to a BF16 Gemma-4-E4B decoder through a trained projector and rank-16 speech LoRA.

This BF16 release is the recommended quality-first edition: it keeps the decoder in native bfloat16, avoids quantization artifacts, and improves the standalone MERaLiON-3 baseline by 9.69 WER points on the MNSC ASR Part 2 test set.

Acknowledgment and public-release license notice

The development of this product/service was assisted by MERaLiON, an AI model developed by the Agency for Science Technology And Research ("A*STAR").

This model is a derivative work of Gemma 4 (Apache 2.0) and is distributed subject to the Gemma Terms of Use (ai.google.dev/gemma/terms) and the Gemma Prohibited Use Policy (see licenses/gemma-prohibited-use-policy.txt). All downstream users are bound by Gemma Section 3.2 use restrictions, the Gemma Prohibited Use Policy, the MERaLiON-3 Public Licence, and the Singapore Open Data Licence v1 for the MNSC-derived components.

Bundled local license texts include licenses/gemma-prohibited-use-policy.txt, licenses/gemma-4-apache-2.txt, licenses/gemma-terms.txt, licenses/meralion-public-license-v3.txt, and licenses/singapore-open-data-licence-v1.txt.

Important: this is a private full-bundle MLX release, not a vanilla transformers.pipeline checkpoint. Use the bundled runtime/ (or equivalent wiring) to connect speech_encoder/, projector/, decoder/, and lora/. Identity note: This private full-bundle package converts the SG-named adapter repo into a complete MLX bundle using the MNSC-evaluated BF16 full-bundle source. The evaluation rerun is for MNSC ASR Part 2; the SG slug is the repo identifier inherited from the prior public adapter release. No new SG-only evaluation beyond MNSC ASR Part 2 is claimed.

Result summary

Evaluated on MERaLiON Multitask National Speech Corpus v1 — ASR Part 2 Test (3000 utterance-level clips).

SystemWER ↓Notes
MERaLiON-3 baseline25.78%stock MERaLiON-3 encoder + native decoder
8-bit Gemma-4 + MERaLiON speech LoRA18.86%smaller sibling release
This BF16 release16.09%best-quality bundle
  • —Absolute improvement vs. MERaLiON-3 baseline: −9.69pp
  • —Absolute improvement vs. 8-bit sibling: −2.77pp
  • —Normalization: lowercase, ASCII punctuation stripped, whitespace collapsed, speaker-prefix tags removed from reference and hypothesis.

Audience

Currently owner-only/private. A public visibility flip is authorized only if the public-release license gate passes and the user explicitly approves the follow-up visibility change. Do not infer public status from this preparation.

Example outputs

These are actual model outputs from artifacts/run_3000_bf16_r16mlp/eval_predictions.jsonl, selected from the held-out MNSC ASR Part 2 test set. Each row scores 0% WER under the release normalizer (lowercase, punctuation removed, whitespace collapsed).

#ReferenceModel outputWER
1There IS A Food Court Selling Chicken Pasta behind Delmas' HouseThere is a food court selling Chicken Pasta behind Delma's house.0%
2what is the distance to The Seletar MallWhat is the distance to The Seletar Mall?0%
3Number sequence IS S seven six nine Zero four one three A and Date of birth IS thirteen September nineteen seventy sevenNumber sequence is S. seven, six, nine, zero, four, one, three, A, and date of birth is thirteen, September, nineteen seventy seven.0%
4six nine eight four four six eight three five threeSix, nine, eight, four, four, six, eight, three, five, three.0%
5eight five six four one seven four fiveEight, five, six, four, one, seven, four, five.0%
6Pita is a Traditional Local CuisinePita is a traditional local cuisine.0%
7it is faster to take the bus to Jalan AsasIt is faster to take the bus to Jalan Asas.0%
8a new television show documented the lives of various people including Syed Sheikh Syed Ahmad Al Hadi and Lucien WangA new television show documented the lives of various people, including Syed Sheikh Syed Ahmad Al Hadi and Lucien Wang.0%
9Hiyashi Chuka Takikomi Gohan and FuguHiyashi Chuka Takikomi Gohan and Fugu.0%
10where can I get cheap food in KathmanduWhere can I get Cheap Food in Kathmandu?0%

Across the full saved evaluation file, 1071 / 3000 utterances scored 0% WER, and another 857 scored ≤20% WER under the same normalizer.

What is inside

PathContentsPrecision
decoder/Gemma-4-E4B instruction decoder, MLX formatbfloat16
speech_encoder/MERaLiON-3 acoustic encoder + frame adaptorfp16
projector/LayerNorm -> Linear(3584,3072) -> SiLU -> Linear(3072,2560) -> RMSNormfp32
lora/rank-16 speech-alignment LoRA adapters + lora_config.jsonfp32
config.jsoncomposition manifestJSON
runtime/Bundled MLX composition and inference runtime (runtime/inference.py, runtime/meralion3/)Python
PROVENANCE.mdchain of custody, evaluation, license notesMarkdown

No MNSC-derived audio sample or sample metadata is bundled. For inference, bring your own 16 kHz mono PCM16 WAV.

The speech path is:

text
audio -> Whisper-style log-mel -> MERaLiON-3 encoder/adaptor -> 3584-d speech embeddings
      -> projector -> 2560-d Gemma embedding space -> Gemma-4-E4B BF16 + speech LoRA -> text

Quickstart

Download or locate the private full bundle. Bring your own 16 kHz mono PCM16 WAV; no MNSC-derived recording is packaged. Then use the bundled runtime from this repository root:

python
from pathlib import Path
import sys

from huggingface_hub import snapshot_download

bundle = Path(snapshot_download("majentik/Gemma-4-E4B-BF16-MERaLiON-Speech-LoRA-SG-MLX"))
sys.path.insert(0, str(bundle))

from runtime.inference import load_pipeline, transcribe_with_pipeline

pipeline = load_pipeline(
    meralion_dir=str(bundle / "speech_encoder"),
    gemma_id=str(bundle / "decoder"),
    projector_path=str(bundle / "projector"),
    lora_path=str(bundle / "lora"),
    lora_rank=16,
    lora_target_names=(
        "q_proj", "k_proj", "v_proj", "o_proj",
        "gate_proj", "up_proj", "down_proj",
    ),
)

text = transcribe_with_pipeline(pipeline, "your_audio.wav", max_tokens=128)
print(text)

Runtime notes:

  • —lora_path should point to the directory containing adapters.safetensors (lora/), not to the file itself.
  • —The target module list must match the adapter: q/k/v/o/gate/up/down across all 42 decoder layers.
  • —Use the prompt Transcribe the following audio: unless you intentionally fine-tune/evaluate a different prompt contract.
  • —The speech LoRA is switchable in the runtime: enable speech mode for ASR, disable/scale to 0.0 for plain text generation.

Intended use

Good fits:

  • —Singapore English / Singlish automatic speech recognition
  • —utterance-level voice notes, routing, search, and agent input
  • —MLX-native speech-language research with a shared text decoder

Not intended for:

  • —safety-critical or legal/medical transcription
  • —diarization, timestamps, speaker identification, or streaming ASR
  • —Mandarin-only ASR; a separate switchable Mandarin LoRA is planned

Limitations

  • —The LoRA is specialized for Singapore English. Other accents and languages may degrade.
  • —Residual errors mostly cluster around rare or ambiguous proper nouns, especially code-switched names and places.
  • —Long-form audio was not the optimization target; split long recordings into utterance-sized chunks.
  • —This repo is a composed bundle. Generic hub inference widgets will not know how to run it without the elderwise runtime.

Architecture details

  • —Speech encoder output dimension: 3584
  • —Projector hidden dimension: 3072
  • —Decoder embedding dimension: 2560
  • —Decoder depth: 42 layers
  • —LoRA rank: 16
  • —LoRA targets: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
  • —Speech-mode LoRA scale used by the release runtime: 20.0

Gemma-4's per-layer embedding side channel is handled in the runtime by supplying explicit per-layer inputs for speech positions instead of forcing speech embeddings through token nearest-neighbor recovery.

License & Attribution

See `PROVENANCE.md` for the full chain of custody. Summary:

  • —Decoder: `google/gemma-4-E4B-it`, converted to MLX bfloat16; Gemma Terms, Gemma 4 Apache 2.0 text, and the Gemma Prohibited Use Policy apply.
  • —Speech tower: `MERaLiON/MERaLiON-3-10B`; MERaLiON-3 Public Licence applies.
  • —Training/evaluation corpus: `MERaLiON/Multitask-National-Speech-Corpus-v1`, derived from IMDA National Speech Corpus / MNSC v1; Singapore Open Data Licence v1 applies to MNSC-derived training/evaluation components and requires attribution without implying official endorsement.
  • —Projector + LoRA: trained alignment components for this composition; Gemma Terms as derivative, MERaLiON-3 Public Licence for the speech-derived path, and Singapore Open Data Licence v1 for MNSC-derived training/evaluation components.

Required Gemma notice: Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms.

MERaLiON acknowledgment: The development of this product/service was assisted by MERaLiON, an AI model developed by the Agency for Science Technology And Research ("A*STAR").

This model is a derivative work of Gemma 4 (Apache 2.0) and is distributed subject to the Gemma Terms of Use (ai.google.dev/gemma/terms) and the Gemma Prohibited Use Policy (see licenses/gemma-prohibited-use-policy.txt). All downstream users are bound by Gemma Section 3.2 use restrictions, the Gemma Prohibited Use Policy, the MERaLiON-3 Public Licence, and the Singapore Open Data Licence v1 for the MNSC-derived components.

License archives are bundled in `licenses/`, and the root `NOTICE` records the required notices. No MNSC-derived audio sample is redistributed in this public-release-prep bundle.

The repository remains private until the user explicitly approves a follow-up visibility change after the public-release license gate.

Prominent modified-file notices

The following files were modified from upstream/source staging and are called out for Gemma/Apache/MERaLiON notice compliance:

  • —config.json — T6.5 stale repository slug corrected to the full-bundle repo name.
  • —speech_encoder/composite_config.json — T6.5 upstream-inherited absolute training paths redacted.
  • —speech_encoder/encoder_config.json — T6.5 upstream-inherited absolute training path redacted.
  • —README.md — T11 public-release compliance text added, including MERaLiON acknowledgment, Gemma Section 3.2 binding language, license archive links, and no-packaged-audio-sample notice.
  • —NOTICE — T11 Gemma, MERaLiON, MNSC, Apache 2.0, and Prohibited Use Policy notices expanded.
  • —PROVENANCE.md — T11 modification log and evaluation/sample provenance updated.

Citation

bibtex
@misc{gemma4_meralion_bf16_speech_lora_mlx_2026,
  title  = {Gemma-4-E4B-BF16 + MERaLiON Speech LoRA for Singapore English (MLX)},
  author = {majentik},
  year   = {2026},
  url    = {https://huggingface.co/majentik/Gemma-4-E4B-BF16-MERaLiON-Speech-LoRA-SG-MLX}
}

Related releases