CoolFace
Modelpublic

AnanyaPathak/esmc-300m-gguf

sourceHugging Faceotherupdated 2mo agoView on Hugging Face
2likes179downloads
Model Card

ESM-C 300M — GGUF (esmc.cpp)

GGUF conversions of ESM Cambrian (ESM-C) 300M, an encoder-only protein language model, for fast, low-memory per-residue and per-sequence embeddings on CPU and Apple Metal — with no Python or PyTorch needed at inference time.

[!IMPORTANT] These files use a custom GGUF architecture (general.architecture = "esmc") and are not loadable by stock llama.cpp / llama-cli. Use the `esmc.cpp` runtime (the esmc-embed tool) shown below.

Which file should I download?

FileSize (MiB)sha256 (first 16)When to use
esmc-300m-Q4KM.gguf237.596c08911822906dcSmallest with good quality; best 4-bit choice.
esmc-300m-Q4KS.gguf228.102328ea3555903efSmallest footprint; lowest peak RAM.
esmc-300m-Q8_0.gguf336.9d7a57a5ab21c172bRecommended default — near-F16 quality at ~half the size.
esmc-300m-f16.gguf633.57c37c24e156920bdHighest fidelity; numerical reference.
esmc-300m-f32.gguf1266.47e3e319c9bd00abbFull precision; mainly the quantization source (largest).

If unsure, start with `esmc-300m-Q8_0.gguf` (near-identical to PyTorch at ~half the size). Use Q4_K_M for the smallest deployment with good quality, or F16 when you want the closest possible match to the reference.

Quick start

1. Build the esmc.cpp runtime

bash
git clone --recursive https://github.com/AnanyaP-WDW/esmc.cpp
cd esmc.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j8

2. Download a model

bash
pip install -U huggingface_hub
huggingface-cli download AnanyaPathak/esmc-300m-gguf esmc-300m-Q8_0.gguf --local-dir ./models

3. Embed a protein sequence

bash
# Mean-pooled sequence embedding -> one vector per sequence ([n_embd])
./build/esmc-embed -m ./models/esmc-300m-Q8_0.gguf \
    -s "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGY" \
    --pool mean --output embedding.npy

# Per-residue embeddings -> matrix ([n_tokens, n_embd])
./build/esmc-embed -m ./models/esmc-300m-Q8_0.gguf \
    -s "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGY" \
    --pool none --output residues.npy

# Force CPU (skip the Metal/GPU backend)
./build/esmc-embed -m ./models/esmc-300m-Q8_0.gguf -s "..." --pool mean --no-metal

Outputs are NumPy .npy arrays. Mean pooling strips the <cls>/<eos> tokens.

4. Load the embedding in Python

python
import numpy as np

emb = np.load("embedding.npy")   # mean pool: shape (960,)
res = np.load("residues.npy")    # per-residue: shape (n_tokens, 960)
print(emb.shape, res.shape)

Benchmarks (300M)

Measured on an Apple M4 Max (36 GB) against the official PyTorch ESM-C 300M. Full methodology and per-sequence data are in the esmc.cpp repository.

Numerical fidelity vs PyTorch (per-residue cosine, 100 Swiss-Prot sequences)

PrecisionAggregate mean cosineWorst min cosineMax mean-pool L2Pass rate
F161.000001.00000.0006100/100
Q8_00.999900.99810.0113100/100
Q4KM0.996390.95310.066198/100
Q4KS0.995650.96050.071087/100

F16 and Q80 clear per-sequence mean cosine > 0.999; Q4KM / Q4K_S clear the aggregate > 0.995 (4-bit misses concentrate in very short sequences).

Throughput (seq/s, best esmc.cpp config)

BucketTokensBest esmc.cppseq/s
short47metal/f1690.97
medium235metal/f1636.55
long850metal/f165.14

Peak memory (long sequences, 36 GB budget)

  • Lowest peak RAM: pytorch/pytorch_mps/f32 at 280 MiB (long sequences).
  • Highest peak RAM: esmc.cpp/cpu/f32 at 2609 MiB.
  • All 12/12 measured configurations fit within a 36 GB machine.

Downstream variant-effect preservation (ProteinGym, 10 assays x 1000 variants)

PrecisionAssaysMean abs Spearman deltaMax abs Spearman deltaMetric rows pass
F16100.00060.001450/50
Q8_0100.00310.009245/50
Q4KM100.00680.023138/50
Q4KS100.01100.025832/50

Variants are scored by the cosine between mean-pooled mutant and wild-type embeddings; deltas are versus the PyTorch reference (preservation probe).

Model details

  • Architecture: encoder-only transformer; 30 layers, d_model 960, 15 heads (head dim 64), SwiGLU FFN (width 2560), pre-LayerNorm, RoPE-NeoX (theta 10000), query/key LayerNorm, no biases, context length 2048.
  • Tokenizer: 33-token amino-acid alphabet; <cls> prepended and <eos> appended (direct character lookup, no subword splitting).
  • Provenance: converted from the upstream safetensors checkpoint to GGUF (fused QKV and SwiGLU projections split); quantized variants use ggml block quantization. Weight values are otherwise unchanged from the upstream release.

Verify downloads

bash
shasum -a 256 models/*.gguf   # compare against the sha256 column above

Reproduce

The full replication guide (convert, quantize, validate, benchmark) is in the esmc.cpp README. The lab manual documents every experiment (EXP-001 through EXP-022) with commands, raw results, and run logs.

License

Built with ESM.

These GGUF files are Derivative Works of the ESM-C 300M Open Model and are distributed under the EvolutionaryScale Cambrian Open License Agreement (the permissive license that governs ESM-C 300M), subject to the Acceptable Use Policy. The ESMC 300M Model is licensed under the EvolutionaryScale Cambrian Open License Agreement.

Citation

If you use these models, please cite the esmc.cpp runtime. If you use esmc.cpp or the GGUF model files in your work, please cite the esmc.cpp paper:

bibtex
@article{pathak2026esmc,
  title={esmc.cpp: A Zero-Dependency, Metal-Accelerated C/C++ Runtime for ESM Cambrian Protein Embeddings},
  author={Pathak, Anagh and Pathak, Ananya},
  journal={OpenReview},
  year={2026},
  url={https://openreview.net/forum?id=0GarVDrEAi},
  note={CAISc 2026, Track 2: Open-Ended Problems, non-archival submission}
}

You may also acknowledge the ESM Cambrian work by EvolutionaryScale and link the esmc.cpp runtime.