Skip to content

Commit 7c1b138

Browse files
authored
Add CLAUDE.md with AI agent instructions and quick reference (#4195)
* Update base for Update on "Add CLAUDE.md with AI agent instructions and quick reference" Replace empty placeholder with structured documentation for AI coding assistants (Claude Code, Cursor, Copilot). Includes config class table, granularity reference, deprecated API warnings, and pointers to in-repo docs for architecture details. Comparison: Old CLAUDE.md vs New CLAUDE.md Instructions+Scripts for repro available in https://github.com/supriyar/torchao-eval Setup: - Subject model: Claude Sonnet - Judge model: Claude Opus Sonnet/Opus Results (61 prompts, final) <img width="586" height="257" alt="image" src="https://github.com/user-attachments/assets/fc1ff374-eb02-40ed-91c7-089f55715144" /> [ghstack-poisoned]
1 parent 79159f2 commit 7c1b138

1 file changed

Lines changed: 50 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1-
# TorchAO Claude Instructions
1+
# TorchAO
22

3-
Fill me in
3+
PyTorch-native library for quantization, sparsity, and low-precision training.
4+
5+
## Config Classes
6+
7+
All configs inherit from `AOBaseConfig`. Defined in `torchao/quantization/quant_api.py`. Use `FqnToConfig` to apply different configs to different layers by module name.
8+
9+
## Stable vs Prototype
10+
11+
- **Stable** (`torchao/quantization/`, `torchao/float8/`, `torchao/sparsity/`, `torchao/optim/`): API stability guaranteed.
12+
- **Prototype** (`torchao/prototype/`): Experimental, API may change without notice.
13+
14+
See [docs/source/workflows/index.md](docs/source/workflows/index.md) for the full dtype x hardware status matrix.
15+
16+
## Architecture and Contributing
17+
18+
- [Quantization Overview](docs/source/contributing/quantization_overview.rst) - full stack walkthrough, tensor subclasses, quantization flows
19+
- [Contributor Guide](docs/source/contributing/contributor_guide.rst) - how to add tensors, kernels, configs
20+
- [Inference Workflows](docs/source/workflows/inference.md) - which config to use for which hardware
21+
- [PT2E Quantization](docs/source/pt2e_quantization/index.rst) - PyTorch 2 Export quantization for deployment backends (X86, XPU, ExecuTorch)
22+
23+
These render at https://docs.pytorch.org/ao/main/
24+
25+
## Deprecated APIs
26+
27+
Do not use or recommend these:
28+
- `AffineQuantizedTensor` (AQT) in `torchao/dtypes/` - old v1 system, being removed
29+
- `autoquant()` - deleted
30+
- Layout registration system (`PlainLayout`, `Float8Layout`, `TensorCoreTiledLayout`, etc.) - deleted
31+
- `TorchAODType` - deprecated
32+
- `change_linear_weights_to_int4_woqtensors` - deleted, use `quantize_(model, Int4WeightOnlyConfig())`
33+
34+
New tensor types should inherit from `TorchAOBaseTensor` in `torchao/utils.py`, not AQT.
35+
36+
## Development
37+
38+
```bash
39+
# Setup
40+
USE_CPP=0 pip install -e . --no-build-isolation # CPU-only
41+
USE_CUDA=1 pip install -e . --no-build-isolation # With CUDA
42+
43+
# Test (mirrors source structure)
44+
pytest test/quantization/test_quant_api.py
45+
pytest test/float8/
46+
pytest test/prototype/mx_formats/
47+
```
48+
49+
## Commit Messages
50+
51+
- Do not commit without explicit request from the user

0 commit comments

Comments
 (0)