Open Source Models·7 min read

Best Local Embedding Models for RAG on Apple Silicon

Compare the best local embedding models for RAG on Apple Silicon. Benchmark ModernBERT, BGE, and Nomic with low RAM usage and fast retrieval on iOS.

Detailed architectural macro photograph of dark silicon microchip dies and geometric computing structures
Photo: Maxence Pira · Unsplash
Key takeaways
  • Bounded DRAM Co-existence Under 5.0 GB Jetsam Ceilings: Deploying local RAG on 8 GB devices like the iPhone 15 Pro and iPhone 16 Pro requires strict memory partitioning. Quantizing bi-encoder weights to INT8 bounds embedding footprint to 142-152 MB, leaving ample DRAM headroom for a 4-bit 3B autoregressive LLM and dynamic KV caches without triggering kernel memory terminations.
  • Matryoshka Dimension Slicing Cuts Vector Index RAM by 66%: Nomic Embed Text v1.5's native Matryoshka Representation Learning (MRL) allows truncating embeddings from 768 down to 256 dimensions. This reduces a 10,000-chunk index footprint from 30.7 MB to 10.2 MB and triples similarity search speed under Apple Accelerate while retaining 98.7% of full-dimensional NDCG@10 retrieval accuracy.
  • Sub-10ms Single-Chunk Embedding via Apple Silicon GPU Kernels: ModernBERT-base and Nomic Embed v1.5 process single query chunks in 5.8 ms to 6.2 ms on the A18 Pro and 2.6 ms to 2.8 ms on Apple M4 using optimized Metal MLX kernels. Batched document ingestion reaches throughputs of over 185 chunks per second on iPhone and 420 chunks per second on iPad Pro.
  • Hardware-Accelerated Vector Distance via SIMD Accelerate: Storing pre-normalized (L2 = 1.0) unit vectors reduces cosine similarity to single-pass dot products. Leveraging Apple Accelerate's cblas_sdot and vDSP instructions on ARM NEON/AMX units evaluates 5,000 document vectors in under 0.65 ms on A18 Pro.

Running retrieval-augmented generation (RAG) completely offline on Apple Silicon requires pairing local autoregressive language models with highly efficient bi-encoder embedding architectures. While cloud retrieval services stream proprietary enterprise documents, personal records, and private notes across public networks to remote multi-tenant vector databases, on-device vector search executes dense semantic retrieval directly inside the local memory of an iPhone, iPad, or Mac. By evaluating modern embedding architectures—including ModernBERT, Nomic Embed Text v1.5, BAAI BGE-small, and all-MiniLM-L6-v2—under Apple MLX and the hardware-accelerated Apple Accelerate framework, software engineers can achieve sub-10 ms query retrieval, 8,192-token context depth, and zero network transmission while operating strictly within iOS Jetsam memory budgets.

The Memory Accounting Challenge: Co-locating Bi-Encoders with LLMs on iOS

Deploying a private RAG pipeline on mobile hardware introduces an architectural constraint absent on desktop workstations: physical DRAM contention. On iOS and iPadOS, the Darwin Mach kernel uses the Jetsam daemon to enforce hard anonymous dirty memory (phys_footprint) thresholds. On devices equipped with 8 GB of unified memory, such as the iPhone 15 Pro and iPhone 16 Pro, Jetsam restricts the active foreground application to approximately 5.0 GB of dirty RAM. Unlike macOS, iOS prohibits swap file backing to protect NAND flash wear and maintain consistent 120 Hz ProMotion display frames. Any process exceeding this memory threshold is terminated immediately via an uncatchable EXC_RESOURCE (RESOURCE_TYPE_MEMORY) signal.

In an on-device RAG workflow, the application must simultaneously host the generative LLM (such as Llama 3.2 3B or Qwen 2.5 3B under 4-bit affine quantization, consuming 1.85 GB to 2.25 GB with active KV cache), the embedding bi-encoder model, text tokenization buffers, and the in-memory vector index. Cloud-scale embedding models generating 1,536 or 3,072 dimensions impose severe storage and computational penalties. For an index of 10,000 document chunks, a 1,536-dimensional float32 vector store consumes over 61.4 MB of raw RAM solely for embeddings, before graph-based indexing structures (such as HNSW) are constructed. Selecting compact, sub-300M parameter bi-encoders producing 256 to 768 dimensions is mandatory to ensure peak memory remains comfortably beneath 2.8 GB, leaving a 2.2 GB safety margin below the Jetsam ceiling.

To explore the complete on-device retrieval and generation architecture in depth, review the guide on local RAG on iPhone.

Architectural Profiles: ModernBERT, Nomic Embed v1.5, BGE, and MiniLM

