aimet_onnx.spinquant

Top level APIs

Model topology

SpinQuant places every rotation using an LlmTopology, which describes the structure of the decoder stack: which linears read from and write to the residual stream (R1), which are the V and O projections (R2), and which Q/K edges feed each QKᵀ MatMul (R3). Analyze the model, then pass the result as topology:

topology = analyze_llm_topology(onnx_model, model_type="llama")
apply_spinquant(onnx_model, topology=topology)
sim = QuantizationSimModel(onnx_model, ...)   # built on the rotated graph