Text Generation
RWKV
English
maba-instant
maba
maba-instant-v1
architecture
custom-architecture
state-space-model
ssm
mamba
mamba-3
recurrent
dgda
decoupled-gated-delta-attention
gated-deltanet
linear-attention
linear-recurrence
mla
multi-head-latent-attention
deepseek
flow-matching
continuous-flow
non-autoregressive
speculative-decoding
low-latency
microsecond-latency
cpu-inference
avx-512
avx2
simd
cpp
c++
fast-exit
early-exit
rlcd
brier-score
calibration
hft
algorithmic-trading
order-book
real-time
on-device
edge-ai
efficient-inference
zero-kv-cache
arena-allocator
sub-quadratic
llm
nlp
Instructions to use AndrewThompson1233/maba-instant-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- RWKV
How to use AndrewThompson1233/maba-instant-v1 with RWKV:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
File size: 3,341 Bytes
9ceb2d7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #include "maba_instant/pipeline.hpp"
#include <iostream>
#include <iomanip>
#include <vector>
#include <numeric>
#include <cassert>
int main() {
maba::Config cfg;
cfg.dim_model = 256;
cfg.ssm_state_dim = 32;
cfg.canvas_len = 32;
cfg.canvas_dim = 128;
cfg.vocab_size = 512;
cfg.exit_threshold = 0.85f;
cfg.entropy_threshold = 0.05f;
cfg.entropy_stop = 0.01f;
cfg.temperature = 1.0f;
cfg.recurrence = maba::RecurrenceKind::DGDA;
cfg.dgda_heads = 4;
cfg.dgda_dk = 32;
cfg.dgda_dv = 32;
cfg.mla_latent_dim = 64;
maba::MabaPipeline pipe(cfg);
std::vector<float> input_vec(cfg.dim_model, 0.1f);
for (size_t i = 0; i < cfg.dim_model; ++i) {
input_vec[i] = 0.05f * std::sin(static_cast<float>(i));
}
for (int i = 0; i < 10; ++i) {
pipe.process(input_vec.data(), maba::SchemaKind::Choice, true);
}
const int iterations = 1000;
double sum_t0_fast = 0.0;
int fast_exits = 0;
for (int i = 0; i < iterations; ++i) {
const auto& out = pipe.process(input_vec.data(), maba::SchemaKind::Choice, false);
sum_t0_fast += out.latency.tier0_us;
if (out.decision.fast_exit) {
fast_exits++;
}
}
double avg_t0_fast = sum_t0_fast / iterations;
double sum_t0 = 0.0;
double sum_t1 = 0.0;
double sum_t2 = 0.0;
double sum_total = 0.0;
double sum_per_tok = 0.0;
double sum_tps = 0.0;
for (int i = 0; i < iterations; ++i) {
const auto& out = pipe.process(input_vec.data(), maba::SchemaKind::Choice, true);
sum_t0 += out.latency.tier0_us;
sum_t1 += out.latency.tier1_us;
sum_t2 += out.latency.tier2_us;
sum_total += out.latency.total_us;
sum_per_tok += out.latency.per_token_us;
sum_tps += out.latency.tok_per_sec;
}
std::cout << std::fixed << std::setprecision(2);
std::cout << "tier0_fast_exit_us " << avg_t0_fast << "\n";
std::cout << "tier0_full_us " << (sum_t0 / iterations) << "\n";
std::cout << "tier1_us " << (sum_t1 / iterations) << "\n";
std::cout << "tier2_us " << (sum_t2 / iterations) << "\n";
std::cout << "cascade_us " << (sum_total / iterations) << "\n";
std::cout << "per_tok_us " << (sum_per_tok / iterations) << "\n";
std::cout << "tok_per_sec " << (sum_tps / iterations) << "\n";
std::cout << "fast_exit_pct " << (100.0 * fast_exits / iterations) << "\n";
std::vector<float> ctx_seq(16 * cfg.dim_model, 0.05f);
std::vector<float> k_proj(16 * 32);
std::vector<float> centroids(1 * 32);
size_t num_blocks = 0;
pipe.indexer().project_k(ctx_seq.data(), 16, k_proj.data());
pipe.indexer().compute_centroids(k_proj.data(), 16, centroids.data(), num_blocks);
auto topk = pipe.indexer().query_topk(input_vec.data(), centroids.data(), num_blocks, 1);
std::cout << "indexer_matches " << (topk.empty() ? 0 : 1) << "\n";
std::vector<float> confs = {0.95f, 0.88f, 0.72f, 0.45f, 0.91f};
std::vector<bool> accs = {true, true, true, false, true};
float ece = maba::Tier0Jev::expected_calibration_error(confs, accs, 5);
std::cout << "ece " << ece << "\n";
std::vector<float> p = {0.8f, 0.1f, 0.1f};
float brier = maba::Tier0Jev::brier_score(p, 0);
std::cout << "brier " << brier << "\n";
return 0;
}
|