# Reproduce the conversion This directory contains the tested converter, dependency lock, source-weight pins, fixtures and native validator. It is self-contained; no GitHub branch checkout is required. The implementation files match the five-bucket export recorded in [source-snapshot.json](source-snapshot.json). Use Apple Silicon macOS with Python 3.12.9. Download the conversion directory and enter it: ```sh hf download anylab/embeddinggemma-2-coreml \ --include 'conversion/**' --include LICENSE --include NOTICE \ --include 'licenses/**' --local-dir eg2 cd eg2/conversion gzip -dc fixtures/tokens.json.gz > tokens.json shasum -a 256 -c fixtures/SHA256SUMS mkdir -p evidence python3.12 -m venv .venv .venv/bin/python -m pip install -r requirements.lock .venv/bin/python fetch_stock.py .venv/bin/python parity.py > evidence/torch-parity.log 2>&1 .venv/bin/python convert.py --lengths 128 256 512 1024 2048 --merge > evidence/convert-all.log 2>&1 ``` `fetch_stock.py` retrieves and verifies the exact Google checkpoint and tokenizer pinned in [source-manifest.json](source-manifest.json). `parity.py` checks the rewritten FP32 forward against the stock model before export. Conversion refuses to proceed without a passing gate for the current source and dependencies. The output is `models/EmbeddingGemma2Owned.mlpackage`: five functions with shared FP16 encoder weights and FP32 final L2 normalization. Prompts, special tokens and input/output shapes are described in [usage](../docs/usage.md). ## Validate on a Mac These are the commands used with the macOS 27 SDK for the recorded M2 Air run: ```sh xcrun swiftc -parse-as-library -O -target arm64-apple-macos27.0 validate.swift -o validate ./validate "$PWD" cold multi 128,256,512,1024,2048 > evidence/air-cold.log 2>&1 ./validate "$PWD" warm multi 128,256,512,1024,2048 > evidence/air-warm.log 2>&1 ``` Run one validation process at a time. For a separate target Mac, copy `models/`, `evidence/hf-reference.json`, `tokens.json` and the validator into a fresh directory. The runner creates and reuses an adjacent `.mlmodelc`; replacing package bytes requires a fresh compiled artifact. The validator records reference parity, compute-plan placement, corpus outputs, timings and memory ledgers. It uses `cpuAndNeuralEngine`, which allows CPU work. Record the actual hardware and OS when repeating the run. ## Reproducibility scope The distributed package combines four retained November 12 exports with the November 16 s2048 export. All five were validated together. These commands rebuild all five from the current tested converter; per-function provenance for the distributed artifact remains in the [release manifest](../release-manifest.json). A clean s2048 rebuild reproduced the weight bytes and parsed model graph. Whole-package byte identity is not promised: package UUIDs and protobuf map ordering can differ. The [validation report](../validation/2026-11-16-five-bucket/REPORT.txt) records the exact tested artifact and limitations. The forward adapts Transformers and QVAC's overflow-safe normalization. See [NOTICE](NOTICE) and the included upstream license files. Original converter code is Apache-2.0. The [FiQA evaluation fixtures](fixtures/README.md) have separate CC-BY-SA-4.0 terms; retain their attribution when sharing them.