Repository navigation
v3.13.0 – Upstream MLX 0.33.0, Native Packed 4-Bit LLMs & Checkpoint Hardening
SwiftSci 3.13.0 Release Notes
SwiftSci 3.13.0 aligns the ecosystem with upstream mlx-swift 0.33.0+ while preserving full source and public API compatibility across all 15 modules, adds native packed 4-bit/8-bit quantized LLM execution and zero-configuration HuggingFace model loading (SwiftLLM), hardens binary model parsers (SafeTensorsParser, GGUFParser), supports community MLX Llama 3 tokenizer exports, eliminates batch NLEmbedding concurrency crashes (SwiftNLP), maintains 100.00% (2,540/2,540) DocC public declaration coverage, and includes the updated SwiftSci 3.13.0 Complete Engineering Handbook & Practical Cookbook (118 pages, 67 verified recipes).
🚀 Key Highlights & New Capabilities
- Upstream
mlx-swift 0.33.0Alignment (Package.swift): Switched themlx-swiftdependency from forkedcrabel99/mlx-swiftto upstreamhttps://github.com/ml-explore/mlx-swift.git(from: "0.33.0"), updated wired-memory references inHardwareRouterAndMemory.md, and registeredSwiftWorkflowin.spi.yml. - Native Packed Quantized LLM Execution (
SwiftLLM):TransformerDecoder.loadWeights(_:)auto-detects<module>.scales,<module>.biases, and bit-packedUInt32weights (including across sharded checkpoints) and routes throughloadQuantizedWeights(_:quantization:)so 4-bit/8-bit checkpoints stay packed on GPU viaquantized_matmulinstead of expanding toFloat16.- Added
AffineQuantizationConfig(includinginit?(configJSON:)and shape inference) and cross-shard split-tensor staging until the complete.weight,.scales, and.biasesaffine tensor set arrives across shard boundaries. - Quantized touched decoder layers individually (
quantize(model: layers[layerIdx], ...)alongside non-arrayembedding/lmHeadpaths) so multi-layer sharded checkpoints with sparse layer distribution across shards load cleanly.
- Zero-Configuration Model Download & Sharded Loading (
SwiftLLM):- Added
ModelDownloaderwith repository/revision identifier validation and revision-isolated local caching (<cacheDirectory>/<repo>/<revision>). - Added
LLMConfig(huggingFaceConfigJSON:maxSeqLen:)and streaming shardedTransformerDecoder.load(directory:maxSeqLen:), validating per-layer normalization weights (input_layernorm.weight,post_attention_layernorm.weight) and pending quantized tensor sets across shards.
- Added
🛡️ Binary Parser, Tokenizer & Concurrency Hardening
SafeTensorsParser(SwiftLLM): AddedU8,U16,U32,U64,I16, andBOOLdtypes plus strict bounds checking against hostile header sizes, negative or inverteddata_offsets, out-of-range dimensions (0 ... Int32.max), element-count overflow, and payload byte-length mismatches.GGUFParser&QuantizedTensor(SwiftLLM): Fixed 1-byte boolean metadata alignment (previously skipped as 4 bytes), added range/overflow checks on arrays, strings, dimensions, and offsets, correctedQ8_0block-32 type mapping (case 8), and fixed unsigned exponent underflow inhalfToFloat((exp + 112) << 23) during FP16 dequantization.BPETokenizer(SwiftNLP): UpdatedBPETokenizer(llama3TokenizerJSON:)to accept flattened bareByteLevelpost_processorconfigurations written by community MLX exports while continuing to reject missing<|begin_of_text|>tokens or unsupported offset flags.AppleSentenceEmbeddingEngine(SwiftNLP): SerializedNLEmbeddingvector lookups viaNSLockand switchedembedBatch(_:)to sequential cancellable execution, eliminating CoreFoundationSIGSEGVcrashes on batches exceeding 16 texts.
📊 Benchmark Baseline & API Compatibility
- Audited Benchmark Parity vs
3.12.0: No changes were made to CPU,SwiftDataFrame,SwiftStats,SwiftPreprocessing,SwiftForecast, or classicalSwiftMLcode paths; all audited3.12.0Methodology v2 tabular and ML timings carry forward unchanged. - Source & Public API Compatibility: Checked across all 15 modules against
v3.12.0(swift package diagnose-api-breaking-changes v3.12.0: no breaking changes detected).
📦 Installation
Add SwiftSci 3.13.0 to your Package.swift:
dependencies: [
.package(url: "https://github.com/Nodibell/SwiftSci.git", from: "3.13.0")
]Or target individual modular libraries:
.target(
name: "MyTarget",
dependencies: [
.product(name: "SwiftDataFrame", package: "SwiftSci"),
.product(name: "SwiftML", package: "SwiftSci"),
.product(name: "SwiftLLM", package: "SwiftSci"),
]
)📚 Attached Documentation
SwiftSci_Handbook_3.13.0.pdf— Complete Engineering Handbook & Practical Cookbook (118 pages, 67 verified recipes)SwiftSci_Handbook_3.13.0.epub— E-reader edition
Full Changelog: v3.12.0...v3.13.0