Introduction
Nucleus Edge is the on-premise component you install to work with your data inside your own environment. This section is a practical guide to installing and using it. Every option is listed in the Reference Manual.

Overview
Nucleus Edge gives you a small set of Python functions:
| Function | Purpose |
|---|---|
anonymize(...) | Anonymize a document, image, or audio file. |
synthesizer(...) | Train a synthesizer on your local data. |
sample(...) | Generate synthetic rows from a trained synthesizer. |
retrain_synthesizer(...) | Continue training an existing synthesizer with new data. |
synthesizer_evaluations(...) | Evaluate synthetic data against real data (single table). |
synthesizer_evaluations_multitable(...) | Evaluate synthetic data against real data (multiple tables). |
The typical synthetic-data flow is: train with synthesizer(...) → obtain a synthesizer file → upload it to the platform → generate data locally with sample(...) or online in the Cloud. You can also anonymize documents, images, and audio directly with anonymize(...). In every case, your raw data never leaves your environment.
Installation
Nucleus Edge is delivered as a Python package and must be installed in a Python 3 environment. Python 3.11 is recommended; 3.9 and 3.10 are also supported.
# Create and activate an isolated environment (recommended)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install the Nucleus package provided by Dedomena
pip install nucleus-4.10.2-DEV.tar.gz
GPU (optional). Training and generation run on CPU by default. To use a GPU, install on a machine with a compatible NVIDIA GPU and pass cuda=True to the functions. Working with free-text columns benefits most from a GPU.
Connecting to IBM Db2 (optional). To read from Db2, download the JDBC driver and place it in the DB2Driver folder inside your Nucleus installation path (see Supported Data Sources).
System and hardware requirements
Software
-
Operating system: Linux (x86-64) is recommended and is required for the GPU-based features. Tabular work (synthetic data and table anonymization) also runs on CPU under Windows and macOS.
-
Python: 3.9–3.11 (3.11 recommended).
-
GPU driver: for any GPU feature, an up-to-date NVIDIA driver supporting CUDA 12.1 or later.
What each task needs
| Task | GPU | Typical resources |
|---|---|---|
| Synthetic data (training & generation) | Optional | Multi-core CPU and 16 GB RAM minimum; 8+ cores and 32 GB RAM recommended. A GPU speeds up large jobs. |
| Table anonymization | Optional | Same as above. |
Free-text handling (coding, text columns, transform_descriptions) | Required to transform text | Without a GPU, free text is left unchanged. |
| Anonymizing documents, images, and audio | Required | See the GPU specification below. |
GPU specification — required for anonymizing documents, images, and audio (and for free-text handling)
These features rely on AI models that run on the GPU. Use an NVIDIA GPU with:
-
Architecture: Ampere or newer — CUDA Compute Capability 8.0 or higher (e.g., NVIDIA A100, L4, L40S, RTX A6000, RTX 6000 Ada, or newer Hopper/Blackwell cards).
-
Video memory (VRAM): 24 GB minimum; 48 GB or more recommended, especially for high-resolution documents and images, where a vision model and a text model run at the same time.
-
CUDA: an NVIDIA driver compatible with CUDA 12.1 or later.
-
System RAM: 32 GB or more.
-
Disk: keep at least 30 GB free for the model files, which are downloaded and cached the first time you use these features (a one-time download).
Pass cuda=True to the Edge functions to run on the GPU.
> If no compatible GPU is available, you can still use Nucleus Edge for synthetic data and table anonymization on CPU. Anonymizing documents, images, and audio — and transforming free text — requires a GPU.
Authentication
Every Edge function requires a token provided by Dedomena. The token authorizes the component and is passed on each call:
from nucleus.synthesizer import synthesizer
TOKEN = "your-dedomena-token"
synthesizer(
token=TOKEN,
data_format="CSV",
data_dir="data/customers.csv",
# ...
)
Keep the token out of source control (use an environment variable or a secrets manager). The same token is used by all Edge functions.
Supported Data Sources
Edge reads data through the data_format and data_dir options. Four input formats are supported:
data_format | data_dir means | Notes |
|---|---|---|
CSV | Path to a .csv file | Delimited text |
PARQUET | Path to a .parquet file | Recommended for large data |
DATABASE | A database connection URL | Use query to select a table or run SQL |
Databases. When data_format="DATABASE", set data_dir to the connection URL and use query to name a table or provide a full SQL query. For IBM Db2, download the JDBC driver, place it in the DB2Driver folder within your Nucleus installation path, and use a URL of the form:
jdbc:db2://\<host\>:\<port\>/\<database_name\>:sslConnection=true;user=\<userid\>;password=\<password\>;
Db2 JDBC drivers: https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads
Output formats (sample): CSV, EXCEL, PARQUET, or DATAFRAME (return the result directly in memory as a pandas DataFrame).
Anonymization
Anonymization and synthetic data are separate operations with different inputs and results, so they are described separately.
With Edge you can anonymize tables and unstructured files (documents, images, and audio) directly on your machine — in every case the output is a new anonymized file, ready to use. You can also protect sensitive columns of a table while you train a synthesizer.
Anonymizing tables
Use anonymize() to anonymize a structured table too. Just like training a synthesizer, you point it at a table (a file or a database connection); the difference is what comes out — training produces a reusable model, while anonymization produces a new file with your data already protected. You pass a configuration that maps each sensitive column to the method to apply; Edge transforms those columns and leaves the rest untouched.
from nucleus.anonymize import anonymize
anonymize(
token=TOKEN,
data_format="CSV",
data_dir="data/customers.csv",
config=\{
"full_name": "simulation", # string column
"email": "mask", # string column
"national_id": "hash", # string column
"salary": "perturb", # numeric column
"birth_date": "generalize", # datetime column
\},
output_filename="customers_anonymized.csv",
output_format="CSV",
)
The configuration works exactly as for files: the key is the column name and the value is the method (short form) or \{"method": ..., "type": ...\} (extended form). The method must be valid for the column’s data type — numeric columns accept perturb, generalize, shuffle, mask, hash; string/categorical columns accept mask, simulation, pseudonym, coding, hash, shuffle; and so on (see Anonymization Methods). Pass config="auto" to apply the default method to every sensitive column detected during analysis. Tables can be read from CSV, PARQUET, or a DATABASE connection, and written back as CSV, EXCEL, or PARQUET.
Anonymizing documents, images, and audio
Use anonymize() to protect an unstructured file. You pass the path to the file and a configuration that says, for each sensitive element, which method to apply. Edge analyzes the file, detects the sensitive elements it contains, and applies the method you chose to every element of that type — leaving the rest of the file untouched. The anonymized file is written to the output path you specify.
from nucleus.anonymize import anonymize
anonymize(
token=TOKEN,
data_dir="documents/id_card.png",
config=\{
"face": "blur", # visual element
"signature": "redact", # visual element
"person_name": "mask", # text element
"id_number": "coding", # text element
"birth_date": "generalize", # text element
\},
output_filename="id_card_anonymized.png",
cuda=True,
)
The configuration dictionary. Each key is the name of a sensitive element and each value is the method to apply to it. Use the short form ("face": "blur") when the method needs no options, or the extended form when you want to pass options — for example, the variable type for simulation:
config=\{
"person_name": \{"method": "simulation", "type": "name"\},
"email": \{"method": "simulation", "type": "email"\},
"id_number": \{"method": "mask"\},
\}
The method you choose must be valid for the element’s channel — visual elements accept blur, pixelate, redact; text elements accept mask, coding, simulation, pseudonym, hash; audio elements accept beep, silence, remove (see Anonymization Methods and Consistent anonymization across related assets). To let Edge anonymize every detected element with its default method, pass config="auto".
Documents (PDF):
anonymize(
token=TOKEN,
data_dir="documents/contract.pdf",
config=\{
"person_name": "pseudonym",
"address": "mask",
"iban": "hash",
\},
output_filename="contract_anonymized.pdf",
)
Audio:
anonymize(
token=TOKEN,
data_dir="calls/support_call.mp3",
config=\{
"person_name": "beep",
"phone_number": "beep",
"address": "silence",
\},
output_filename="support_call_anonymized.mp3",
)
Automatic mode — detect everything and apply the default method for each element:
anonymize(
token=TOKEN,
data_dir="documents/id_card.png",
config="auto",
output_filename="id_card_anonymized.png",
)
Supported inputs:
| Input | Formats |
|---|---|
| Tables | CSV, Parquet, database connection |
| Images | PNG, JPG/JPEG, TIFF, BMP |
| Documents | PDF, DOCX |
| Audio | WAV, MP3 |
Parameters:
| Parameter | Type | Description |
|---|---|---|
token | string | The token provided by Dedomena. |
data_dir | string | Path to the table or file to anonymize — or a database connection URL for tables. |
data_format | string | For tables: CSV, PARQUET, or DATABASE. For documents, images, and audio the type is detected automatically. |
query | string | Optional. Table name or SQL query when data_format="DATABASE". |
config | dict or "auto" | Map of element / column name → method. Each value is either the method name, or \{"method": ..., "type": ...\} for methods that take options. Use "auto" to apply the default method to every detected element. |
output_filename | string | Where to save the anonymized result. |
output_format | string | For tables: CSV, EXCEL, or PARQUET. |
output_dir | string | Optional. Where to save the reversal mapping (for reversible methods). |
cuda | bool | Use a GPU if available. Recommended when using coding, which relies on a language model. |
> Reversibility. Methods that keep a mapping (pseudonym, simulation, mask, generalize) also write a mapping file, so an authorized administrator can reverse them later. The other methods are irreversible. See Anonymization Methods.
Synthetic Data Generation
Generating synthetic data with Edge is a two-step process: train a synthesizer, then generate rows from it.
Step 1 — Train (synthesizer). Produces a synthesizer file in output_dir.
from nucleus.synthesizer import synthesizer
synthesizer(
token=TOKEN,
data_format="CSV",
data_dir="data/transactions.csv",
algorithm="generic",
epochs=200,
batch_size=256,
amplify="quality", # boost fidelity (needs epochs \>= 150)
categorical_columns=["category", "channel"],
integer_columns=["age"],
float_columns=["amount"],
date_columns=\{"txn_date": "%Y-%m-%d"\},
id_columns=\{"customer_id": r"ID_\d\{4\}"\},
target="category",
output_dir="results",
synthesizer_name="tx_v1",
synthesizer_description="Transactions synthesizer, quality mode",
)
Step 2 — Generate (sample). Loads the synthesizer and writes synthetic rows.
from nucleus.sample import sample
sample(
token=TOKEN,
model_dir="results/tx_v1.zip",
n_rows=100_000,
output_filename="synthetic_transactions.parquet",
output_format="PARQUET",
)
Conditional generation. Pass ratios to shape the output (see Synthetic Data in the Cloud Guide and Generation Parameters):
sample(
token=TOKEN,
model_dir="results/tx_v1.zip",
n_rows=50_000,
ratios=\{"gender": \{"F": 1, "M": 0\}, "is_fraud": \{"1": 1, "0": 0\}\}, # Female AND fraud only
output_format="DATAFRAME",
)
Uploading Synthesizers
The synthesizer file produced by synthesizer() (and retrain_synthesizer()) is what you send to the platform. Because it contains everything needed to generate data — and is protected — it can be transferred and stored safely.
-
Train locally with
synthesizer(...); note the file written tooutput_dir. -
Upload the file to the platform (through the web app or the API).
-
Once uploaded, the synthesizer is available for generating synthetic data via the web app and the API — and no raw data ever left your environment.
-
To keep a synthesizer current as your source data changes, retrain it (below) and upload the new file.
Retraining (retrain_synthesizer) continues training an existing synthesizer with new data. The forgetfulness_factor controls how much of the previous training is kept (0 = keep everything, 1 = start over):
from nucleus.retrain_synthesizer import retrain_synthesizer
retrain_synthesizer(
token=TOKEN,
model_dir="results/tx_v1.zip",
data_dir="data/transactions_new_month.csv",
data_format="CSV",
epochs=250,
forgetfulness_factor=0.0, # keep everything learned so far
output_dir="results",
)
Evaluation
Training already runs the automatic evaluation and includes the report with the synthesizer. Edge also lets you evaluate any pair of real and synthetic datasets on demand and produce the report yourself.
Single table (synthesizer_evaluations):
from nucleus.evaluations import synthesizer_evaluations
privacy, quality, utility = synthesizer_evaluations(
token=TOKEN,
real_data="data/real.parquet",
synthetic_data="data/synth.parquet",
data_format_real="PARQUET",
data_format_synth="PARQUET",
categorical_columns=["city", "category"],
integer_columns=["age"],
float_columns=["amount"],
date_columns=["txn_date"],
target="category",
output_dir="report", # writes report/report.html
synthesizer_name="tx_v1",
verbose=True,
)
print(privacy, quality, utility)
The function returns the three scores and writes an HTML report to output_dir. A table with fewer than three usable columns is skipped.
Multiple tables (synthesizer_evaluations_multitable) takes a per-table configuration and produces a single combined report; see Evaluation Parameters.
Python Examples
A. Transactional synthesizer with description anonymization
from nucleus.synthesizer import synthesizer
from nucleus.sample import sample
TOKEN = "your-dedomena-token"
synthesizer(
token=TOKEN,
data_format="PARQUET",
data_dir="data/bank_tx.parquet",
algorithm="transactional",
epochs=250,
batch_size=256,
columns_mapping=\{
"user_id": "client_id",
"concept": "description",
"amount": "amount_eur",
"txn_date": "date",
"balance": "balance_eur",
\},
balance_updated=True,
transform_descriptions="level2", # anonymize names/addresses/cities in text
date_columns=\{"date": "%Y-%m-%d"\},
float_columns=["amount_eur", "balance_eur"],
categorical_columns=["category"],
datasets_country="Spain",
output_dir="results",
synthesizer_name="bank_tx_v1",
)
sample(token=TOKEN, model_dir="results/bank_tx_v1.zip",
n_rows=200_000, output_filename="synth_bank_tx.parquet")
B. Time-series synthesizer
from nucleus.synthesizer import synthesizer
synthesizer(
token=TOKEN,
data_format="CSV",
data_dir="data/sensor_series.csv",
algorithm="timeseries",
epochs=300,
time_step="D", # one observation per day
series_length=365, # 365 daily steps per series
static_columns=["device_type", "region"],
float_columns=["temperature", "humidity"],
date_columns=["timestamp"],
columns_mapping=\{"user_id": "device_id", "txn_date": "timestamp"\},
output_dir="results",
synthesizer_name="sensors_v1",
)
C. Relational (multi-table) synthesizer
from nucleus.synthesizer import synthesizer
datasets_config = \{
"customers": \{
"data_dir": "data/customers.csv", "data_format": "CSV",
"algorithm": "generic",
"categorical_columns": ["segment"], "integer_columns": ["age"],
"primary_key": "customer_id", "foreign_key": \{\},
"sensitive": \{"name": "name"\},
\},
"orders": \{
"data_dir": "data/orders.parquet", "data_format": "PARQUET",
"algorithm": "transactional",
"columns_mapping": \{"user_id": "customer_id", "txn_date": "order_date",
"concept": "item", "amount": "total"\},
"date_columns": ["order_date"], "float_columns": ["total"],
"primary_key": "order_id", "foreign_key": \{"customer_id": "customers"\},
\},
\}
synthesizer(
token=TOKEN, algorithm="relational",
datasets_config=datasets_config,
epochs=200, datasets_country="Spain",
output_dir="results", synthesizer_name="shop_v1",
)
D. Generate to an in-memory DataFrame
from nucleus.sample import sample
df = sample(token=TOKEN, model_dir="results/shop_v1.zip",
n_rows=10_000, output_format="DATAFRAME")
print(df.head())
Reference Manual
This manual lists the options available in Nucleus Edge, grouped by purpose. The same options are available when you train and generate in the Cloud.
Common Parameters
Options shared by synthesizer(), sample(), retrain_synthesizer(), anonymize(), and the evaluation functions.
| Parameter | Type | Description |
|---|---|---|
token | string | The token provided by Dedomena to enable Nucleus Edge. Required by every function. |
data_format | string | Input format: CSV, PARQUET, MTX, or DATABASE. |
data_dir | string | Path to the dataset file, or — when data_format="DATABASE" — the database connection URL. |
query | string | Optional. SQL query, or the name of the table to retrieve, when reading from a database. |
algorithm | string | generic, transactional, timeseries, or relational. |
output_dir | string | Where the synthesizer file (or the report) is saved. |
cuda | bool | True to use a GPU (must be available); otherwise CPU. |
synthesizer_name | string | A name for the synthesizer. |
synthesizer_description | string | A description for the synthesizer. |
Generic Parameters
Core training options for generic (and shared by transactional and timeseries where they apply).
| Parameter | Type | Description |
|---|---|---|
epochs | int | Number of training passes. 150–300 recommended for generic/transactional. |
batch_size | int (power of 2) | Batch size (128, 256, 512, …). |
amplify | string | default (favour privacy) or quality (favour fidelity; requires epochs \>= 150). Generic/transactional only. |
impute | bool | Fill in missing values. Recommended True. |
categorical_columns | array | Category (discrete) column names. |
integer_columns | array | Integer column names. |
float_columns | array | Decimal-number column names. |
boolean_columns | array | True/false column names. |
date_columns | array or dict | Date columns. As a dict you can set the format per column, e.g. \{"date1": "%Y-%m-%d"\}. |
id_columns | dict | \{column: pattern\} to generate identifiers from a pattern; None generates sequential IDs [0, 1, 2, …]. E.g. \{"c1": r"ID_\d\{4\}", "c2": None\}. |
coordinate_columns | array of dicts | Latitude/longitude pairs, e.g. [\{"latitude": "lat1", "longitude": "lon1"\}], to generate realistic coordinates. |
text_columns | dict | \{column: instruction\} for free-text columns. An empty instruction "" replaces personal data with new values by default. |
sensitive | dict | \{column: type\}. Declares sensitive columns and their type, so they are protected and generated realistically. |
target | string | The column you most want to predict, used for the utility score. If None, one is chosen for you. |
max_categories | int | Maximum number of values a category column may keep; rarer values are grouped into others. |
min_freq_categories | int | Minimum count for a category to be kept on its own; the rest are grouped together. |
num_cat | int | Only with amplify="default". Number of the most frequent numeric values to treat as categories (improves common prices, amounts, zeros, etc.). |
constraints | list of strings | Rules that must always hold between columns (see below). |
transform_descriptions | string | None, level1, level2, level3 — how deeply to anonymize free-text descriptions (see Transactional Parameters). |
datasets_country | string | Country the data comes from; makes generated values (names, addresses, coordinates) realistic. Default Spain. |
drop_primary | bool | Leave the primary-key column out of the model. |
Constraint syntax (constraints):
| Form | Meaning |
|---|---|
col1\<-\>col2\<-\>col3 | Fixed combinations across the listed columns (e.g., description ↔︎ subcategory ↔︎ category). |
col1\<=col2 | Every value in col1 ≤ the value in col2. |
col1\<col2\<col3 | Ordering across three columns. |
col1\ />10 / col1\>0 | Lower-bound rules. |
col1//1000 | Every value in col1 must be a multiple of 1000. |
Transactional Parameters
Extra options for algorithm="transactional".
| Parameter | Type | Description |
|---|---|---|
columns_mapping | dict | Maps meaning to your column names. Keys: user_id, cat_id, concept, txn_date, amount, balance. Unspecified keys are looked up by default name. |
balance_updated | bool | Whether the balance already includes the current amount. True: balance[i] = balance[i-1] + amount[i]. False: balance[i] = balance[i-1] + amount[i-1]. Negative amount = expense, positive = income. |
tresh_patterns | float | Sensitivity for detecting patterns in descriptions (default 0.01). |
transform_descriptions | string | How deeply to anonymize the description column: |
transform_descriptions levels:
-
None— descriptions are kept as they are. -
level1— replaces dates, card numbers, account numbers (IBANs), and amounts in the text. -
level2— everything inlevel1, plus names of people, addresses, and cities. -
level3— everything inlevel2, plus merchant names, replaced with plausible alternatives from a similar industry (e.g., McDonald’s → Burger King; Iberia → Air Europa).
Time Series Parameters
Extra options for algorithm="timeseries".
| Parameter | Type | Description |
|---|---|---|
time_step | string | The spacing between consecutive timestamps (D daily, H hourly, MS monthly, …). Default MS. There must be exactly one observation per step. |
series_length | int | How many steps each series contains. E.g., with time_step="MS", use a multiple of 12. Series need not all be complete. |
static_columns | array | Columns that stay the same over time for each subject (e.g., demographics). |
columns_mapping | dict | Maps the subject and time columns (user_id, txn_date) to your column names. |
Relational Parameters
For algorithm="relational", describe your tables with datasets_config: a dictionary with one entry per table.
| Per-table key | Description |
|---|---|
data_dir, data_format | Path and format for that table. |
algorithm | Algorithm for that table (generic, transactional, …). |
primary_key | The table’s primary-key column. |
foreign_key | \{column: target_table\} linking a column to the table it references. |
categorical_columns, date_columns, integer_columns, boolean_columns, float_columns | Column types for that table. |
columns_mapping | Meaning-to-name mapping (for transactional tables). |
sensitive | \{column: type\} for that table. |
transform_descriptions, target, constraints, impute | As in the generic/transactional algorithms, for that table. |
NUCLEUS keeps the links between tables consistent so keys still match in the synthetic result. Relational training needs 150 or more training passes.
Generation Parameters
Options for sample() and retrain_synthesizer().
sample()
| Parameter | Type | Description |
|---|---|---|
model_dir | string | Path to the synthesizer file. |
n_rows | int | Number of rows to generate. |
ratios | dict | Conditional generation. \{column: \{label: proportion\}\}. Proportions apply jointly across columns. |
output_filename | string | Where to save the generated file. |
output_format | string | CSV, EXCEL, PARQUET, or DATAFRAME (return in memory). |
replicate_outliers | bool | Whether to reproduce the outliers seen during training. |
cuda | bool | Use a GPU if available. |
retrain_synthesizer() (in addition to the common parameters)
| Parameter | Type | Description |
|---|---|---|
model_dir | string | Path to the existing synthesizer file. |
epochs | int | Retraining passes. 200–350 recommended. |
forgetfulness_factor | float [0,1] | How much previous training to forget. 0 (default) = keep everything; 1 = start over. |
target | string | Optionally set a new target for evaluation. |
Evaluation Parameters
synthesizer_evaluations() (single table)
| Parameter | Type | Description |
|---|---|---|
real_data | string or DataFrame | Real dataset (path or in memory). |
synthetic_data | string or DataFrame | Synthetic dataset (path or in memory). |
data_format_real, data_format_synth | string | Formats of the real / synthetic inputs. |
query_real, query_synthetic | string | Optional queries when reading from a database. |
categorical_columns, date_columns, integer_columns, boolean_columns, float_columns | arrays | Column types (evaluation needs at least 3 usable columns). |
target | string | The column for the utility score. Ignored if it is not in the data. |
columns_mapping | dict | Optional column-name mapping. |
synthesizer_name | string | Name shown in the report. |
output_dir | string | Where to write the report. |
verbose | bool | Print the scores and show the charts. |
Returns the three scores: (privacy, quality, utility).
synthesizer_evaluations_multitable() takes a configuration with one entry per table (each with its real and synthetic data, column types, optional sensitive columns, and target) and produces a single combined report with overall scores.
Anonymization Parameters
Options for anonymize(), which anonymizes a table, document, image, or audio file. The output is a new anonymized file (not a model). See Anonymization in the Nucleus Edge section for examples.
| Parameter | Type | Description |
|---|---|---|
token | string | The token provided by Dedomena to enable Nucleus Edge. |
data_dir | string | Path to the table or file to anonymize — or a database connection URL for tables. |
data_format | string | For tables: CSV, PARQUET, or DATABASE. For documents, images, and audio the type is detected automatically. |
query | string | Optional. Table name or SQL query when data_format="DATABASE". |
config | dict or "auto" | Map of element / column name → method. Each value is either the method name (e.g. "mask") or \{"method": ..., "type": ...\} for methods that take options (e.g. simulation). Use "auto" to apply the default method to every element detected during analysis. The method must be valid for the element’s data type or channel (see Anonymization Methods and Consistent anonymization across related assets). |
output_filename | string | Where to save the anonymized result. |
output_format | string | For tables: CSV, EXCEL, or PARQUET. |
output_dir | string | Optional. Where to save the reversal mapping produced by reversible methods (pseudonym, simulation, mask, generalize). |
Supported inputs: tables (CSV, Parquet, database connection), images (PNG, JPG/JPEG, TIFF, BMP), documents (PDF, DOCX), and audio (WAV, MP3, M4A, FLAC).