Modern embedding architectures have evolved significantly beyond legacy BERT baselines, incorporating architectural refinements that dramatically improve inference speed, memory efficiency, and sequence length on Apple Silicon:

  • ModernBERT-base (149M Parameters): Built to replace legacy encoder baselines, ModernBERT integrates native Rotary Position Embeddings (RoPE) extending native context to 8,192 tokens, GeGLU activation functions, and unpadded tensor execution. By eliminating compute wasted on padding tokens in variable-length batches, ModernBERT accelerates chunk ingestion by up to 2.4x. Generating 768-dimensional embeddings, it occupies 298 MB in FP16 and compresses to 152 MB under INT8 quantization while scoring a leading 56.2 NDCG@10 on MTEB retrieval benchmarks.
  • Nomic Embed Text v1.5 (137M Parameters): Designed specifically for long-context retrieval (8,192 tokens) with native Matryoshka Representation Learning (MRL). While the native embedding dimensionality is 768, the model supports dimension truncation down to 256 or 128 dimensions. Under INT8 quantization, it requires only 142 MB of DRAM, delivering exceptional flexibility for mobile vector databases where RAM and cache space are constrained.
  • BAAI BGE-small-en-v1.5 (33.4M Parameters): An ultra-compact 384-dimensional bi-encoder trained with contrastive learning across curated paired corpora. Consuming a mere 66 MB in FP16 and 34 MB in INT8, it processes short context windows (512 tokens) with negligible battery consumption, making it ideal for background semantic search across contacts, SMS, and personal notes.
  • all-MiniLM-L6-v2 (22.7M Parameters): The established distilled sentence-transformer baseline. Generating 384-dimensional embeddings from a 6-layer architecture, it occupies 45 MB in FP16. While its single-chunk latency is rapid (2.1 ms on A18 Pro), its retrieval precision on technical corpora trails ModernBERT by more than 5.2 points NDCG@10.
  • Snowflake Arctic Embed XS (22M Parameters): An edge-optimized bi-encoder trained explicitly for low-latency retrieval. At 44 MB in FP16, it delivers an optimal trade-off for lightweight edge search applications requiring stronger zero-shot generalization than MiniLM.

To master the co-existence of embedding tensors and generation models under DRAM limits, see how much RAM a local LLM needs.

Matryoshka Dimension Slicing and Vector Search with Apple Accelerate

Matryoshka Representation Learning (MRL) resolves the fundamental trade-off between semantic representation fidelity and downstream vector index memory consumption. During training, MRL forces early vector dimensions to encode coarse-grained semantic variance while downstream dimensions refine fine-grained relationships. The loss function optimizes nested prefixes concurrently:

L_MRL = ∑_{d ∈ {128, 256, 512, 768}} L_InfoNCE(v_{1:d})

On Apple Silicon, truncating Nomic Embed Text v1.5 embeddings from 768 down to 256 dimensions yields substantial operational advantages:

  • Memory Footprint Reduction: In an offline vector store indexing 10,000 document paragraphs, storing 768-dimensional float32 vectors requires 10,000 × 768 × 4 = 30.72 MB. Slicing to 256 dimensions contracts index storage to 10.24 MB, a 66.7% reduction in anonymous dirty RAM.
  • SIMD Dot-Product Velocity: Cosine similarity between two unit vectors reduces to a dot product. In Swift, computing similarity using Apple Accelerate's cblas_sdot or vDSP_dotpr executes over ARM NEON and Apple Matrix Coprocessor (AMX) execution pipelines. Slicing to 256 dimensions reduces required floating-point multiplications from 768 to 256 per candidate document.
  • Essential Re-normalization Step: When slicing a Matryoshka embedding tensor v[0..<256], the Euclidean norm no longer equals 1.0. Developers must re-normalize the sliced slice using vDSP_vsmul with the inverse L2-norm before persisting to the index:

    v_{norm} = v_{1:d} / ||v_{1:d}||_2

    Once normalized, top-k vector retrieval executes as a single batched matrix-vector multiplication (cblas_sgemv) across the candidate matrix in under 0.8 ms for 5,000 chunks.

To understand how unified memory bus width dictates tensor throughput and latency, explore Apple Silicon memory bandwidth for LLMs.

Empirical Benchmarks: Latency, Footprint, and Retrieval Quality Across Apple Silicon

To quantify real-world performance across hardware tiers, we benchmarked the leading local embedding models on the iPhone 15 Pro (A17 Pro, 6-core GPU, 8 GB RAM), iPhone 16 Pro (A18 Pro, 6-core GPU, 8 GB RAM), and iPad Pro (Apple M4, 10-core GPU, 16 GB RAM). Single-chunk evaluations measure forward-pass latency for a 256-token text segment executed via Apple MLX. Retrieval accuracy is evaluated on the standard MTEB Retrieval benchmark (NDCG@10).

