Native Hanzo AI/ML research and systems-design skill for LLMs, encoders, decision models, training, inference, kernels, quantization, retrieval/reranking, safety, evaluation, and scientific benchmarking. Use Hanzo's Rust stack (hanzo-ml, hanzo-nn, hanzo-train, hanzo-transformers, hanzo-kernel/DSL, hanzo-research, engine, and decision/Kai) by default; search current literature when needed; record falsifiable experiments and artifacts through the unified /v1/research plane.
Use this skill for machine learning, LLM, encoder, decision-model, retrieval, training, inference, kernel, quantization, safety, evaluation, or AI architecture work in the Hanzo stack.
The default operating principle is:
Research in the same stack that ships.
Exploratory scripts may be used for disposable analysis, but canonical results, model code, training, evaluation, latency measurements, and production paths should be implemented and reproduced in native Rust on Hanzo's ML/runtime stack unless the task explicitly requires another environment.
Prefer the repository/workspace already associated with the task. The important Hanzo components are:
hanzoai/mlhanzo-ml: tensor/autograd/device layerhanzo-nn: neural-network moduleshanzo-train: optimizers and training utilitieshanzo-transformers: transformer/model building blockshanzo-kernel / Hanzo kernel DSL: generated and hand-optimized kernelshanzo-research: native research/evidence SDKhanzoai/engine: native Rust model inference, serving, kernels, batching, quantization, and backend integrationhanzoai/decision: Kai typed-decision models, training, evaluation, decision programs, safety heads, retrieval/reranking, and benchmark harnesshanzoai/python-sdk/pkg/hanzo-research: parity client for the research plane; not the canonical implementation for Rust-native experimentsWhen a local workspace exposes additional Hanzo DSL, CUDA, ROCm, Metal, Vulkan, distributed-training, or model crates, inspect and reuse them rather than creating parallel implementations.
Canonical R&D evidence should be recorded through hanzo-research, which writes to the unified research plane under /v1/research.
Rust:
use hanzo_research::{Research, Verdict};
let r = Research::from_env();
let mut exp = r
.experiment("pooling", "j6-logmeanexp", "override-detection")
.metric("recall_at_99_5_specificity")
.hypothesis("localized pooling recovers procedural override evidence hidden by mean pooling")
.predict("LogMeanExp improves held-out override recall without increasing benign FP beyond the preregistered gate");
exp.log("frozen encoder; identical split, seed, optimizer, and token cache across arms");
exp.conclude(
Verdict::Proven,
"LogMeanExp cleared the preregistered gate",
Some(0.87),
)?;
Environment:
HANZO_API_KEYRESEARCH_BASE (defaults to https://api.hanzo.ai)RESEARCH_PROJECTImportant native endpoints include:
POST /v1/research/experimentsGET /v1/research/experimentsGET /v1/research/totalsPOST /v1/research/artifactsUse hanzo-research APIs rather than hand-rolling HTTP when working in Rust. The SDK automatically captures repository, git, host, and resolved Hanzo crate provenance.
A refutation is a valid research result. Do not rewrite failed hypotheses into successes after the run.
For substantial research work, follow this order.
Write a falsifiable hypothesis before looking at the decisive result.
Bad:
Try some pooling methods and see what works.
Good:
Frozen P0 token states already encode procedural-override evidence, but global mean pooling dilutes short localized cues. A learned linear token scorer with normalized LogSumExp pooling should improve family-held-out override recall at fixed benign specificity.
Specify:
Before proposing a replacement:
Do not recommend rebuilding components that already exist.
For state-of-the-art or rapidly changing ML topics, search current primary sources before making SOTA claims.
Prefer:
Use external research to generate hypotheses and baselines. Reimplement important mechanisms in the Hanzo stack before treating them as production candidates.
Good areas to scan when relevant:
Change one causal factor at a time.
Examples:
Keep identical where possible:
If one arm uses extra capacity, report it as a capacity ablation, not a clean mechanism ablation.
Before benchmarking, add tests that make silent confounds fail loudly.
Typical invariants:
Do not collapse a pipeline failure into one metric.
For retrieval/reranking, separate:
For classification/safety, separate:
For model adaptation, separate:
For latency, separate:
When adding a protection or adaptation mechanism, compare against both:
This distinguishes retention from causal prevention of degradation.
When continuation matters, prefer full warm resume:
Once the preregistered endpoint is reached:
/v1/researchproven, refuted, or inconclusiveTraining-time operations return tensors. Do not call to_scalar, to_vec, or equivalent host extraction before the loss/backward boundary.
Bad:
let score: f32 = pooled.to_scalar()?;
inside a trainable forward path.
Good:
let pooled: Tensor = pool.forward(&scores, &mask)?;
let loss: Tensor = objective.forward(&pooled, &labels)?;
loss.backward()?;
Convert to host scalars only for logging/evaluation.
Avoid:
Reference implementations may be simple/ragged first. Optimize only after correctness is established.
Keep numerically sensitive reductions in F32 unless a validated lower-precision path is equivalent.
Examples:
Use BF16/FP16/FP8/NVFP4 where supported and validated, but preserve a higher-precision reference.
Separate:
Do not force one expensive path on every decision.
For hundreds to millions of options, prefer a cascade:
StateHandle
↓
semantic / memory retrieval
↓
top-K
↓
late interaction
↓
smaller K
↓
cross-attention / decision scorer
↓
joint verifier
Measure retrieval recall separately from decision accuracy.
Prefer semantic option representations with optional learned/memory residuals so unseen tools/actions can participate without retraining the full model.
If option order is semantically irrelevant, architecture and tests should enforce permutation invariance/equivariance rather than relying only on shuffled training examples.
For decision systems, accuracy alone is insufficient.
Report:
Avoid quantization or objective changes that improve speed/accuracy while silently destroying probability quality.
A specialized safety head should be isolated from unrelated decision types. Require a feature-off/non-target invariance test.
For token-localized safety evidence, test global and localized pooling under the same scorer capacity. Prefer semantic labels and family-held-out negatives over keyword rules.
When optimizing generative models, inspect:
Benchmark on the actual hardware/backend targeted for deployment.
Do not extrapolate CUDA results to ROCm/Metal/Vulkan without measurement.
For a kernel change:
Use hanzo-research so kernel evidence accumulates into the same research corpus as model-level experiments.
Never claim SOTA from mismatched protocols.
For competitor comparisons, match as closely as possible:
If protocols differ, say so explicitly.
Prefer paired comparisons on the same examples:
When reporting a result, lead with:
Use causal language proportional to the design.
Prefer:
Persistent first-order gradient conflict is strongly disfavored under this matched regime.
over:
We proved gradients never conflict.
Prefer:
The result falsifies the architectural capacity-ceiling hypothesis.
over:
The architecture is optimal.
A research mechanism is not production-ready only because it improves one metric.
Before promotion require, as applicable:
/v1/researchWhen choosing between two mechanisms with similar quality, prefer the one that is:
The goal is not merely to win a benchmark. The goal is to produce a reproducible mechanism that becomes a durable primitive in Hanzo ML.