Download README.md from typealias/Haru-4B-CoreAI: direct link, hf CLI and curl.
- Browser
- Download file 7.93 kB
-
https://huggingface.co/typealias/Haru-4B-CoreAI/resolve/main/README.md
- Command line
-
hf download hf://typealias/Haru-4B-CoreAI/README.md
-
curl -L -o README.md https://huggingface.co/typealias/Haru-4B-CoreAI/resolve/main/README.md
license: apache-2.0
base_model: higurashi-ai/Haru-4B
language:
- ja
- en
- zh
- ko
- es
- pt
- de
- fr
- ru
pipeline_tag: audio-to-audio
tags:
- coreai
- apple-silicon
- metal4
- swift
- macos
- speech
- full-duplex
- speech-to-speech
- haru
Haru-4B Core AI (Apple Silicon + Native macOS App)
High-performance native Apple Core AI + Metal 4 port of higurashi-ai/Haru-4B β a 7.5 Hz full-duplex continuous speech-to-speech dialogue model β packaged with ready-to-run Core AI weights (weights/) AND a native Swift 6 / SwiftUI macOS full-duplex voice app (app/HaruCoreAI-macOS.zip + full SwiftPM source).
Built for Japanese, English, and mixed JP/EN code-switching live voice conversations on Apple Silicon, decisively beating haru_mlx (int8 & bf16) on latency, footprint, load time, and audio/logit quality.
Performance & Bilingual Quality vs haru_mlx (Apple M4 Pro)
Measured on Apple M4 Pro (48 GB Unified Memory, macOS 27.3, 50 timed frames after 10 warmup; 7.5 Hz real-time budget = 133.3 ms/frame):
| Metric | haru_mlx bf16 |
haru_mlx int8 (g=64) |
Haru-4B Core AI (this repo) |
Gain vs haru_mlx int8 |
|---|---|---|---|---|
| E2E Full Frame (p50 / min) | 56.78 ms | 37.44 ms | 29.32 / 28.79 ms | 1.28x faster (-8.12 ms) |
| Live Critical Path (p50 / min) | 55.25 ms | 34.86 ms | 27.39 / 26.72 ms | 1.27x faster (-7.47 ms) |
| Prefill (169 pos, warm) | 301.29 ms | 317.90 ms | 307.42 ms | 1.03x faster (-10.48 ms) |
| Warm Model Load | ~1.2 s | 0.76 s | 0.00β0.01 s (OS cache) | ~76x faster |
| Real-Time Factor (RTF) | 2.35x | 3.56x | 4.55x E2E / 4.87x Live | +1.31x headroom |
| Model Asset / Weight Size | 10.68 GB | 6.74 GB | 5.48 GB | 1.26 GB smaller (-18.7%) |
Compiled GPU Quality vs PyTorch bfloat16 Ground Truth (40 Streaming Frames)
| Suite | Metric | haru_mlx bf16 |
haru_mlx int8 |
Haru-4B Core AI | vs haru_mlx int8 |
|---|---|---|---|---|---|
| English | Codec Enc / Dec PSNR | 43.99 / 64.71 dB | 43.99 / 64.71 dB | 48.53 / 66.46 dB | +4.54 / +1.75 dB |
| English | Codec Multi-Res STFT L1 | 0.00021 | 0.00021 | 0.00018 | 1.17x lower error |
| English | LM Logits KL Div / Top-1 | 0.00194 / 100% | 0.00323 / 100% | 0.00224 / 100% | 1.44x lower KL |
| English | PAD/EOP Margin MAE | 0.0481 | 0.2102 | 0.1328 | 1.58x better |
| English | MeanFlow Head E2E PSNR | 43.64 dB | 38.06 dB | 38.93 dB | +0.87 dB |
| JP / Mixed | Codec Enc / Dec PSNR | 42.75 / 63.61 dB | 42.75 / 63.61 dB | 43.65 / 64.53 dB | +0.90 / +0.92 dB |
| JP / Mixed | Codec Multi-Res STFT L1 | 0.00024 | 0.00024 | 0.00022 | 1.09x lower error |
| JP / Mixed | LM Logits PSNR / Top-5 | 49.92 dB / 100% | 43.56 dB / 100% | 46.33 dB / 100% | +2.77 dB |
| JP / Mixed | PAD/EOP Margin MAE | 0.0316 | 0.1454 | 0.0531 | 2.74x better |
| JP / Mixed | MeanFlow Head E2E PSNR | 42.81 dB | 32.97 dB | 35.25 dB | +2.28 dB |
See LOG.md for the complete engineering log, 32-layer quantization sensitivity analysis, and ablation tables.
Quickstart: Native macOS App (HaruCoreAI.app)
Requirements: Apple Silicon Mac (M1/M2/M3/M4) running macOS 27.0+ (native CoreAI.framework).
Option A β Download the Prebuilt App
- Download
app/HaruCoreAI-macOS.zip(3.1 MB) and unzipHaruCoreAI.app. - Open
HaruCoreAI.app(if macOS warns about ad-hoc signature, right-click β Open or runxattr -dr com.apple.quarantine HaruCoreAI.app). - Click Download from Hugging Face inside the app to pull
weights/(5.48 GB) automatically β or point it at a localweights/folder via Choose Local Folderβ¦ (βO). - Pick a preset (γγ« Β· Bilingual JP/EN, γγ« Β· ζ₯ζ¬θͺ, or Haru Β· English), optionally load any 3β12 s custom voice clip (
.wav/.m4a/.mp3), and press Start Conversation (βReturn).
Option B β Build from Source (Swift 6 / SwiftPM)
hf download typealias/Haru-4B-CoreAI --local-dir ./Haru-4B-CoreAI
cd Haru-4B-CoreAI/app/swift
# Build the macOS app + HaruCoreAIRuntime library + haru-bench CLI
swift build -c release
# Run the native SwiftUI app
.build/release/HaruCoreAI
# Or run the CLI benchmark against the downloaded weights
.build/release/haru-bench ../../weights
Key Technical Optimizations
- Zero-Copy Pipelined
ComputeStreamRuntime (HaruCoreAIRuntime): Encodescodec.encode_frontβcodec.encode_backβlm_stepβcodec.decodeover shared ping-pongMTLBuffers on a single Core AIComputeStream, eliminating inter-stage CPU-GPU stalls. - 6 Custom Metal 4
TorchMetalKernels:gdn_conv_silu_step_8192: fuses GatedDeltaNet conv-state shift + 4-tap depthwise conv (fp32accum) +SiLU+q/k/vsplit + GQArepeat_interleave(2)+ transpose into 1 dispatch per layer (-432 ops/frame).causal_depthwise_mixer_k7_tiled8&causal_depthwise_mixer_k7_t1: 8-step register shift-register tiled depthwise conv (256threads/TG).conv_transpose_overlap_add: pre-permuted zero-transposeConvTranspose1d+ fused overlap-add & state update.enc_stem_conv1d_k7&dec_head_conv1d_k7_clamp: zero-copy stride-1 stem/head convolutions.
- Surgical Mixed-Precision & Algebraic Folding:
- LM & tied embeddings in
bfloat16compute +uint8 per_block=128 minval(avoiding fp16 overflow in layers 27β31 where activations peak at 182k, and avoiding 4-bit degradation identified in our 32-layer EN + JP/EN sensitivity scan). - Exact uncompressed
float32[PAD, EOP]rows (20 KB) preserved outside quantized embeddings, yielding 2.74x better JP/EN turn-taking precision (PAD/EOP MAE = 0.0531). MeanFlowHeadinfloat16(u8_pb64with 10-bit scale mantissa + precomputed scalar embeddings eliminating 8 linears / ~60 MB per frame).- VibeVoice Codec v3 with load-time LayerScale (
gamma/ffn_gamma) folding + hybrid quantization (u8_pb64only on bandwidth-bound Stages 5β6 enc / 0β1 dec; uncompressedbf16on compute-bound small stages).
- LM & tied embeddings in
- 100% Pure-Swift Bilingual App: Zero Python runtime dependency β includes a pure-Swift Qwen3.5 ByteLevel BPE tokenizer, incremental multi-byte UTF-8 Japanese/English
StreamDetokenizer, exact DRY repetition penalty, AppleAVAudioEngineVoice Processing (AEC + NS) at 24 kHz, and built-in HF Hub downloader.
Repository Layout
βββ README.md # Model card & usage guide
βββ LOG.md # Full engineering log, ablations & sensitivity sweeps
βββ weights/ # Ready-to-run Core AI bundle (5.48 GB)
β βββ haru_lm.aimodel/ # 4.72 GB multi-entrypoint LM + MeanFlowHead (`step` + `prefill`)
β βββ haru_codec.aimodel/ # 0.76 GB VibeVoice Codec v3 (`encode_full`, `encode_front`, `encode_back`, `decode`)
β βββ codec_meta.json
β βββ config.json
β βββ tokenizer.json
β βββ tokenizer_config.json
βββ app/
β βββ HaruCoreAI-macOS.zip # Ready-to-run signed macOS app bundle (3.1 MB)
β βββ swift/ # Swift 6 SwiftPM package (HaruCoreAIRuntime, HaruApp, HaruBench, Tests)
βββ export/ # Reproducible Python Core AI export pipeline (`coreai-torch`, `coreai-opt`, `coreai-models`)
βββ benchmarks/ # Baseline & optimization JSON metrics + EN/JP-EN sample outputs
Credits
- Base model & architecture:
higurashi-ai/Haru-4B(Apache 2.0) - Core AI port, Metal 4 kernels, Swift 6 runtime, and macOS app:
typealias