4.2 Best practices and software quality

NCA-GENM · Software Development (15% of the exam) · Official objective: “Ensure adherence to best practices and maintain high standards of software quality and reliability.”

Import guarding, readiness checks, guardrails and dataset licence checks.

Key points

  1. Import guarding lets code run with or without an optional dependency. safe_import returns the module (or a placeholder) and a boolean saying whether it loaded.

    What NVIDIA says (1)

    “In either of these cases, it’s important to guard the optional imports.”

    — NeMo Framework 24.09: Best Practices

  2. A quality check confirms a service is really working before use. Triton prints a status for each model and a reason if loading failed.

    What NVIDIA says (1)

    “All the models should show “READY” status to indicate that they loaded correctly.”

    — Quickstart — NVIDIA Triton Inference Server

  3. A guardrail is a rule that checks what goes into or comes out of a model. NeMo Guardrails is an open-source Python package for this. DALI means the NVIDIA Data Loading Library. LLM means large language model.

    What NVIDIA says (1)

    “Use it to block, alter, or validate unsafe, off-topic, malicious, or policy-violating user inputs and model responses.”

    — Overview | NVIDIA NeMo Guardrails Library Developer Guide

  4. Good practice includes checking legal and content fitness of data, not just code quality.

    What NVIDIA says (1)

    “It is the responsibility of each user to check the content of the dataset, review the applicable licenses, and determine if it is suitable for their intended use.”

    — NeMo Framework 24.09: Text to Image Datasets

Key terms

Sample question

Your NeMo code should use an optional package only if it is installed. Which NeMo best practice applies?

Show the answer

Answer: Guard the import with safe_import and check the returned flag

Import guarding lets code run with or without an optional dependency. safe_import returns the module (or a placeholder) and a boolean saying whether it loaded.

What NVIDIA says (1)

“In either of these cases, it’s important to guard the optional imports.”

— NeMo Framework 24.09: Best Practices

Practice 4.2 (4 questions) Full Software Development guide

← 4.1 Working with clients on requirements · 4.3 Prompting generative models →