Notebooks
N
NVIDIA
Person Sampler Tutorial

Person Sampler Tutorial

gpu-accelerationperson-samplersretrieval-augmented-generationllm-inferencetensorrtnvidia-generative-ai-examplesself-hosted-tutorialslarge-language-modelsmicroservicetriton-inference-servercommunity-contributionsLLMragnemoNeMo-Data-Designer

πŸ§‘β€πŸ€β€πŸ§‘ NeMo Data Designer: Person Sampler Tutorial

πŸ“š What you'll learn

In this notebook, we'll explore how you can generate realistic personal information for your synthetic datasets.


πŸ‘‹ IMPORTANT – Environment Setup

  • If you haven't already, follow the instructions in the README to install the necessary dependencies.

  • You may need to restart your notebook's kernel after setting up the environment.

  • In this notebook, we assume you have a self-hosted instance of Data Designer up and running.

  • For deployment instructions, see the Installation Options section of the NeMo Data Designer documentation.


What is the Person Sampler?

The Person Sampler is a powerful feature in NeMo Data Designer that generates consistent, realistic person records with attributes like:

  • Names (first, middle, last)
  • Contact information (email, phone)
  • Addresses (street, city, state, zip)
  • Demographics (age, gender, ethnicity)
  • IDs (SSN, UUID)
  • And more!

These records are fully synthetic but maintain the statistical properties and formatting patterns of real personal data.

πŸ“¦ Import the essentials

  • The data_designer module of nemo_microservices exposes Data Designer's high-level SDK.

  • The essentials module provides quick access to the most commonly used objects.

[ ]

βš™οΈ Initialize the NeMo Data Designer Client

  • NeMoDataDesignerClient is responsible for submitting generation requests to the microservice.
[ ]

πŸŽ›οΈ Define model configurations

  • Each ModelConfig defines a model that can be used during the generation process.

  • The "model alias" is used to reference the model in the Data Designer config (as we will see below).

  • The "model provider" is the external service that hosts the model (see the model config docs for more details).

  • By default, the microservice uses build.nvidia.com as the model provider.

[ ]

πŸ—οΈ Initialize the Data Designer Config Builder

  • The Data Designer config defines the dataset schema and generation process.

  • The config builder provides an intuitive interface for building this configuration.

  • The list of model configs is provided to the builder at initialization.

[ ]

1. Basic Person Sampling

Let's start with a simple example of generating person data using the default settings.

[ ]

2. Accessing Individual Person Attributes

The person column we created above is a nested object with many attributes. Let's create some columns to access specific attributes from this person object.

[ ]

3. Customizing Person Generators

  • Now let's explore customizing the Person Sampler to generate specific types of profiles.

  • The persona samplers allow you to sample realistic details of individuals using a model trained on the US Census.
    If the locale of the persona you are generating is anything other than en_US, then the personas will be generated using Faker

[ ]

4. Available Person Attributes

The Person Sampler generates a rich set of attributes that you can use. Here's a reference list of some of the key attributes available:

AttributeDescriptionExample
first_namePerson's first name"John"
middle_namePerson's middle name (may be None)"Robert"
last_namePerson's last name"Smith"
sexPerson's sex"Male"
agePerson's age in years42
birth_dateDate of birth"1980-05-15"
email_addressEmail address"john.smith@example.com"
phone_numberPhone number"+1 (555) 123-4567"
street_numberStreet number"123"
street_nameStreet name"Main Street"
unitApartment/unit number"Apt 4B"
cityCity name"Chicago"
stateState/province (locale dependent)"IL"
countyCounty (locale dependent)"Cook"
zipcodePostal/ZIP code"60601"
countryCountry name"United States"
ssnSocial Security Number (US locale)"123-45-6789"
occupationOccupation"Software Engineer"
marital_statusMarital status"Married"
education_levelEducation level"Bachelor's Degree"
ethnic_backgroundEthnic background"Caucasian"
uuidUnique identifier"550e8400-e29b-41d4-a716-446655440000"

5. Creating Multiple Person Samplers with One Method

For convenience, Data Designer provides a with_person_samplers method to create multiple person samplers at once.

[ ]

6. Using Person Data with LLM Generation

One of the most powerful features of Data Designer is combining structured person data with LLM generation to create realistic, contextual content.

[ ]

πŸ†™ Scale up!

  • Happy with your preview data?

  • Use the create method to submit larger Data Designer generation jobs.

[ ]
[ ]
[ ]
[ ]