Skip to content

About

Learned product-hash routing for sparse causal attention

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Misul Computing

Monodratic

Monodratic is a sparse attention architecture with stateless routing. It maps post-RoPE query and key geometry into bounded causal posting lists, selects a fixed number of source blocks, and applies exact softmax to the selected tokens.

The component accepts and returns tensors with shape [batch, sequence, model width]. Normalization, residual updates, feed-forward layers, and inference scheduling remain outside its boundary.

Scope

The technical report tests learned non-bypass retrieval, agreement with a dense selected-mask oracle, bounded routing capacity, and finite-range scaling. It also reports an all-eligible donor, an all-eligible counterfactual using the sparse-trained weights, and a target-forced counterfactual under the same maximum two-block routing budget. The primary run uses 300 donor, 120 router-only, and 200 joint updates per seed.

Natural-language quality, asymptotic linear construction, and fused-kernel speed are not claimed.

Results

  • Associative recall: 763 of 768 answers correct, 99.35% mean accuracy, and 98.05% minimum accuracy across three seeds.
  • Counterfactuals: 768 of 768 for the all-eligible donor and target-forced R2 under an unchanged maximum width; 739 of 768 for all-eligible attention using the sparse-trained weights.
  • Routing: 753 of 768 final-layer target-block hits, non-bypass execution, and zero overflow.
  • Learned-R2 selected-mask oracle: 1.43 x 10^-6 maximum absolute error.
  • Packed routing: 0.993 fitted timing exponent from 4,096 to 32,768 tokens on four CPU threads.

Use

import torch
from monodratic import MonodraticPHIMixer, monodratic_phi_preset

config = monodratic_phi_preset(256, 8)
mixer = MonodraticPHIMixer(config)
x = torch.randn(2, 1024, 256)
y = mixer(x)

Reproduce

uv sync --group test
uv run pytest -q
(cd results && shasum -a 256 -c checksums.sha256)
uv run python experiments/phi_mqar.py --output tmp/mqar.json
uv run python experiments/packed_scaling.py --output tmp/scaling.json

Links

Monodratic is written by Deyan Todorov and published by Misul Computing.

The software is licensed under Apache-2.0.

About

Learned product-hash routing for sparse causal attention

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages