LiteRT / tensor
AGENTS.md3.6k starsChanged 8 days agoApache-2.0View on GitHub
This directory contains the C++ LiteRT Tensor API: a lightweight, backend-agnostic graph construction and execution framework for on-device generative AI and ML models across XNNPACK (CPU), ML Drift (OpenCL/Metal/WebGPU GPU), TFLite FlatBuffer export, and multi-backend ModelChain runners. - GPU tests on Forge (ML Drift over OpenCL): Tag cc_test targets that require an OpenCL GPU with tags = ["requires-gpu-sm90"]. - Large checkpoint tests: Do not check multi-GB .safetensors or .gguf weights into Piper. Keep unit tests in TAP fast and hermetic…
Trending
Quiet since September.about the whole repository
Who's talking about google-ai-edge/LiteRT
- google-ai-edge/LiteRT-LM“[Feature Request] Enable building GPU accelerator plugins from source for cross-platform distribution”GitHub · Dec 3, 2025 · 4 reactions
- A Hacker News story“LiteRT – Google's Edge ML Framework”Hacker News · Jan 12, 2026 · 2 points
- margelo/react-native-fast-tflite“feat: Android litert version bump and 16KB page support”GitHub · Jul 3, 2025 · 2 reactions
- webmachinelearning/webnn“conv2d: infer groups from input and filter shapes when not specified”GitHub · Sep 29, 2026 · 1 reactions
- baneeishaque/attentive-gan-derainnet“Scheduled daily dependency update on Monday”GitHub · Jul 20, 2026 · 1 reactions
The biggest 5 of 27 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 27
Talked about on GitHub, Hacker News and Bluesky (27 times).
On GitHub · 25
- Dec 3, 2025[Feature Request] Enable building GPU accelerator plugins from source for cross-platform distribution — google-ai-edge/LiteRT-LM4 reactions · 8 comments
- Jul 3, 2025feat: Android litert version bump and 16KB page support — margelo/react-native-fast-tflite2 reactions · 19 comments
- Sep 29, 2026conv2d: infer groups from input and filter shapes when not specified — webmachinelearning/webnn1 reaction · 2 comments
- Jul 20, 2026Scheduled daily dependency update on Monday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 18, 2026Scheduled daily dependency update on Saturday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
20 more on GitHub
- Jul 16, 2026Scheduled daily dependency update on Thursday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 14, 2026Scheduled daily dependency update on Tuesday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 12, 2026Scheduled daily dependency update on Sunday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 10, 2026Scheduled daily dependency update on Friday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 8, 2026Scheduled daily dependency update on Wednesday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 6, 2026Scheduled daily dependency update on Monday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 4, 2026Scheduled daily dependency update on Saturday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jul 2, 2026Scheduled daily dependency update on Thursday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 30, 2026Scheduled daily dependency update on Tuesday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 28, 2026Scheduled daily dependency update on Sunday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 26, 2026Scheduled daily dependency update on Friday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 24, 2026Scheduled daily dependency update on Wednesday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 22, 2026Scheduled daily dependency update on Monday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 20, 2026Scheduled daily dependency update on Saturday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Jun 18, 2026Scheduled daily dependency update on Thursday — baneeishaque/attentive-gan-derainnet1 reaction · 5 comments
- Apr 21, 2026Run LiteRT checks only when verify_numerics — keras-team/keras-hub1 reaction · 2 comments
- Jan 30, 2026Update tensorflow requirement from <2.19,>=2.14 to >=2.14,<2.21 — tphakala/birdnet-onnx-converter1 reaction · 4 comments
- Jan 27, 2026Fix `rules_rust` importing an old `bazel_build_apple_support` — google-ai-edge/LiteRT-LM1 reaction · 1 comment
- Jan 27, 2026Update build_bazel_apple_support version and checksum — bazelbuild/rules_rust1 reaction
- Jan 27, 2026Update build_bazel_apple_support — protocolbuffers/protobuf1 reaction
On Hacker News · 1
- Jan 12, 2026LiteRT – Google's Edge ML Framework2 points
On Bluesky · 1
- Mar 12, 2026📦 google-ai-edge / LiteRT ⭐ 1,566 (+6) 🗒 C++ LiteRT, successor to TensorFlow Lite. is Google's On-device framework for high-performance… — @github-trending.bsky.social1 likes and repost · 1 reply
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
When bringing up a new Hugging Face or GGUF model family under models/<family>/, follow the 5-stage gated workflow and load the …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions for //tensor/
<!-- disableFinding(LINE_OVER_80) -->This directory contains the C++ LiteRT Tensor API: a lightweight, backend-agnostic graph construction and execution framework for on-device generative AI and ML models across XNNPACK (CPU), ML Drift (OpenCL/Metal/WebGPU GPU), TFLite FlatBuffer export, and multi-backend ModelChain runners.
1. Repository Layout
| Path | Purpose |
tensor.h, arithmetic.h, datatypes.h, buffer.h | Core Tensor API graph primitives (TensorHandle, Shape, Type, Quantization, arithmetic ops). |
ops/ | Core operator definitions (FullyConnected, BatchMatMul, DepthwiseConv2D, Concatenation, Slice, Reshape, Transpose, Softmax, Select, etc.). |
examples/ops/transformer/ | Tier-1 reusable transformer building blocks (RmsNorm, RoPE, ScaledDotProductAttention, GatedMlp, etc.) templated on backend mixins. |
examples/utils/ | Checkpoint and config helpers (SafetensorLoader, LazyTensorMapping, TensorLoadingHooks, minijson). |
examples/gguf/ | GGUF parser and loader (GgufParser, GgufLoader) for multi-format quantized GGUF checkpoints (Q4_0, Q4_K_M, K-quants, I-quants, Q8_0). |
backends/xnnpack/, runners/xnnpack/ | Direct XNNPACK CPU backend and model runner (XnnpackModelRunner). |
backends/ml_drift/, runners/ml_drift/ | Direct ML Drift GPU backend and compiled OpenCL & Apple Metal model runners (CompiledMlDriftModelRunner, MlDriftClBackend, MlDriftMetalBackend, CompiledMlDriftMetalModelRunner). |
backends/tflite/, backends/multi_backend/ | .tflite FlatBuffer serializer (ModelFactory) and heterogeneous CompositeModel / ModelChain partitioner. |
examples/gemma3/, examples/gemma4/ | Reference Gemma 3 and Gemma 4 C++ graphs and runtimes. |
models/common/ | Model-agnostic bring-up scaffold: checkpoint weight hooks and load-time quantization, declarative WeightMap, HfConfigReader, DecoderLayout / BuildDecoderForwardGraph / RuntimeBackend, the generic TextDecoderRuntime<ModelTraits> (checkpoint discovery, tokenizer, prefill/decode/generate, Benchmark()), XnnpackRuntimeBackend<ModelTraits>, and the reusable TYPED_TEST_P suites in common/testing/. |
models/<family>/ | End-to-end model bring-up packages (e.g., models/qwen3_5/) built on models/common/: config, weight declaration + name predicates, templated C++ graph, DecoderLayoutOf + ModelTraits, RuntimeTraits, GPU backends, HF reference goldens, and the V0–V3 + benchmark test instantiations. |
_agents/skills/ | Modular agent skills for end-to-end model bring-up, verification, quantization, and CPU/GPU performance tuning. |
2. Build & Test Conventions
- Always use
blaze-for-agents:/google/bin/releases/arca9-local-blaze-cli/blaze-for-agents test -c opt //tensor/... - GPU tests on Forge (
ML Driftover OpenCL): Tagcc_testtargets that require an OpenCL GPU withtags = ["requires-gpu-sm90"]. - Large checkpoint tests:
Do not check multi-GB
.safetensorsor.ggufweights into Piper. Keep unit tests in TAP fast and hermetic using deterministic LCG synthetic models (test_model.h,CreateSynthetic,<model>_perf_smoke_test) and checked-in small golden files (testdata/*.txt,testdata/*.json). Mark full-checkpoint teststags = ["manual", "local"](CPU) ortags = ["manual", "notap", "requires-gpu-sm90"](GPU via local staginggenrules).
3. End-to-End Model Bring-Up Lifecycle (V0 -> V1 -> V2 -> V3 -> Perf)
When bringing up a new Hugging Face or GGUF model family under models/<family>/, follow the 5-stage gated workflow and load the corresponding skill from _agents/skills/ before writing code:
| Stage | Gate & Objective | Skill to Read First | ||
| Stage 1: Intake & Architecture Card | Parse config.json & checkpoint tensor headers, document the architecture card and weight table in models/<family>/README.md, audit Tier-1 ops vs backend capabilities, and select target precision classes. | _agents/skills/hf_intake_and_arch_card/SKILL.md | ||
| Stage 2: C++ Graph & Runtime Authoring | Author <model>_config (HfConfigReader), <model>_weights (DeclareWeights + name predicates over the shared hooks), <model>_graph.h (template <typename BackendMixin>), <model>_forward_pass (DecoderLayoutOf + ModelTraits over BuildDecoderForwardGraph), and <model>_runtime (RuntimeTraits; the runtime itself is common::TextDecoderRuntime). | _agents/skills/cpp_graph_authoring/SKILL.md | ||
| Stage 3: V0–V2 Golden Verification | Verify V0 per-op/stage parity (<model>_op_parity_ml_drift_test), V1 synthetic LCG + real-weight FP32 parity against transformers (`max | Δ | <= 1e-4), and V2 decode-step state handoff (prefill(T) + decode(1) == prefill(T+1)`) on XNNPACK and ML Drift. | _agents/skills/hf_golden_verification/SKILL.md |
| Stage 4: V3 Quantization & GGUF | Enable compressed-tensors W8A8, load-time int8_channel (--weights=int8) and q4_0 (--weights=q4_0), per-row INT8 tied lm_head (--int8_head), and multi-format GGUF (GgufLoader), verified against dequantized-weight HF goldens. | _agents/skills/quantize_weights_and_gguf/SKILL.md | ||
| Stage 5: CPU & GPU Runner Tuning & Benchmarking | Optimize peak RSS (--low_memory), XNNPACK qd8/qb4w threading, ML Drift zero-copy GPU state binding (ExternalTensorsInfo::immutable_tensors), async I/O, and kF32F16 precision; benchmark pp64/tg32 against llama.cpp, instantiate TextDecoderPerfSmokeTest as <model>_perf_smoke_test, and register the model in the shared harness (agent/scripts/benchmark_tensor_api.py, models/docs/BASELINE.md). | _agents/skills/tune_cpu_and_gpu_runners/SKILL.md |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

