Skip to main content

AMV-BitNet (v2.0.1 Sovereign Ternary)

마이그레이션 안내: 이 패키지는 termux-bitnet에서 amv-bitnet로 이름이 바뀌었습니다. 기존 termux-bitnet 배포본(PyPI/npm)은 호환을 위해 당분간 유지되나 deprecated 상태이며 더 이상 갱신되지 않습니다. pip install amv-bitnet / npm install amv-bitnet로 전환하십시오.

Android Termux 환경 또는 안드로이드 Linux 커널(루팅 없이 Linux 환경이 구동되는 모든 디바이스) 에서 동작합니다 — Termux 전용이 아닙니다.

Production-Grade Universal 1.58-Bit (i2_s) On-Device LLM Inference Engine with ARM64 NEON DotProd SIMD & Native Vulkan GPU Acceleration.

PyPI Version npm Version GitHub Release Documentation Portal License Core Acceleration Supported Models Tested Hardware


What's New in v2.2.0 — Zero-Compilation Prebuilt Provisioning & Unified Runtime

  • Added instant-on auto-provisioning of prebuilt libtermux_bitnet.so on first load without local compilation.
  • Unified 1.58-bit ternary GPU shader dispatch through ameva-runtime HAL.
  • Verified compatibility with Microsoft BitNet b1.58 PR #633 ternary weight formats.
  • Enforced OpenSSF REUSE v3.0 SPDX license headers across all source files.

🏛️ Executive Engineering Disclosure: v2.0.1 Generational Breakthroughs

amv-bitnet v2.0.1 extends the sovereign ternary architecture with hallucination-prevention prompt wrapping, hardware-level GPU watchdog defense, and dynamic LM Head memory slicing, delivering fully calibrated conversational generation across diverse 1.58-bit models.

📚 Official Academic & Upstream Credibility


📑 Supported Pretrained Models & Optimal Settings

Model Identifier Parameter Count Disk Footprint Activation Kernel Recommended Prompt Template Recommended Acceleration Flags
Microsoft BitNet 2B-4T 2.0B 1.13 GB Squared ReLU (--act-fn relu2) --prompt-template raw -ngl 30 (100% GPU Offload)
TII Falcon-E 1B Instruct 1.0B 635 MB SwiGLU (--act-fn swiglu) --prompt-template falcon -ngl 24 (100% GPU Offload)
TII Falcon3 7B Instruct 7.45B 3.05 GB SwiGLU (--act-fn swiglu) --prompt-template chatml --chunk-layers 4 --vocab-slice 32768
BitNet Embedding 270M 268M 367 MB Linear / RMSNorm --prompt-template raw CPU Zero-Copy Mmap (30+ tok/s)

🛠️ Comprehensive CLI & SDK Parameter Reference Manual

The inference runtime provides user-directed controls to eliminate hallucinations and tailor execution to mobile hardware:

Option Flag Type / Range Default Purpose & Architectural Behavior
--prompt-template chatml | falcon | raw | none none Wraps user input in model-compliant dialogue tokens to eliminate drift and word salad.
--act-fn auto | relu2 | swiglu auto Enforces mathematical activation kernel routing (relu(x)^2 vs SiLU(x) * up).
--chunk-layers Integer (0 = disabled, e.g. 4) 0 Submits GPU command buffers in chunks of N layers, bypassing the 2.5s Mali watchdog fence.
--vocab-slice Integer (0 = disabled, e.g. 32768) 0 Slices FP16 LM Head projection rows, slashing VRAM consumption by 576MB on 7B models.
-ngl, --n-gpu-layers Integer (0 to total layers) 0 Number of transformer layers permanently offloaded into Vulkan GPU VRAM.
--prompt-prefix String "" Custom prefix prepended to user prompt before tokenization.
--prompt-suffix String "" Custom suffix appended to user prompt before tokenization.
--eos-token-id Integer Model default Explicit override for End-of-Sequence token ID to guarantee generation termination.

⚡ Empirical Real-Device Hardware Fleet Scorecard (Ground Truth)

All benchmarks were empirically measured on genuine Samsung Galaxy hardware under unrooted Android Termux Bionic libc environments with steady thermal equilibrium and verified per-device semantic outputs:

