Crate byteforge

Source
Expand description

Β§ByteForge: Next-Generation Byte Transformer

ByteForge is a revolutionary byte-level transformer architecture that significantly improves upon Meta’s Byte Latent Transformer (BLT) with faster, more efficient, and more robust processing.

Β§πŸ† Key Features

  • Multi-Signal Patching: Combines 5 signals vs BLT’s entropy-only approach
  • Ultra-Fast Entropy: 1000x faster than 100M parameter models
  • SIMD Optimization: Vectorized operations for maximum throughput
  • Memory Efficient: Constant O(1) memory usage per chunk
  • Streaming Support: Real-time byte-by-byte processing

Β§πŸš€ Quick Start

use byteforge::{ByteForgeConfig, MultiSignalPatcher, UltraFastEntropyCalculator};

// Create configuration
let config = ByteForgeConfig::default();

// Initialize components
let mut patcher = MultiSignalPatcher::new(config);
let mut entropy_calc = UltraFastEntropyCalculator::new();

// Build entropy model
let corpus = vec![b"Hello, world!".to_vec()];
entropy_calc.build_from_corpus(corpus)?;

// Process text
let text = "Hello, ByteForge!";
let patches = patcher.patch_bytes(text.as_bytes())?;

println!("Created {} patches", patches.len());

Β§πŸ“Š Performance

ByteForge delivers exceptional performance:

  • 4+ GB/s in-memory processing throughput
  • 3,000x fewer patches than traditional approaches
  • Sub-second processing for 100MB+ datasets
  • Linear scalability with data size

Β§πŸ”§ TURBO Mode

For maximum performance, use TURBO mode with SIMD acceleration:

use byteforge::{SIMDEntropyCalculator, TurboMultiSignalPatcher};
use std::sync::Arc;

// Create SIMD entropy calculator
let mut simd_calc = SIMDEntropyCalculator::new();
let corpus = vec![b"Sample data".to_vec()];
simd_calc.build_from_corpus_optimized(corpus)?;

// Create turbo patcher
let mut turbo_patcher = TurboMultiSignalPatcher::new(Arc::new(simd_calc));

// Process with maximum speed
let data = b"Large dataset...";
let patches = turbo_patcher.patch_bytes_turbo(data)?;

Re-exportsΒ§

pub use crate::patching::MultiSignalPatcher;
pub use crate::patching::Patch;
pub use crate::patching::PatchType;
pub use crate::entropy::UltraFastEntropyCalculator;
pub use crate::entropy::StreamingEntropyCalculator;
pub use crate::transformer::ByteForgeTransformer;
pub use crate::optimized_entropy::SIMDEntropyCalculator;
pub use crate::optimized_patching::TurboMultiSignalPatcher;

ModulesΒ§

entropy
inference
optimized_entropy
optimized_patching
patching
simple_benchmark
training
transformer
turbo_benchmark
utils

StructsΒ§

ByteForgeConfig

EnumsΒ§

ByteForgeError

Type AliasesΒ§

Result