Skip to main content

Nthuku-Fast: A blazing-fast multimodal AI model with vision and language understanding

Project description

Nthuku-Fast

Efficient Multimodal Vision-Language Model with Mixture of Experts (MoE) Architecture

Features

High Performance

  • Flash Attention for 2-4x speedup
  • Extended 8K context window (32x larger)
  • Optimized MoE routing (20-30% faster)

💰 Cost Effective

  • Prompt caching (10x cost reduction)
  • ~8B active parameters (efficient)
  • 90%+ cache hit rates

🧠 Advanced Capabilities

  • Vision understanding
  • Text generation
  • Speculative decoding (2-3x faster)
  • Thinking traces / chain-of-thought

Installation

From PyPI (once published)

pip install nthuku-fast

From source

git clone https://github.com/elijahnzeli1/Nthuku-fast_v2.git
cd Nthuku-fast_v2/nthuku-fast-package
pip install -e .

Local installation (development)

cd nthuku-fast-package
pip install -e .

Quick Start

from nthuku_fast import create_nthuku_fast_model
import torch

# Create model (all optimizations enabled by default)
model = create_nthuku_fast_model(
    hidden_dim=512,
    num_experts=8,
    top_k_experts=2
)

# Or use presets for different sizes
model = create_nthuku_fast_model(preset="150M")  # 150M parameters

# Generate text from image
pixel_values = torch.randn(1, 3, 224, 224)
text = model.generate_text(
    pixel_values,
    max_length=100,
    use_cache=True,      # Enable prompt caching
    show_thinking=False  # Show reasoning traces
)

Model Presets

# 50M parameters (default)
model = create_nthuku_fast_model(preset="50M")

# 150M parameters (recommended)
model = create_nthuku_fast_model(preset="150M")

# 500M parameters (high capacity)
model = create_nthuku_fast_model(preset="500M")

# 1B parameters (maximum)
model = create_nthuku_fast_model(preset="1B")

Advanced Features

Prompt Caching

# Get cache statistics
stats = model.get_cache_stats()
print(f"Cache hit rate: {stats['hit_rate']:.2%}")

Speculative Decoding

from nthuku_fast import SpeculativeDecoder

spec_decoder = SpeculativeDecoder(model, num_speculative_tokens=4)
generated, stats = spec_decoder.generate(
    input_ids, vision_features,
    max_new_tokens=100,
    show_stats=True
)

Thinking Traces

# Enable visible reasoning
text = model.generate_text(
    pixel_values,
    show_thinking=True  # Shows step-by-step reasoning
)

Training

from nthuku_fast import train_nthuku_fast, MultiDatasetManager

# Load datasets
dataset_manager = MultiDatasetManager()
data_sources = dataset_manager.load_all_datasets()

# Train
results = train_nthuku_fast(
    model=model,
    data_sources=data_sources,
    batch_size=8,
    num_epochs=10,
    learning_rate=2e-4
)

Performance

Feature Improvement
Flash Attention 2-4x faster
Extended Context 32x longer (8K tokens)
Optimized MoE 20-30% faster
Prompt Caching 10x cost reduction
Speculative Decoding 2-3x faster generation

Combined: 5-7x faster, 81% cheaper!

Requirements

  • Python ≥ 3.8
  • PyTorch ≥ 2.0.0 (for Flash Attention)
  • transformers ≥ 4.30.0
  • Other dependencies (auto-installed)

License

MIT License

Citation

@software{nthuku_fast,
  title={Nthuku-Fast: Efficient Multimodal Vision-Language Model},
  author={Nthuku Team},
  year={2025},
  url={https://github.com/elijahnzeli1/Nthuku-fast_v2}
}

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nthuku_fast-0.1.1.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nthuku_fast-0.1.1-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file nthuku_fast-0.1.1.tar.gz.

File metadata

  • Download URL: nthuku_fast-0.1.1.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nthuku_fast-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c3d5f3b3ff6babf9607c93628a563c69e4ad6993d89109d04373ddfdff040e5
MD5 864e987ff058ffdb85934814609127cf
BLAKE2b-256 627bdfb535620f2ad38c2b3298678663add9b2dd31461aa72fe37fc0b455747a

See more details on using hashes here.

File details

Details for the file nthuku_fast-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nthuku_fast-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nthuku_fast-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 824803a9481776675c170c94f20a3de7f631e561b7c60f79494254f15b4cd975
MD5 4175947308d245e39b3d1fd0f4a681cf
BLAKE2b-256 929d7602386af48f264f8a500903b9e8f3b7b46238ef38b397beea2d1452f639

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page