NCA-GENL Cheatsheet
NVIDIA-Certified Associate: Generative AI LLMs
Download free PDFGenerative AI and model foundations
Tokens, embeddings and language models
- **Generative AI** learns patterns that support creating text, images or other content. A **foundation model** is broadly pretrained and can be adapted to multiple downstream tasks.
- **Tokenization** splits text into units such as subwords; a tokenizer maps them to token IDs. An **embedding** maps a token or passage to a numerical vector.
- **Word2vec** learns static word embeddings from local word contexts using approaches such as skip-gram and CBOW. Contextual transformer representations can change with the surrounding sentence.
- An **autoregressive language model** predicts the next token from the preceding tokens and generates repeatedly. Its training objective estimates sequence likelihood through these conditional predictions.
Transformer building blocks
- **Attention** forms weighted combinations of value vectors using query-key compatibility. **Self-attention** relates positions within a sequence; multiple heads learn different relationships.
- **Positional information** represents sequence order through encodings or position-dependent attention. Token meaning alone does not tell attention which token came first.
- **Layer normalization** normalizes a token's hidden features to help stabilize training. **Residual connections** preserve a direct information and gradient path around sublayers.
- **Encoder models**, such as BERT, build contextual representations useful for classification and extraction. **Causal decoders** support next-token generation; encoder-decoder models map input sequences to output sequences.
Learning, activations and gradients
- A **forward pass** computes predictions and loss. **Backpropagation** computes loss gradients; an **optimizer** uses those gradients and a learning rate to update weights.
- **Vanishing gradients** become too small to train earlier layers effectively. **Exploding gradients** become excessively large; gradient clipping can limit their magnitude.
- **ReLU**, max(0, x), is inexpensive and nonlinear, with an unbounded positive output. Negative inputs have zero gradient, which can leave some units inactive.
- **Sigmoid** maps a scalar into (0, 1), making it useful for binary or independent-label probability outputs. Saturation at extreme inputs causes small gradients; probability calibration still needs evaluation.
Diffusion and model capacity
- **Forward diffusion** progressively adds noise to data. A learned **reverse process** denoises a noisy sample over successive steps to generate content.
- **Instruction tuning** trains a pretrained model on instruction-response examples. A single model can then handle varied tasks, but larger parameter counts do not guarantee accuracy, explainability or lower inference cost.
- A **context window** limits the tokens available to a request, including its input and generated output under the serving rules. Longer context can admit more evidence but can increase memory use and latency; relevance still matters.
Data preparation and GPU data science
Prepare representative data
- An **ML workflow** moves from problem definition and data collection through exploration, preprocessing, training, evaluation and deployment. Monitoring and feedback guide later iterations.
- **Exploratory data analysis (EDA)** checks distributions, missing values, duplicates, class imbalance, anomalies and text lengths. Inspect domain and language coverage before adapting an LLM.
- Separate **training**, **validation** and **test** data. Fit preprocessing on training data and prevent leakage from duplicates, related users or future information across splits.
- **Data augmentation** creates useful variations while preserving task labels. Image crops, flips or color changes need semantic checks; a transformation can change the correct label.
- **Memory-mapped files** and streaming let programs access datasets without loading everything into RAM. They still depend on storage throughput and do not eliminate GPU memory requirements.
Text analysis and similarity
- **TF-IDF** weights terms by document frequency and rarity across the corpus. **Stemming** heuristically trims word forms; **lemmatization** uses linguistic analysis to find base forms. Neither guarantees a quality gain.
- **N-grams** capture adjacent token sequences, such as bigrams and trigrams. They expose local phrase patterns beyond individual word counts but do not fully represent meaning.
- **Named entity recognition (NER)** finds text spans and labels categories such as person, organization and location. **spaCy** supplies NLP pipelines for tasks including tokenization, linguistic analysis and NER.
- A **regular expression** can select text matching keywords or patterns. Set word boundaries and case handling deliberately; lexical matching does not establish semantic relevance.
- **Cosine similarity** compares vector direction: dot product divided by vector norms. Applied to suitable embeddings, it can rank semantic similarity; scores depend on the embedding model and are not calibrated probabilities.
- **t-SNE** and **UMAP** project high-dimensional data for visualization. Apparent clusters help exploration but are not proof of true classes or globally faithful distances.
RAPIDS and GPU efficiency
- **RAPIDS** provides GPU-accelerated data science libraries. **cuDF** handles DataFrame operations, **cuML** supplies machine learning algorithms, and **cuGraph** handles graph analytics.
- **XGBoost** trains gradient-boosted decision trees and supports GPU acceleration. It and cuML serve machine learning workloads; they are distinct from transformer training frameworks.
- Keep compatible pipeline stages **on the GPU** to reduce CPU-GPU transfers. Parallel GPU computation and supported multi-GPU execution can improve throughput when workloads justify their overhead.
- **Memory pools** reuse device allocations. Batching transfers and using pinned host memory with asynchronous copies can reduce transfer overhead or overlap work; pooling alone does not increase PCIe bandwidth.
Prompting, retrieval and evaluation
Guide the task with a prompt
- A useful **prompt** states the task, relevant context, constraints and desired output format. A **system message** sets application-level behavior; clear instructions still require output checks.
- **Zero-shot prompting** gives a task without demonstrations. **One-shot** gives one example; **few-shot** gives several representative input-output examples. An instruction plus an unanswered input is not a completed example.
- **Chain-of-thought prompting** uses intermediate reasoning steps or worked examples to guide multistep tasks. Reasoning-style output is not proof of correctness; evaluate the final result against the task.
- Few-shot examples can guide classification with little labeled data. Keep labels, formatting and examples consistent; a model can also classify new labels from descriptions or semantic similarity without task-specific retraining.
Choose an adaptation method
- **Prompt engineering** changes supplied instructions and examples without changing model weights. **Prompt learning** optimizes trainable prompt representations, often called soft or virtual tokens.
- **Transfer learning** reuses pretrained knowledge for a new task. **Fine-tuning** updates model parameters with task or domain data; choose a representative dataset and evaluate on held-out examples.
- **Parameter-efficient fine-tuning (PEFT)** trains a small subset or added parameters. **LoRA** learns low-rank weight updates while typically freezing base weights, reducing trainable parameters and optimizer memory.
- **NVIDIA NeMo** provides tooling for developing and customizing language and speech models. **Hugging Face Transformers** supplies pretrained model and tokenizer interfaces for training and inference.
Retrieval-augmented generation
- **RAG** retrieves external information and supplies it as context to a generator. It can update accessible knowledge without retraining model weights; retrieval and fine-tuning solve different needs.
- At ingestion, **clean and chunk** documents, retain metadata, create embeddings and build an index. At query time, retrieve relevant passages, optionally rerank them, and compose a grounded prompt.
- **Chunking** splits content into meaningful segments. Small chunks offer focused retrieval; large chunks preserve more context. Overlap can preserve boundary information but increases duplication and index size.
- An enterprise RAG system needs **authorized retrieval**, useful source coverage and prompt construction. Enforce access controls during retrieval and carry source references through to the response.
- Assess **context precision** for the relevance of retrieved material, **context recall** for coverage of needed evidence, **response relevancy** for answering the query, and **faithfulness** for support in retrieved context.
Match metrics to the task
- **Perplexity** is the exponential of average next-token negative log-likelihood. Lower values mean better prediction on that dataset; compare compatible tokenization and test conditions. It does not directly establish factuality or usefulness.
- **BLEU** measures clipped n-gram precision against reference translations, with a brevity penalty. Use a standard held-out dataset and human references to compare translation systems.
- **ROUGE** measures reference overlap and is common in summarization. ROUGE-N uses n-grams and ROUGE-L uses longest common subsequences; recall is central, while precision and F1 variants are also reported.
- **Accuracy**, precision, recall and F1 suit labeled classification tasks according to their error costs and balance. A fine-tuned model needs task-relevant validation metrics, not a score based on parameter count or training time.
- **GLUE** combines natural language understanding tasks, including sentence similarity and inference. A benchmark score measures its task suite rather than all production capabilities.
- **Validity** asks whether a metric measures the intended property; **reliability** asks whether measurement is consistent. Combine automatic scores with human review when fluency, factuality or safety matters.
Compare models fairly
- **Cross-validation** repeatedly trains and validates on different folds of available data. Keep preprocessing inside each training fold; choose grouped or time-aware splits when random folds would leak information.
- An **A/B test** randomly assigns comparable users or requests to concurrent model variants. Compare predefined outcomes such as recommendation engagement, conversion or task success, with safety and latency guardrails.
- Use sufficient observations and account for uncertainty before accepting an improvement. A before-and-after comparison can be confounded by changing traffic; A/B testing does not guarantee a gain.
Application development and deployment
Model formats, engines and servers
- **ONNX** is a model interchange representation for computational graphs and parameters. Export compatibility depends on supported operators and runtimes; the format itself is not a training or compression method.
- **TensorRT** optimizes inference on NVIDIA GPUs. **Layer fusion** combines compatible operations; kernel selection and reduced precision can reduce execution cost. **Multi-stream execution** can overlap independent work when resources permit.
- **Triton Inference Server** serves models through inference APIs and supports multiple backends. **Dynamic batching** combines compatible requests to improve utilization, with a possible waiting-time tradeoff.
- **NVIDIA NIM** packages optimized inference capabilities behind standard APIs to simplify model deployment. **NGC** provides a catalog of GPU-optimized software, containers and model resources.
Memory, precision and parallelism
- **Quantization** represents weights and sometimes activations with fewer bits. It can reduce memory traffic, storage and energy use, but actual speed and accuracy depend on hardware, kernels and the quantization method.
- **Pruning** removes selected weights or structures; it differs from reducing numerical precision. Evaluate quality after either optimization, and verify that the runtime benefits from the resulting representation.
- In **data parallel training**, devices hold model replicas and process different batches. Gradients are aggregated before synchronized updates; **ring all-reduce** is one distributed aggregation strategy.
- Measure **latency** and **throughput** separately. Track time to first token, generation rate and concurrent-request behavior; larger batches can raise throughput while increasing individual request latency.
Build and iterate applications
- **LangChain** orchestrates components such as prompts, models, retrievers and tools. Orchestration connects application steps; the surrounding application still controls authorization and validates outputs.
- **Docker containers** package code and dependencies for reproducible training or inference environments. GPU workloads also need compatible host drivers and container runtime support.
- **Rapid Application Development (RAD)** emphasizes iterative prototypes and active user feedback. Compare changes against task outcomes, then refine the application and its evaluation set.
Trustworthy and responsible AI
Ground outputs and constrain behavior
- A **hallucination** is a plausible but incorrect or unsupported output. Good grammar and model confidence do not establish truth; check important claims against dependable evidence.
- **RAG grounding** can make answers more verifiable by connecting claims to source passages. Retrieval errors, misleading context and invented citations remain possible; check that the evidence actually supports the claim.
- **NeMo Guardrails** supports configurable conversational rules, topic boundaries and content checks. Input and output guardrails complement model evaluation and application security.
- A lightweight **embedding classifier** can screen inputs before an expensive generation call. Calibrate thresholds and test missed violations and false alarms; a classifier is one layer of a broader safety design.
Privacy, authenticity and protection
- **Privacy** calls for appropriate collection, consent or other authorization, access control and retention. Minimize sensitive data in training, prompts, retrieved context and logs.
- **Confidential computing** protects data in use within hardware-backed trusted execution environments. It complements encryption at rest and in transit; it does not establish model fairness or output correctness.
- **Data lineage and provenance** record origins, transformations and usage. They support authenticity investigations and traceability, while source integrity and claim verification still need checks.
Accountability and ethical use
- **Fairness and nondiscrimination** require examining impacts and errors across relevant groups. Representative evaluation can expose harms hidden by a single overall accuracy score.
- **Transparency and explainability** help people understand a system's purpose, limitations and decisions. Explainability supports informed review but does not by itself establish alignment with societal values.
- **Accountability** assigns human responsibility for outcomes, foreseeable misuse and unintended consequences. Establish oversight, escalation and correction paths throughout the application lifecycle.
- **Legal responsibility** concerns applicable obligations. **Certification** assesses conformity to defined standards or fitness criteria; it is distinct from compliance and does not guarantee that every model response is safe.