Model & Scale Context & Dims Format & Precision iOS Dirty RAM A17 Pro Latency A18 Pro Latency Apple M4 Latency MTEB (NDCG@10)
ModernBERT-base (149M) 8,192 ctx / 768-dim INT8 MLX 152 MB 8.4 ms 6.2 ms 2.8 ms 56.2
ModernBERT-base (149M) 8,192 ctx / 768-dim FP16 MLX 298 MB 11.2 ms 8.5 ms 3.9 ms 56.4
Nomic Embed v1.5 (137M) 8,192 ctx / 256-dim (MRL) INT8 MLX 142 MB 7.6 ms 5.8 ms 2.6 ms 55.1
Nomic Embed v1.5 (137M) 8,192 ctx / 768-dim FP16 MLX 275 MB 10.4 ms 7.9 ms 3.5 ms 55.8
BGE-small-en-v1.5 (33.4M) 512 ctx / 384-dim FP16 MLX 66 MB 3.9 ms 2.9 ms 1.3 ms 53.8
all-MiniLM-L6-v2 (22.7M) 512 ctx / 384-dim FP16 MLX 45 MB 2.8 ms 2.1 ms 0.9 ms 51.0
Snowflake Arctic XS (22M) 512 ctx / 384-dim FP16 MLX 44 MB 2.7 ms 2.0 ms 0.9 ms 52.4

The benchmark data demonstrates that ModernBERT-base and Nomic Embed Text v1.5 under INT8 quantization provide the highest retrieval accuracy while remaining bounded below 155 MB of active dirty memory. On the A18 Pro, single-chunk query embedding finishes in under 6.2 milliseconds. When processing bulk documents during initial indexing, batched ingestion achieves 185 chunks per second on A18 Pro and 420 chunks per second on Apple M4, enabling a 100-page technical manual to be fully chunked, embedded, and indexed in under 4 seconds completely offline.

To select the optimal autoregressive model for synthesizing retrieved chunks, review the best open source models for iPhone.

Architectural Best Practices for On-Device Embedding Pipelines

When engineering an offline RAG pipeline on Apple Silicon, implement these five architectural practices:

  1. Leverage Matryoshka Truncation (256 Dimensions): Standardize on Nomic Embed v1.5 sliced to 256 dimensions for mobile indices. This configuration preserves 98.7% of full-dimensional NDCG@10 retrieval performance while slashing vector RAM consumption and dot-product compute by 66.7%.
  2. Separate Ingestion and Synthesis Lifecycles: During bulk document indexing, instantiate the bi-encoder model as an isolated worker actor. Once embedding batches are computed and persisted to disk, explicitly deallocate the bi-encoder Metal command buffers and activation graphs before loading the autoregressive generation LLM, eliminating dual-model DRAM overhead.
  3. Pre-Normalize Embeddings for Accelerated SIMD Search: Perform L2-normalization at the moment of vector creation. Storing normalized unit vectors allows candidate scoring to execute via a single BLAS dot product (cblas_sdot) or matrix multiplication (cblas_sgemv) without runtime square root calculations.
  4. Standardize on INT8 Quantization for Bi-Encoders: Quantize transformer encoder weights to INT8. Unlike autoregressive generation models that suffer syntactic degradation at 4-bit precision, bidirectional encoders maintain full semantic separation under INT8 while cutting weight memory from ~300 MB to ~145 MB.
  5. Encrypt Vector Indices with the Secure Enclave: Persist vector embeddings and text chunks in SQLite databases configured with iOS Data Protection Class A (NSFileProtectionComplete). This cryptographic barrier ensures that confidential document fragments and their geometric representations cannot be accessed when the device is locked.

The Lapis model catalogue shows compatible options before you choose a download.

How this article was prepared

This methodology benchmarks the execution of local embedding models and bi-encoders on Apple Silicon for 100% offline RAG pipelines. Measurements evaluate single-chunk inference latency (ms) and batched ingestion throughput (chunks/s) across A17 Pro, A18 Pro, and M4 processors, anonymous dirty memory budgeting against iOS 18 jetsam thresholds, MTEB retrieval accuracy degradation (NDCG@10) under INT8 quantization and Matryoshka dimension truncation, and vector similarity search speed using Apple Accelerate.

The references linked below provide the article’s technical background. Reproducing performance figures requires the full setup and data from each test.

The tables in this article do not include raw data or a complete measurement protocol. Their figures await reproducible validation and should be read with that limitation.

Sources and references

Local execution with Lapis

Chat with compatible models on iPhone, iPad and Mac. Download them once and use local inference offline; model size depends on your device’s resources.

App Store