Target Model Test Device & Hardware Offload Mode Token Generation Speed Verified Semantic Output String Status
BitNet-2B Galaxy S25 (Snapdragon 8 Elite) GPU (30/30) 19.37 tok/s "Paris. The Eiffel Tower, located in the heart of Paris," PASS
BitNet-2B Galaxy S20 (Turnip Adreno 650) GPU (30/30) 7.71 tok/s `"Paris.
It is located in the region of Île-de-France,"` PASS
BitNet-2B Galaxy A35 (Exynos 1380 Mali-G68) GPU (30/30) 4.22 tok/s " Paris. London has a very long name, but its people are friendly and" PASS
BitNet-2B Galaxy A53 (Exynos 1280 Mali-G68) GPU (30/30) 3.26 tok/s " Paris. Cathy has a lot more money than David does. The new" PASS
Falcon-E-1B Galaxy S25 (Snapdragon 8 Elite) GPU (24/24) 34.35 tok/s "situated in Paris, a city known for its rich history and cul" PASS
Falcon-E-1B Galaxy S20 (Turnip Adreno 650) GPU (24/24) 10.76 tok/s "located in the Southern Italy, bordered by the Danube (D" PASS
Falcon-E-1B Galaxy A35 (Exynos 1380 Mali-G68) GPU (24/24) 5.81 tok/s " a city in the heart of art and culture, where history and innovation meet" PASS
Falcon-E-1B Galaxy A53 (Exynos 1280 Mali-G68) GPU (24/24) 4.46 tok/s " a complex and often subject to numerous laws and regulations, with different types of" PASS
Falcon3-7B Galaxy S25 (Snapdragon 8 Elite) GPU (28/28) 8.30 tok/s "a sovereign state situated mainly in Western Europe..." PASS
Falcon3-7B Galaxy S20 (Turnip Adreno 650) GPU (-ngl 8) 2.62 tok/s "a large city in the north-west region..." PASS
Falcon3-7B Galaxy A53 (Exynos 1280, 6GB RAM) GPU Chunked (4) 1.74 tok/s " the only power that can be considered to exist for" PASS
Falcon3-7B Galaxy A35 (Exynos 1380, 6GB RAM) GPU Chunked (4) 0.78 tok/s " the largest city in Europe by population, and its" PASS

📦 Installation

1. Python SDK (PyPI)

# Inside Android Termux (prerequisites: clang cmake python openblas)
pkg update && pkg install -y clang cmake python openblas

# Install Termux-BitNet and AMEVA-Runtime
pip install --upgrade amv-bitnet ameva-runtime

2. Node.js CLI (npm)

npm install -g amv-bitnet @ameva/runtime

3. One-Touch Native Installer

curl -sSL https://raw.githubusercontent.com/uno-km/amv-bitnet/main/install.sh | bash

🚀 Quickstart Recipes

1. Python Programmatic Inference

from termux_bitnet import BitNetEngine, BitNetConfig

# Configure for real-time Falcon-E-1B or BitNet-2B with template wrapping
config = BitNetConfig(
    model_path="~/.cache/amv-bitnet/models/falcon-e-1b-instruct-i2_s.gguf",
    device="gpu",           # "auto", "cpu", or "gpu"
    n_gpu_layers=24,        # 100% GPU offload
    chat_template="falcon", # Formats with <|im_start|>user
...
    chunk_layers=4,         # Prevent Mali watchdog timeouts
    vocab_slice=32768,      # Slashing LM Head VRAM
    n_threads=4,
    temperature=0.7,
    top_p=0.95
)

with BitNetEngine(config) as engine:
    print("[Prompt]: What is the capital of France?")
    print("[Response]: ", end="", flush=True)
    for token in engine.generate_stream("What is the capital of France?"):
        print(token, end="", flush=True)
    print()
    metrics = engine.get_last_metrics()
    print(f"Speed: {metrics.tokens_per_second:.2f} tok/s")

2. Standalone CLI Usage

# 1. Run 1B real-time conversational model with Falcon wrapping
amv-bitnet run -m models/falcon-e-1b-instruct-i2_s.gguf \
  -p "What is the capital of France?" --prompt-template falcon -ngl 24 -t 4

# 2. Run Microsoft BitNet 2B with Squared ReLU
amv-bitnet run -m models/bitnet-2b-ggml-model-i2_s.gguf \
  -p "What is the capital of France?" --act-fn relu2 --prompt-template raw -ngl 30 -t 4

# 3. Run 7.45B model on 6GB RAM device with GPU Chunking and Vocab Slicing
amv-bitnet run -m models/falcon3-7b-instruct-1.58bit-i2_s.gguf \
  -p "Explain quantum computing simply" --prompt-template chatml \
  --chunk-layers 4 --vocab-slice 32768 -ngl 12 -t 4

Metadata

Release files for amv-bitnet 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amv-bitnet 2.2.0
File Size Uploaded Provenance
amv_bitnet-2.2.0.tar.gz 55.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for amv-bitnet 2.2.0
File Interpreter ABI Platform
amv_bitnet-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.5 kB

Release files / amv_bitnet-2.2.0.tar.gz

Download URL amv_bitnet-2.2.0.tar.gz
Size 55.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fc3f7d58a243203089ade9310c2181dbd0498b56490fa56aeb496f43b27b36e6
BLAKE2b-256 checksum
How to use checksums
5cb44e61a5d1994edcd1a01102621cb8c210cf2ec473dee63009e3cd38370e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / amv_bitnet-2.2.0-py3-none-any.whl

Download URL amv_bitnet-2.2.0-py3-none-any.whl
Size 52.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f88c41fe4a9a8b7b497506b2c48a7ee7ebf4bc84803938fb57ac9cf79bbfe98
BLAKE2b-256 checksum
How to use checksums
b38d3657adeb2b33ad5fc88597d801dfdeb3cc0a02de94b1a83115e79a67279e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Security for amv-bitnet 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page