# Kwantyzacja i kompresja

EN: **Quantization and compression** · id `compression`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Inferencja i infrastruktura](https://aiatlasgraph.com/t/systems.md) › Kwantyzacja i kompresja

## Description

- PL: Zmniejszanie kosztu pamięci i obliczeń.
- EN: Cutting memory and compute cost.

## In one sentence

- PL: To zmniejszanie zapisu lub aktywnej części modelu, żeby ograniczyć jego potrzeby pamięciowe i obliczeniowe.
- EN: This reduces a model's representation or active components to lower memory and computation needs.

## Problem it solves

- PL: Model nie mieści się na urządzeniu albo jego obsługa kosztuje zbyt dużo zasobów.
- EN: A model does not fit on your device or serving it consumes too many resources.

## What it does

- PL: Liczby zapisuje się oszczędniej lub pomija wybrane połączenia; uzyskane oszczędności i błędy zależą od metody oraz obsługi sprzętowej.
- EN: Numbers are stored more compactly or selected connections are omitted; savings and errors depend on the method and hardware support.

## Everyday example

- PL: Wybierasz mniejszy zapis modelu do laptopa i porównujesz odpowiedzi z pełniejszą wersją.
- EN: You choose a smaller model representation for a laptop and compare its responses with the fuller version.

## This concerns you if you…

- PL: pamięć urządzenia ogranicza wybór modelu
- PL: chcesz sprawdzić kompromis między kosztem a jakością
- EN: find device memory limits model choice
- EN: want to check cost-quality trade-offs

## Keywords

INT8 · INT4 · post-training quantization · quantization-aware training · structured sparsity · calibration datasets · approximation error · group-wise quantization

## How it works

- PL: Reprezentację wag, aktywacji lub struktury modelu zmienia się tak, aby zużywała mniej zasobów. Kwantyzacja ogranicza precyzję, pruning usuwa elementy, a kalibracja i ewaluacja sprawdzają utratę jakości względem pierwotnego modelu.
- EN: Weight, activation or structural representations are changed to use fewer resources. Quantisation reduces precision, pruning removes elements, and calibration and evaluation assess quality loss against the original model.

## Limits

- PL: Mniejszy zapis nie zawsze daje szybsze wykonanie. Dekodowanie formatu i brak odpowiednich kerneli mogą zniwelować zysk; utratę jakości trzeba mierzyć na reprezentatywnych zadaniach.
- EN: Smaller storage does not always yield faster execution. Format decoding and missing kernels can cancel gains; quality loss needs measurement on representative tasks.

## Key terms

- PL: **kalibracja kompresji**: Dobór parametrów przybliżenia na przykładach reprezentujących przyszłe użycie.
- PL: **błąd przybliżenia**: Różnica wywołana zmianą reprezentacji lub struktury modelu.
- EN: **compression calibration**: Choosing approximation parameters using examples representing future use.
- EN: **approximation error**: A difference caused by changing model representations or structure.

## Know first

- [Algebra liniowa: wektory i macierze (Linear algebra: vectors and matrices)](https://aiatlasgraph.com/t/linearalgebra.md)
- [Zbiory testowe i regresje (Evaluation datasets and regression tests)](https://aiatlasgraph.com/t/evalsets.md)

## Examples

- PL: Niższa precyzja · pruning
- EN: Lower precision · pruning

## Subtopics (3 direct, 3 in total)

- [Kwantyzacja samych wag (Weight-only quantization)](https://aiatlasgraph.com/t/weightquant.md): Storing weights in low precision with layer-by-layer calibration to keep quality at 4 bits and below.
- [Kwantyzacja wag i aktywacji (Weight and activation quantization)](https://aiatlasgraph.com/t/actquant.md): Lowering precision for activations too. Requires taming outlier values that break the scale.
- [Przycinanie wag i rzadkość (pruning) (Pruning and sparsity)](https://aiatlasgraph.com/t/pruning.md): Setting selected weights to zero to obtain a sparse model; pruning may be unstructured or follow a hardware-friendly pattern such as 2:4. The quality-sparsity trade-off depends on the model, calibration data and method; SparseGPT and Wanda are examples of one-shot LLM pruning without retraining.

## Related topics

Untyped, symmetric "see also" links.

- [Rdzenie tensorowe i niska precyzja (Tensor cores and low precision)](https://aiatlasgraph.com/t/tensorcores.md)

## Sources

- [Stanford CS336 · Language Modeling from Scratch (2025)](<https://cs336.stanford.edu/spring2025/>) `cs336` · reference: Budowa modeli, dane, trening, systemy, inferencja i post-training.
- [Full Stack Deep Learning (2022, archiwum)](<https://fullstackdeeplearning.com/course/2022/>) `fsdl` · reference: Pełny cykl systemu ML: dane, testy, wdrażanie, monitoring, zespoły i etyka.
- [FSDL · LLM Bootcamp (2023, archiwum)](<https://fullstackdeeplearning.com/llm-bootcamp/spring-2023/>) `bootcamp` · reference: Aplikacje LLM, prompting, retrieval, UX i LLMOps.
- [DeepLearning.AI — course catalogue](<https://www.deeplearning.ai/courses>) `dlai` · course catalogue: 42 topic labels with counts, about 130 courses.
- [Performance Engineering for AI Infra — learning guide](<https://github.com/wafer-ai/gpu-perf-engineering-resources>) `wafer-gpu` · GitHub repository · tiered curriculum (Tier 1–3) · MIT licence · by Wafer (wafer-ai): Company material with a hiring note, but the evidence is mostly primary sources. Table of contents sieved: only topics became nodes; tiers kept as link labels.
- [LLM Course (Maxime Labonne)](<https://github.com/mlabonne/llm-course>) `mlabonne-llm-course` · by Maxime Labonne

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/compression · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
