Repository navigation
Vela 2.0 0.3B on Core ML: Swift engine, model store, parity check, guardrail + chatbot front-door demos - #26
Merged
Merged
Conversation
…bly, heads, calibration, span decoder) and parity check Vela2Manager reproduces vllm-sr/Vela-2.0-0.3B's vela2_inference.py on a Core ML encoder: one pass per request for choice questions plus the first span question; sequences up to 128 tokens on the Neural Engine, longer on the GPU. Word units / span units / trimming are hand-written scanners with Python's \w / \s rules. Vela2Check parity on 38 guardrail-style requests (PII, prompt attack, harm, routing, hallucination; EN, DE, FR, ES, ZH, JA, HI, AR, URLs, e-mails): 0 token / sequence mismatches, 0/120 choices and 0/38 span sets differ. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…screen, full check on send, reply grounding) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…scenario forever) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…l-request example, --demo plays all scenarios once Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… ANE, route + PII on GPU), speed-first timing Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…x800 layout, batched UI updates (~92 msg/s end to end) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…use/Resume (Space) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ownload it by default, README section Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… spans without labels (were crashes); GuardrailDemo: drop a send result after a scenario switch Review fixes for #26. Parity unchanged (38 requests: 0 token / sequence mismatches, 0/120 choices, 0/38 span sets differ). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # Package.swift # README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds vLLM Semantic Router × KR Labs' Vela-2.0-0.3B (ModernBERT routing / safety / span model) on Core ML:
Vela2Manager: a Swift port of the release'svela2_inference.pyon a Core ML encoder. It covers the tokenizer with character offsets (a mmBERT/Gemma BPE built onLayaTokenizer), schema assembly, the fp32 readout heads (choice cosine + MLP, word × label spans), calibration (per-type temperatures, PII length rule + sparse gate) and the span decoder. Word units, span units and trimming are hand-written scanners using Python's\w/\srules, because ICU's differ for combining marks,Nodigits and similar. Choice questions plus the first span question share one encoder pass. Sequences of ≤128 tokens run on the Neural Engine, longer ones on the GPU.Vela2ModelStore: pinned and checksummed FluidInference/vela-2.0-0.3b-coreml @fb68b856(fp16 multifunction encoder L128–L1024, heads, tokenizer, calibration, licences).Vela2Check parity: compares against fixtures from the Python engine.GuardrailDemo: a chat guardrail. Each outgoing message is screened (prompt attack, harm, route, fact-check) and its PII masked. Replies are checked against a source document, and unsupported claims are underlined. Each check shows whether it ran on the ANE or GPU and how long it took.--demoplays the scenarios once.FrontDoorDemo: 1,000 synthetic chatbot messages arrive in an inbox and fly into Answered (routed to a team, PII redacted), Blocked · jailbreak and Blocked · harmful. Includes Pause/Resume. The data is synthetic, from a seeded generator kept in model-lab.Verification (M5 Pro, macOS 27)
Vela2ModelStore.ensure()download, all 8 assets checksum-verified, and the demo runs from the cache.Not done
swift testwas not run locally (no Xcode).Package.swiftandREADME.md; whichever merges second needs a small rebase.🤖 Generated with Claude Code