8000 Add unified modeltests suite, reference generators, and hftokenizer fixes by janpfeifer · Pull Request #88 · gomlx/go-huggingface · GitHub
[go: up one dir, main page]

Skip to content

Add unified modeltests suite, reference generators, and hftokenizer fixes - #88

Merged
janpfeifer merged 2 commits into
mainfrom
add-modeltests
Nov 27, 2026
Merged

janpfeifer merged 2 commits into
mainfrom
add-modeltests

Conversation

@janpfeifer
Copy link
Copy Markdown
Contributor

Summary

  • Unified opt-in -modeltests parity test suite (modeltests/, docs/ModelTests.md):
    • Disabled by default (skipped unless -modeltests is passed); supports -backends="b1;b2;...", -max_tier, -tag, -cached_only, -strict, -debug_layers, and -set.
    • Reports per-model load/inference latency, peak/delta RSS, peak Go heap, and accuracy metrics in a summary table.
    • Shared reference corpora (reference_sentences.json, reference_prompts.json) drawn from Dolly, MS MARCO, and multilingual "Why is the sky blue?" (EN/DE/FR/ZH/JA).
    • Harnesses for transformer models (tokenization, single/batched embeddings, prefill logits, KV-cache parity, greedy generation) and Timestral time-series models.
  • Reference generators (modeltests/internal/generators/{python,yzma}):
    • Python/PyTorch (gen_embeddings.py, gen_generate.py) and isolated Go/yzma (llama.cpp) generators.
    • Golden testdata/ for BAAI/bge-small-en-v1.5, sentence-transformers/all-MiniLM-L6-v2, bge-base-en-v1.5-gguf (Q4_0), all 13 minilm-l6-v2-gguf quantizations (Q2_K..Q8_0 + F16), KaLM-Embedding-Gemma3-12B, Qwen3.5-4B, Gemma-4-E4B, and Timestral-28M/123M.
  • hftokenizer fixes discovered by the suite (tokenizers/hftokenizer/):
    • WordPiece decoder cleanup (Decoder.Cleanup), Split \s+(?!\S) negative lookahead emulation + ByteLevel use_regex: false, and SpecialTokenID lookup in added_tokens / non-special <mask>.
  • Removed redundant parity tests under examples/ while keeping helper packages and demos.

Verification

  • go test -short ./... passes.
  • Small-tier modeltests (18 model variants) pass on Linux/amd64 (go, go:ops_sequential) and Darwin/arm64 Apple M6 (go NEON+SME, mlx with MLX_ENABLE_TF32=0, mps).
  • Large models (kalm-gemma3-12b, qwen3.5-4b, gemma4-e4b) verified on xla:cuda.

…ixes

- Add opt-in (-modeltests) end-to-end model parity test suite under modeltests/
  with multi-backend matrix (-backends), per-model peak RSS tracking, shared
  Dolly/MS MARCO/multilingual corpora, and harnesses for transformer and
  time-series models.
- Add Python/PyTorch (gen_embeddings.py, gen_generate.py) and isolated Go/yzma
  (llama.cpp) reference generators under modeltests/internal/generators/.
- Populate golden testdata for BGE-small, all-MiniLM-L6-v2, BGE-base-GGUF Q4_0,
  all 13 MiniLM-GGUF quantizations, KaLM-Gemma3-12B, Qwen3.5-4B, Gemma4-E4B,
  and Timestral-28M/123M.
- Fix hftokenizer WordPiece decoder cleanup, Split \s+(?!\S) negative lookahead
  + ByteLevel use_regex:false, and SpecialTokenID lookups in added_tokens.
- Remove redundant example parity tests while keeping helper packages and demos.
- Add docs/ModelTests.md and update docs/CHANGELOG.md and .agents/AGENTS.md.
@janpfeifer
janpfeifer merged commit 9400db5 into main Nov 27, 2026
5 checks passed
@janpfeifer
janpfeifer deleted the add-modeltests branch November 28, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0