Skip to main content

Bytewise MIME detector

CI License: Apache-2.0 PyPI version

Working name: bytewise may change before the first public Git release.

Bytewise is a standalone neural MIME detector trained on raw file bytes. It does not require Java, a Tika server, a filename, or a file extension. The repository preserves its complete research lineage: BFA/BFC baselines, neural experiments, strict-host validation, deduplication audits, and D3 reports.

The frozen v1 release candidate is a compact Transformer trained on the first 4,096 bytes of 863,871 TREC-DD POLAR payloads. It predicts 57 MIME classes.

Usage

Homebrew Python is an externally managed environment and must not be modified with pip --break-system-packages. For the command-line application, install Bytewise into an isolated Python 3.12 environment with uv:

uv tool install --python 3.12 --editable "$HOME/git/bytewise[metal]"
uv tool update-shell

Open a new terminal (or add $HOME/.local/bin to PATH) and verify it:

bytewise --version
bytewise model-info

The metal extra pins the validated TensorFlow 2.18.1 and tensorflow-metal 1.2 runtime. On a non-Mac system, replace metal with inference.

For development or library use, keep the dependency in a project environment:

cd "$HOME/git/bytewise"
uv sync --python 3.12 --extra metal --group tests
uv run bytewise model-info
uv run python

Inside that uv run python session:

from bytewise import Detector

detector = Detector.load_default()
result = detector.detect_file("document.bin")

print(result.mime_type)
print(result.confidence)
print(result.alternatives)

The same model is available from the command line:

bytewise detect document.bin image.dat
bytewise detect document.bin --top-k 5 --threshold 0.80 --json
cat unknown.bin | bytewise detect -
bytewise supported
bytewise model-info

Allow uncertain inputs to abstain so another detector can handle them:

detector = Detector.load_default(confidence_threshold=0.80)
result = detector.detect_bytes(payload)
if result.abstained:
    # Fall back to tika-python, libmagic, or another detector.
    pass

Frozen v1 model

The selected model is polar-byte-transformer-seed550-v1:

  • Validation accuracy: 96.77%
  • Independent-reference accuracy: 94.59%
  • Input: first 4,096 raw bytes
  • Labels: 57 MIME types
  • Model SHA-256: 72a2f5f2dd0fbb4ffaf88488618bc8e034c03876c7cea94d11da23439ed5b849

See the model card and Full-v3 report for the complete evidence.

Repository organization

  • src/bytewise/: production API and migrated byte-frequency research code
  • artifacts/: immutable model release bundle
  • configs/, scripts/: reproducible experiments and evaluation
  • reports/: curated D3 reports from early pilots through Full-v3
  • docs/: research and repository-extraction documentation
  • tests/: standalone production and research regression tests

Dataset bytes, feature caches, databases, raw predictions, and transient logs are intentionally kept outside Git.

Download files

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

Source Distribution

bytewise-0.1.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

bytewise-0.1.0-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file bytewise-0.1.0.tar.gz.

File metadata

  • Download URL: bytewise-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bytewise-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da9d90d2cf523840e1f735bcb75c87b6444995af444e5160ad06757221380704
MD5 c3386c71379fd1dfaf6280ca614bbcde
BLAKE2b-256 0fe907c4ed36a0f4bd7804f47f8b291cd70f9c7c881eb88c64f2fd013078f16c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytewise-0.1.0.tar.gz:

Publisher: publish.yml on chrismattmann/bytewise

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bytewise-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bytewise-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bytewise-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3218d1093cf5678d035434a0fd3777d9f97dd7a0492eeccc15a1bc20e13f8f1c
MD5 ee7aad39dd21cde6079e4fd6df00e79e
BLAKE2b-256 b234f319bcdecccd3a7fb3a1fcd51d7bb33698b48542460b9705e667788d0a3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bytewise-0.1.0-py3-none-any.whl:

Publisher: publish.yml on chrismattmann/bytewise

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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