LIFT — Language for Intelligent Frameworks and Technologies
Unified intermediate representation for AI and quantum computing.
LIFT is a modular compiler framework that provides a single SSA-based intermediate representation spanning tensor operations (AI/ML), quantum gates, and classical-quantum hybrid computation. It enables a unified pipeline: define → verify → analyse → optimise → predict → export.
Key Features
- 107 tensor operations — arithmetic, attention (Flash, Paged, GQA), convolutions, normalisation, quantisation, MoE, GNN, diffusion, and more
- 46+ quantum gates — Pauli, Clifford, parametric, multi-qubit; noise models, Kraus channels, QEC codes
- 21 hybrid operations — encoding strategies, gradient methods (parameter shift, adjoint), variational algorithms (VQC, VQE, QAOA)
- 11 optimisation passes — canonicalise, constant folding, DCE, CSE, tensor fusion, FlashAttention replacement, quantisation annotation, gate cancellation, rotation merging, noise-aware scheduling, qubit layout mapping
- 3 export backends — LLVM IR (GPU/CPU runtime), ONNX (opset 21, PyTorch/TensorFlow/TensorRT interop), OpenQASM 3.0 (IBM, Rigetti, IonQ, Quantinuum)
- Programmatic model generation —
ModelBuilderAPI for defining models from Rust code,lift-codegenbinary for automatic.lif/.lith/.ll/.onnx/.qasmgeneration - Cost modelling — roofline analysis, GPU/QPU profiles (A100, H100, IBM, IonQ, etc.), energy/carbon estimation
- Performance prediction — compute vs memory bottleneck identification
Architecture
┌──────────┐
│ lift-cli │ ← User interface
└────┬─────┘
┌─────────────┼─────────────┐
│ │ │
┌──────┴──────┐ ┌────┴────┐ ┌──────┴──────┐
│ lift-import │ │lift-opt │ │ lift-export │
└──────┬──────┘ └────┬────┘ └──────┬──────┘
│ │ │
┌──────┴──────┐ ┌────┴────┐ ┌──────┴──────┐
│ lift-ast │ │lift-sim │ │lift-predict │
└──────┬──────┘ └────┬────┘ └──────┬──────┘
│ │ │
┌──────┴─────────────┴─────────────┴──────┐
│ lift-core │
├──────────┬──────────┬───────────────────┤
│lift-tensor│lift-quantum│ lift-hybrid │
└──────────┴──────────┴───────────────────┘
Crates
| Crate | Description |
|---|---|
| lift-core | SSA IR, type system, verifier, printer, pass manager, dialect registry, ModelBuilder |
| lift-ast | Lexer, parser, IR builder for .lif source files |
| lift-tensor | 107 tensor operations with shape inference and FLOP counting |
| lift-quantum | 46+ quantum gates, hardware providers, device topology, noise models, Kraus channels, QEC |
| lift-hybrid | 21 hybrid ops — encoding, gradient methods, variational algorithms, co-execution |
| lift-opt | 11 optimisation passes (classical, quantum, and AI-specific) |
| lift-sim | Classical/quantum cost models, energy estimation, reactive budgets, module analysis |
| lift-predict | Roofline-based performance prediction |
| lift-import | ONNX, PyTorch FX, OpenQASM 3.0 importers |
| lift-export | LLVM IR, ONNX (opset 21), OpenQASM 3.0 exporters |
| lift-config | .lith configuration file parser |
| lift-cli | Command-line interface (verify, analyse, optimise, predict, export, print) |
| lift-codegen | Programmatic model generation binary — define models from Rust, emit all formats |
Quick Start
Prerequisites
- Rust 1.80+ — install via rustup
Build
Run the CLI
# Verify a .lif file
# Analyse
# Optimise
# Predict performance
# Export to LLVM IR
# Export to ONNX
# Export to OpenQASM 3.0
Programmatic Model Generation
Define models directly from Rust code and generate all formats with a single command:
This generates into examples/:
- 4
.lifmodels — Phi-3-mini, MLP, ResNet block, VQE circuit - 4
.llfiles — LLVM IR exports - 4
.onnxfiles — ONNX exports - 1
.qasmfile — OpenQASM export (for quantum models) - 1
.lithconfig — H100 optimization configuration
Each model is automatically verified, analysed, optimised, and exported.
Define Models from Rust
use ;
let model = new
.function
.param
.param
.op
.op
.returns
.done;
// Generate .lif source (parseable by lift-cli)
model.write_lif.unwrap;
// Build IR context for verification/analysis/export
let ctx = model.build_context;
verify.unwrap;
// Export to all backends
let llvm_ir = new.export.unwrap;
let onnx_ir = new.export.unwrap;
write.unwrap;
write.unwrap;
Use as a Library
[]
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
= "0.3.0"
use ;
use ;
// Parse a .lif file
let source = read_to_string.unwrap;
let tokens = new.tokenize.to_vec;
let program = new.parse.unwrap;
let mut ctx = new;
new.build_program.unwrap;
// Verify
verify.unwrap;
// Optimise (all 11 passes)
let mut pm = new;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.add_pass;
pm.run_all;
// Export to all 3 backends
let llvm = new.export.unwrap;
let onnx = new.export.unwrap;
let qasm = new.export.unwrap;
Export Backends
LLVM IR
Generates LLVM IR with runtime function calls for all 107 tensor operations (cuBLAS/cuDNN backend):
ONNX
Generates ONNX protobuf text format (opset 21) compatible with PyTorch, TensorFlow, TensorRT, and ONNX Runtime. Supports Microsoft extensions for attention and MoE operations:
Supported ONNX op mappings:
| LIFT Operation | ONNX Op | Domain |
|---|---|---|
tensor.matmul |
MatMul |
standard |
tensor.linear |
Gemm |
standard |
tensor.relu |
Relu |
standard |
tensor.gelu |
Gelu |
standard |
tensor.softmax |
Softmax |
standard |
tensor.layernorm |
LayerNormalization |
standard |
tensor.rmsnorm |
SimplifiedLayerNormalization |
com.microsoft |
tensor.conv2d |
Conv |
standard |
tensor.attention |
Attention |
com.microsoft |
tensor.grouped_query_attention |
GroupQueryAttention |
com.microsoft |
tensor.flash_attention |
MultiHeadAttention |
com.microsoft |
tensor.quantize |
QuantizeLinear |
standard |
tensor.dequantize |
DequantizeLinear |
standard |
tensor.moe_dispatch |
MoE |
com.microsoft |
| + 60 more operations |
OpenQASM 3.0
Generates OpenQASM 3.0 for quantum hardware execution. Supports all 46+ gates including IBM, Rigetti, IonQ, and Quantinuum native gate sets:
File Formats
| Extension | Description |
|---|---|
.lif |
LIFT IR source code |
.lith |
Compilation configuration |
.ll |
LLVM IR export |
.onnx |
ONNX export (protobuf text) |
.qasm |
OpenQASM 3.0 export |
Examples
See the examples/ directory:
Hand-written models
phi3_mini.lif— Phi-3-mini transformerdeepseek_v2_lite.lif— DeepSeek V2 Lite (MoE)llama2_7b.lif— LLaMA-2 7Bmistral_7b.lif— Mistral 7B (sliding window attention)bert_base.lif— BERT-basetensor_mlp.lif— Multi-layer perceptronattention.lif— Transformer self-attentionquantum_bell.lif— Bell state preparation
Generated models (via cargo run --bin lift-codegen)
phi3_generated.lif— Phi-3-mini (programmatic)mlp_generated.lif— MLP classifier (programmatic)resnet_generated.lif— ResNet block (programmatic)vqe_generated.lif— VQE circuit (programmatic)
Validation
Documentation
- LIFT_Guide.md — Complete feature guide with code examples for every crate
- LIFT_Manual.md — User manual with real-world use cases
- LIFT_design.md — Architecture and design document
- CAPABILITIES.md — Capabilities, limits, and roadmap
- DIALECTS.md — Dialect reference (tensor, quantum, hybrid)