> This page is for Kumo Engine.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/sdgm/llms.txt.

# Model Plan Guide

> Customize Kumo Engine training, model architecture, sampling, and column encoders.

Use a model plan to control how Kumo Engine searches for and trains a model.
Start with a suggested plan, change the settings you need, and pass the plan to `Trainer`.
This guide covers the public model controls shared by local Python, Snowflake notebooks, and Databricks notebooks.
Refer to [Encoder Selection](/sdgm/kumo-engine/user-code-guide/set-up-a-graph/encoder-selection).
Apply your encoder overrides in this plan's [Column Processing](#column-processing) section before training.

## Create and Use a Plan

Start with the `query` from [Predictive Queries](/sdgm/kumo-engine/user-code-guide/train-a-model/predictive-queries) and the `snapshot` and `training_table` described in [Generate or Supply Training Tables](/sdgm/kumo-engine/user-code-guide/train-a-model/training-tables):

```python
from kumo.engine import Trainer
from kumoapi.model_plan import RunMode

plan = query.suggest_model_plan(snapshot, run_mode=RunMode.FAST)
print(plan.as_json())

trainer = Trainer(plan)
fit_result = trainer.fit(training_table, snapshot=snapshot)
print(fit_result.metrics)
```

Suggestion uses graph and query metadata and does not start training.
Choose `RunMode.FAST`, `RunMode.NORMAL`, or `RunMode.BEST` for progressively larger search budgets.
`RunMode.DEBUG` is for diagnostic runs, not model quality evaluation.
For a supplied training table with sample weights, pass its `TrainingTableSpec` as `train_table_spec=` to the suggestion call.

Keep suggested values for the first run. Change a setting when its behavior matches a specific requirement.
Compare validation results on the same data and splits when evaluating a change. Reserve holdout data for the final assessment.
Refer to [Training Diagnostics](/sdgm/kumo-engine/user-code-guide/train-a-model/training-diagnostics).

### Read Values and Search Spaces

The plan is a `kumoapi.model_plan.ModelPlan` with five sections:

| Section              | Purpose                                                  |
| -------------------- | -------------------------------------------------------- |
| `training_job`       | Experiment count, evaluation, trial pruning, and refits. |
| `column_processing`  | Column encoders and missing values.                      |
| `neighbor_sampling`  | Graph neighborhood sampling.                             |
| `optimization`       | Training budget, losses, optimizers, and batch sizes.    |
| `model_architecture` | Message passing, prediction heads, and embeddings.       |

Most tunable settings take a **nonempty list of candidates**.
For example, `base_lr=[0.001, 0.003]` offers two learning rates, while `base_lr=[0.001]` fixes that choice.
`num_experiments` limits the trials. Kumo does not necessarily exhaust every combination.
Nested lists group one candidate: `num_neighbors=[[20, 10]]` means one two-hop sampling configuration.

Scalar settings such as `max_epochs` and `num_experiments` take a single value.
`None` is an explicit option only where the tables below allow it. It does not universally mean “infer a default.”
Unspecified settings are filled from the task, graph, and run mode.
Inspect `plan.as_json()` instead of assuming the same suggested values for every dataset.
The bounds below describe valid configuration values, not recommended capacity settings.

## How Settings Affect Model Quality

Most settings trade model quality against training time and memory, and the best value depends on your data.
The patterns in this guide describe typical effects, not guarantees. Confirm each change on validation metrics.
Most sections below include a collapsed table that shows what changing their settings usually does.

Before tuning, check the labels, the evaluation, and whether the graph and encoders give the model the information it needs.
Refer to [Check the Evaluation Before Tuning](/sdgm/kumo-engine/user-code-guide/train-a-model/training-diagnostics#check-the-evaluation-before-tuning).
A missing relationship or a poorly encoded column usually costs more than any setting below can recover.
When the suggested plan still underperforms, these settings usually matter most, in roughly this order:

| Order | Settings                                                            | Why they matter                                                                                                                                                                                       |
| ----- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1     | `num_neighbors`                                                     | Hops and fanouts decide which rows the model can see. For the GNN, the number of hops also sets the number of message passing layers. A signal outside the sampled subgraph cannot be learned at all. |
| 2     | `num_experiments`, `max_epochs`                                     | The search and training budget. Too small a budget leaves the model undertrained or the search space unexplored.                                                                                      |
| 3     | `base_lr`, `channels`, `batch_size`                                 | Optimization stability and model capacity. The learning rate is usually the most sensitive optimization setting.                                                                                      |
| 4     | `loss`, `tune_metric`, class balancing                              | What the model optimizes and how it is selected. Align them with the metric you report.                                                                                                               |
| 5     | `dropout`, `weight_decay`, `aggregation`, normalization, MLP layers | Regularization and architecture details. These usually produce smaller changes than the settings above.                                                                                               |

Before raising capacity or sampling, read the learning curves to tell overfitting from undertraining.
Refer to [Interpret the Curves](/sdgm/kumo-engine/user-code-guide/train-a-model/training-diagnostics#interpret-the-curves).
To estimate the noise level of a comparison, fix every candidate list to one value and repeat the run with different `manual_seed` values. Treat differences smaller than that spread as ties.

## Training Job Plan

Set these fields on `plan.training_job`.
Keep the suggested search budget unless you need to cap trials. Choose `tune_metric` for the outcome you want to select on.
Disable refits when you only need trial results. Use `refit_full` only with separate unseen evaluation data.

<details>
  <summary>
    Training job parameters and pruning
  </summary>

  | Parameter         | Supported values                         | Meaning                                                                                                                                          |
  | ----------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
  | `num_experiments` | Positive integer                         | Maximum number of AutoML experiments. Suggested budget depends on run mode.                                                                      |
  | `manual_seed`     | Integer or `None`; default `None`        | Seed model training and the trial search to help repeat an experiment.                                                                           |
  | `metrics`         | List of metric names valid for the task  | Metrics computed during evaluation. Refer to [Choose Metrics](#choose-metrics).                                                                  |
  | `tune_metric`     | One metric name                          | Metric used to compare experiments and select a model. Include it in `metrics`. `"loss"` is also available for tasks other than link prediction. |
  | `pruning`         | `PruningConfig` or `None`                | Stop unpromising trials using previous trials as a reference. `None` disables trial pruning.                                                     |
  | `refit_trainval`  | `True` or `False`; suggested by run mode | Refit the selected configuration on training plus validation rows.                                                                               |
  | `refit_full`      | `True` or `False`; default `False`       | Also refit on training, validation, and test rows. Reserve separate unseen data to evaluate this model.                                          |

  `PruningConfig` takes `min_epochs` (integer at least 1), `k` (integer at least 1), `min_delta` (number at least 0), and `patience` (positive integer).
  It compares the trial with the best `k` previous trials after `min_epochs`, using the improvement threshold and patience to decide when to stop it.
  Trial pruning differs from early stopping, which monitors one trial's own validation progress.
</details>

<details>
  <summary>
    How changing training job settings affects results
  </summary>

  | Change                      | Typical effect on quality                                                                                                                                                                                                                        | Cost and risks                                                                                                                           |
  | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
  | Raise `num_experiments`     | Explores more of the search space, so the selected model is more likely to be near the best configuration in it. Gains shrink after the main combinations have been tried.                                                                       | Runtime grows roughly in proportion to the number of experiments. A search space with few combinations gains little from a large budget. |
  | Change `tune_metric`        | Changes which trial is selected, and within each trial which epoch is kept and when early stopping and pruning act. Selecting on the metric you report avoids picking a model that is better on a proxy, such as loss, but worse on that metric. | A noisy metric, such as one computed on few positive rows, makes those decisions less reliable.                                          |
  | Enable or tighten `pruning` | No direct quality gain. It frees budget by ending weak trials early.                                                                                                                                                                             | A small `min_epochs` or `patience` can stop trials that start slowly but would finish best, such as trials with a low learning rate.     |
  | Enable `refit_trainval`     | Usually improves the final model slightly, because it trains on more rows. For temporal queries, the added validation rows are also the most recent ones before the test period.                                                                 | Adds a training run. Validation scores no longer measure unseen data for the refit model.                                                |
  | Enable `refit_full`         | Can help further when recent data matters, because it also trains on the test rows.                                                                                                                                                              | Test metrics no longer measure unseen data. Evaluate on data held out separately.                                                        |
  | Change `manual_seed`        | No systematic effect. Score differences between seeds show run to run noise.                                                                                                                                                                     | None.                                                                                                                                    |
</details>

### Choose Metrics

Use metric names for the query's task.
Common choices are:

| Task                                   | Metric choices                                                                                                       |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| Binary classification                  | `"auroc"`, `"ap"`, `"auprc"`, `"acc"`, `"f1"`, `"precision"`, `"recall"`.                                            |
| Multiclass classification              | `"acc"`, `"f1"`, `"precision"`, `"recall"`.                                                                          |
| Multilabel classification              | `"ap_macro"`, `"ap_micro"`, `"auroc_macro"`, `"auroc_micro"`, `"auprc_macro"`, `"auprc_micro"`.                      |
| Regression and forecasting             | `"mae"`, `"mse"`, `"rmse"`, `"mape"`, `"smape"`.                                                                     |
| Link prediction and multilabel ranking | `"map@10"`, `"precision@10"`, `"recall@10"`, `"ndcg@10"`, `"mrr@10"`. Replace `10` with the desired positive cutoff. |

The following example selects metrics for a regression query:

```python
plan.training_job.metrics = ["mae", "mse", "rmse"]
plan.training_job.tune_metric = "mae"
```

These fields select built-in metrics, not Python callbacks.
To evaluate a custom metric, score held-out predictions against separately retained ground truth.

## Column Processing

Use the following `plan.column_processing` fields to override column encoders or set missing-value defaults:

| Parameter           | Supported values                                          | Meaning                                                                                                |
| ------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `encoder_overrides` | Dictionary from `"table.column"` to an encoder, or `None` | Replace the inferred encoder for specific columns. Names are case sensitive and use graph table names. |
| `na_strategy`       | Dictionary from `Stype` to `NAStrategy`, or `None`        | Set missing-value defaults by semantic type for compatible inferred feature encoders.                  |

Both fields default to `None`.
An encoder decides what information about a column reaches the model, so an override can matter more than any architecture setting.
For example, `Hash` bounds memory for a high-cardinality column but merges unrelated values that collide, while `Index` keeps values distinct but learns nothing about a category unseen during training.
Encoding a numerical column as categorical discards order, and `Null` removes the column's signal entirely.
Filling missing values with a constant, as the `"mean"` and `"zero"` strategies do, blurs the difference between "missing" and a real value. When missingness itself is informative, use `"separate"` to keep it as its own signal.
Refer to [Missing Values](/sdgm/kumo-engine/user-code-guide/set-up-a-graph/encoder-selection#missing-values) and [Encoder Selection](/sdgm/kumo-engine/user-code-guide/set-up-a-graph/encoder-selection).

## Neighbor Sampling

Set these fields on `plan.neighbor_sampling`.
Keep suggested fanouts unless a relationship needs a different context limit. Larger neighborhoods usually require more memory and time.

| Parameter                  | Supported values                                                  | Meaning                                                                                                       |
| -------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `num_neighbors`            | List of per-hop integer lists, or `NumNeighborsConfig` candidates | Up to six hops per candidate. Each count is `-1` (all neighbors), `0` (none), or 1 to 128.                    |
| `sample_from_entity_table` | `True` or `False`                                                 | Include the entity table when sampling. Applies to static node prediction tasks.                              |
| `adaptive_sampling`        | `True` or `False`; default `False`                                | Requires nonnegative counts. In Kumo Engine 1.0.0 and 1.0.1, the sampler applies the same fanouts either way. |

The following example sets one candidate with at most 20 neighbors at the first hop and 10 at the second:

```python
plan.neighbor_sampling.num_neighbors = [[20, 10]]
```

A count caps the neighbors drawn for each sampled node and relationship at that hop, separately in each direction.
For a temporal task, Kumo takes the most recent neighbors at or before the anchor by default.
Multiplying the counts hop by hop, and adding across hops and relationships, gives the most neighbors the sampler can draw.
The subgraph usually holds fewer nodes: a node with fewer eligible neighbors contributes fewer, and a neighbor already in the subgraph adds an edge but no new node.

![Seed customer v at anchor t has six orders at or before t and one order three days after t, which is never eligible. In panel a, with a count of 3 at hop 1 and 2 at hop 2, hop 1 takes the three most recent orders. At hop 2, each of those orders can take two line items and two neighbors back toward the customer table. The only such neighbor is v itself, so each order adds an edge back to v but no node. The bound is 3 + 3 times 2 + 3 times 2 = 15 neighbor slots, while the subgraph has 1 seed + 3 orders + 5 line items = 9 nodes: 8 slots bring a new node, 3 reach v again, and 4 stay empty. In panel b, with hop 1 default 6, hop 2 default 2, and the order to customer direction set to 0 at hop 2, hop 1 takes all six orders and hop 2 takes ten line items and nothing back toward v. The bound is 6 + 6 times 2 + 6 times 0 = 18 slots, and the subgraph has 1 + 6 + 10 = 17 nodes, with 2 slots empty.](/sdgm/_fern-files/nvidia-sdgm.docs.buildwithfern.com/f2376a00bf6cadd98ecd55a92bfa6d5866f1c4e5e877de094ddd7b41881d41b9/_dot_dot_/images/diagrams/neighbor-sampling-fanouts.svg)

*The same customer under two fanout settings. The counts bound the neighbor slots. The subgraph holds fewer unique nodes because the seed counts once, some nodes have fewer neighbors than the cap, and an edge back to the seed adds no node. Setting a direction to `0` stops the walk back to the seed without affecting the other relationships at that hop.*

<details>
  <summary>
    How changing neighbor sampling affects results
  </summary>

  | Change                          | Typical effect on quality                                                                                                                                                                                                                                                                        | Cost and risks                                                                                                                                                                                                   |
  | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Add a hop                       | Lets the model use rows one relationship further away. For example, customer to orders to products is two hops, and other customers who bought those products are three. For the GNN, it also adds a message passing layer. Gains are often largest from one to two hops and shrink after three. | The sampled subgraph grows roughly by the product of the fanouts, so memory and time can rise sharply. Reduce `batch_size` when sampling deeper. Distant, weakly related rows can add noise.                     |
  | Remove a hop                    | Speeds training and can reduce noise when distant rows carry little signal.                                                                                                                                                                                                                      | The model can no longer learn patterns that depend on the removed rows.                                                                                                                                          |
  | Raise a fanout                  | Gives a fuller view of nodes with many neighbors, such as customers with long histories. Aggregates over the relationship become less noisy, and sums and counts over it are less likely to be understated.                                                                                      | Memory and time grow with the fanout, especially at later hops. Gains shrink after the fanout exceeds most nodes' neighbor counts.                                                                               |
  | Lower a fanout                  | Speeds training and can reduce overfitting to noisy, high-volume relationships.                                                                                                                                                                                                                  | Nodes with more neighbors than the fanout are represented by a sample. For temporal tasks, that sample is their most recent neighbors, so the model loses older history.                                         |
  | Raise one relationship's fanout | Focuses the sampling budget on the relationship that carries the signal, such as the entity to target table connection for a count or sum query.                                                                                                                                                 | Costs less than raising the hop's `default`, but the same memory limits apply. Suggested plans often set the entity to target connection to `"inferred"`. An integer override replaces that data-based estimate. |
  | Set a relationship to `0`       | Removes a relationship that adds noise or cost, such as the reverse edge from a popular item back to its many transactions.                                                                                                                                                                      | The model loses any signal on that relationship at that hop.                                                                                                                                                     |
  | Use `-1` (all neighbors)        | Gives the model complete neighborhoods.                                                                                                                                                                                                                                                          | Unbounded. A few high-degree nodes can exhaust memory or dominate runtime.                                                                                                                                       |
  | Enable `adaptive_sampling`      | In Kumo Engine 1.0.0 and 1.0.1, none: the sampler applies the nominal fanouts either way.                                                                                                                                                                                                        | Requires nonnegative counts, so it cannot be combined with `-1`.                                                                                                                                                 |
</details>

### Override a Relationship's Fanout

Use `NumNeighborsConfig` when different relationships need different amounts of context.

<details>
  <summary>
    Configure fanouts by relationship and adaptive sampling
  </summary>

  The following example uses the `SalesOrderHeader.CustomerID` relationship to `Customer.CustomerID` in [Create a Graph](/sdgm/kumo-engine/user-code-guide/set-up-a-graph/graphs#create-a-graph):

  ```python
  from kumoapi.model_plan import HopConfig, NumNeighborsConfig

  hop1 = HopConfig(default=20)
  hop1["Customer.CustomerID->SalesOrderHeader.CustomerID"] = 40
  hop1["SalesOrderHeader.CustomerID->Customer.CustomerID"] = 1
  plan.neighbor_sampling.num_neighbors = [
      NumNeighborsConfig(hop1=hop1, hop2=HopConfig(default=10)),
  ]
  plan.neighbor_sampling.adaptive_sampling = False
  ```

  Use graph table names, including aliases, and the actual primary-key and foreign-key columns.
  The two directions have separate overrides. Unlisted relationships use that hop's `default`. At `hop2`, both directions above use `10`.
  Each `default` accepts integers from `-1` to 128. A named edge accepts integers from `-1` to 512.
  `0` samples none and `-1` requests all neighbors, which can exhaust memory on a large relationship.
  Define consecutive hops beginning with `hop1`, up to six hops. An unknown relationship or a gap in hop numbers is invalid. Correct the graph names or configuration before fitting.

  Some suggested plans use `"inferred"` for a target-to-entity connection in `hop1`.
  This is a task-specific fanout estimated from the data, not a general substitute for an integer on any edge.
  It is invalid on other connections or later hops. Use explicit integer overrides when setting your own edge counts.

  With `plan.neighbor_sampling.adaptive_sampling = True`, all counts must be nonnegative: `-1` is incompatible with it.
  Plan validation then drops its warning about plans with more than three hops and can instead warn when the estimated subgraph is large.
  In Kumo Engine 1.0.0 and 1.0.1, the sampler still applies the nominal fanouts.
  Inspect memory use and runtime before increasing the graph context.
</details>

## Optimization

Set these fields on `plan.optimization`.
Retain suggested losses and optimizer settings unless your task requires a different objective or a bounded comparison.
Cap epochs or steps to limit work. A shorter run is not evidence of equivalent model quality.

<details>
  <summary>
    Optimization parameters and learning-rate search example
  </summary>

  | Parameter                 | Supported values                                            | Meaning                                                                                                                                                                                                                                     |
  | ------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `max_epochs`              | Positive integer                                            | Maximum epochs per experiment.                                                                                                                                                                                                              |
  | `min_steps_per_epoch`     | Integer 1 to 4000                                           | Minimum training batches per epoch.                                                                                                                                                                                                         |
  | `max_steps_per_epoch`     | Positive integer                                            | Maximum training batches per epoch. Keep it at least as large as `min_steps_per_epoch`.                                                                                                                                                     |
  | `max_val_steps`           | Integer 1 to 8000                                           | Maximum batches in a validation pass.                                                                                                                                                                                                       |
  | `max_test_steps`          | Integer 1 to 8000                                           | Maximum batches in a test pass.                                                                                                                                                                                                             |
  | `loss`                    | List of loss names or loss configurations                   | Training objective. Must match the task. Refer to [Loss Functions](#loss-functions).                                                                                                                                                        |
  | `optimizer`               | List containing `"Adam"`, `"AdamW"`, or `"Adagrad"`         | Optimizer candidates.                                                                                                                                                                                                                       |
  | `base_lr`                 | List of numbers greater than 0                              | Initial learning rates.                                                                                                                                                                                                                     |
  | `weight_decay`            | List of numbers at least 0                                  | Weight regularization coefficients.                                                                                                                                                                                                         |
  | `batch_size`              | List of integers 1 to 2048                                  | Training examples per batch.                                                                                                                                                                                                                |
  | `early_stopping`          | List containing `EarlyStoppingConfig` instances or `None`   | Stop a trial when validation improvement stalls. `[None]` disables it.                                                                                                                                                                      |
  | `lr_scheduler`            | List containing `LRSchedulerConfig` instances or `None`     | Learning rate schedules. `[None]` disables scheduling.                                                                                                                                                                                      |
  | `majority_sampling_ratio` | List containing positive numbers or `None`                  | Majority-class sampling ratios for binary classification. `[None]` disables class rebalancing. A numeric candidate requires every `weight_mode` candidate to be non-`None`.                                                                 |
  | `weight_mode`             | List containing `"sample"`, `"weighted_loss"`, or `None`    | Sample rows according to weights, weight their loss, or ignore weights during training. Supported for binary classification or weighted training tables, except forecasting. Weighted link prediction supports `"weighted_loss"` or `None`. |
  | `lookup_optimization`     | List containing `OptimizerConfig` instances or `"inferred"` | Optimizer and learning rate for link prediction lookup embeddings. `OptimizerConfig` takes `optimizer` and positive `base_lr`.                                                                                                              |
  | `target_fraction`         | List of numbers from 0 to 1, inclusive                      | Fraction of ground-truth links used for supervision in static link prediction. At least one link per entity is retained.                                                                                                                    |
  | `overlap_ratio`           | List of numbers from 0 to 1, inclusive                      | Overlap between message passing and supervision links in static link prediction.                                                                                                                                                            |

  `EarlyStoppingConfig(min_delta=0.0, patience=3)` requires a nonnegative improvement threshold and positive integer patience.
  `LRSchedulerConfig` takes `name`, `interval` (`"step"` or `"epoch"`), and an optional `kwargs` dictionary for that scheduler.
  Supported warmup schedule names include `"constant_with_warmup"`, `"linear_with_warmup"`, `"cosine_with_warmup"`, and `"cosine_with_warmup_restarts"`.
  Additional scheduler names and arguments must resolve in the installed training runtime.

  The following example configures a bounded learning-rate search:

  ```python
  from kumoapi.model_plan import EarlyStoppingConfig

  plan.training_job.num_experiments = 2
  plan.training_job.manual_seed = 42
  plan.optimization.base_lr = [0.001, 0.003]
  plan.optimization.batch_size = [256]
  plan.optimization.early_stopping = [
      EarlyStoppingConfig(min_delta=0.0, patience=3),
  ]
  ```

  A fixed seed helps repeat a run with the same data, plan, package versions, and execution environment.
  It does not guarantee identical scores across devices, library versions, or parallel execution.
  Retain `plan.as_json()` and the data snapshot identity with your results. The search selects a model. It does not ensemble its trials.
</details>

<details>
  <summary>
    How changing optimization settings affects results
  </summary>

  | Change                                            | Typical effect on quality                                                                                                                                                                                                                     | Cost and risks                                                                                                                                                                                         |
  | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
  | Raise `max_epochs`                                | Helps when validation is still improving at the last epoch.                                                                                                                                                                                   | Costs time. Kumo keeps the epoch with the best validation `tune_metric`, so extra epochs do not replace a better earlier checkpoint. With early stopping, trials that stop improving end early anyway. |
  | Raise `max_steps_per_epoch`                       | The model sees more training rows per epoch, which helps on large training tables. The rows seen per trial are roughly epochs × steps per epoch × batch size.                                                                                 | Longer epochs. Early stopping checks validation less often relative to the rows seen.                                                                                                                  |
  | Raise `max_val_steps` or `max_test_steps`         | Scores more rows, so metrics are less noisy and trial selection is more reliable, especially for rare classes or ranking metrics.                                                                                                             | Longer evaluation passes. A small validation sample can select a trial by chance.                                                                                                                      |
  | Raise `base_lr`                                   | Converges faster. Can escape a poor plateau.                                                                                                                                                                                                  | Too high a rate makes the loss erratic or nonfinite, or settles at a worse value. This is often the most sensitive setting.                                                                            |
  | Lower `base_lr`                                   | Stabilizes an erratic or diverging loss.                                                                                                                                                                                                      | Too low a rate trains slowly and can leave the model undertrained within `max_epochs`. Search learning rates on a multiplicative scale, such as 0.0003, 0.001, and 0.003.                              |
  | Raise `weight_decay`                              | Regularizes the weights. Helps when training metrics keep improving while validation worsens, particularly on small datasets.                                                                                                                 | Too much decay underfits. `"AdamW"` applies decay directly to the weights, so it usually regularizes more predictably than `"Adam"`.                                                                   |
  | Change `optimizer`                                | `"Adam"` and `"AdamW"` usually perform similarly. `"Adagrad"` adapts well to sparse updates, such as large embedding tables.                                                                                                                  | Optimizer and learning rate interact. Retune `base_lr` when you switch.                                                                                                                                |
  | Raise `batch_size`                                | Smoother gradients and faster epochs on GPUs. Often pairs well with a somewhat higher `base_lr`.                                                                                                                                              | Memory grows with the batch size times the sampled subgraph size. Fewer updates per epoch, and less gradient noise, which otherwise acts as mild regularization.                                       |
  | Lower `batch_size`                                | Fits deeper or wider neighborhoods into memory. Adds gradient noise that can reduce overfitting.                                                                                                                                              | Slower epochs. Very small batches can make training unstable, particularly with `"batch_norm"`.                                                                                                        |
  | Loosen or disable `early_stopping`                | Larger `patience` tolerates noisy validation curves, so trials that improve slowly are not cut short. Suggested plans enable early stopping.                                                                                                  | Mainly costs time: Kumo keeps the best validation epoch either way. Conversely, a small `patience` or large `min_delta` saves time but can stop trials that would still improve.                       |
  | Keep, narrow, or remove `lr_scheduler` candidates | Suggested plans already search several warmup schedules. Warmup stabilizes the first steps, which helps with large batches, high learning rates, and Graph Transformers. Decaying schedules, such as cosine, often improve final convergence. | Narrowing the candidates saves search budget. `[None]` removes warmup, which can make early training less stable.                                                                                      |
</details>

### Use Row Weights and Balance Binary Classes

Use row weights when examples should contribute differently, or a class ratio when binary class influence needs rebalancing.

<details>
  <summary>
    Configure row weights and class balancing
  </summary>

  Start with the scalar weighted [custom training table](/sdgm/kumo-engine/user-code-guide/train-a-model/training-tables#use-supplied-training-rows).
  Reuse its `custom_query`, `custom_snapshot`, `custom_training_table`, and `spec`. Pass the same specification when suggesting the plan so Kumo knows the table contains weights:

  ```python
  plan = custom_query.suggest_model_plan(
      custom_snapshot, run_mode=RunMode.FAST, train_table_spec=spec
  )
  plan.optimization.weight_mode = ["weighted_loss"]
  plan.optimization.majority_sampling_ratio = [None]
  ```

  Choose one mode before creating `Trainer(plan)` and calling `fit(custom_training_table, snapshot=custom_snapshot)`:

  | `weight_mode`       | Training behavior                                               |
  | ------------------- | --------------------------------------------------------------- |
  | `["weighted_loss"]` | Multiply each example's loss contribution by its weight.        |
  | `["sample"]`        | Use weights to choose training rows more or less often.         |
  | `[None]`            | Ignore row weights for training. Evaluation can still use them. |

  Use finite, nonnegative scalar weights, with positive weight remaining in the training population.
  A zero weight removes that row's training contribution in weighted loss or its sampling probability in weighted sampling.
  This scalar example does not define weights for list targets or forecast sequences. Weighted link prediction permits `"weighted_loss"` or `None`, not `"sample"`. Forecasting does not support these training weight modes.

  For binary classification, optionally add a class-balancing ratio:

  ```python
  plan.optimization.weight_mode = ["sample"]
  plan.optimization.majority_sampling_ratio = [1.0]
  ```

  The ratio is the desired majority-to-minority balance. `1.0` requests equal class influence when the original classes are imbalanced.
  Kumo increases the minority class weight only when the observed imbalance exceeds the requested ratio.
  When row weights are also present, Kumo multiplies their effect by the class weights, so arbitrary row weights can change the final class balance.
  With `"sample"`, these weights affect row selection. With `"weighted_loss"`, they affect the loss. Neither mode promises an exact class count in each batch.
  A numeric ratio requires every `weight_mode` candidate to be non-`None`. To ignore weights, set both `weight_mode=[None]` and `majority_sampling_ratio=[None]`.

  Rebalancing usually raises minority-class recall and can improve threshold-based metrics such as `"f1"` and `"recall"`.
  Ranking metrics such as `"auroc"` often change less, because they do not depend on a threshold.
  Rebalancing also shifts the model's raw scores toward the minority class. Retune the decision threshold, and check calibration on held-out data before reading scores as probabilities.
  `"weighted_loss"` scales each drawn row's contribution to the loss, which usually gives steadier training than `"sample"`. `"sample"` changes how often rows are drawn, so it can repeat heavily weighted rows and rarely draw lightly weighted ones.

  Fit using the bounded procedure under [Train a Model](/sdgm/kumo-engine/user-code-guide/train-a-model/training#train-a-model), then compare validation metrics and class-specific behavior before retaining a configuration.
  Different sampling frequencies or a lower training loss do not by themselves establish better prediction quality.
</details>

### Loss Functions

Choose distribution losses only when their assumptions match your target values.

<details>
  <summary>
    Loss names and configuration arguments
  </summary>

  | Task                                             | Supported loss names                                                                                                                                 |
  | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Binary and multilabel classification             | `"binary_cross_entropy"`, `"focal"`.                                                                                                                 |
  | Multiclass classification and multilabel ranking | `"cross_entropy"`, `"ordinal_log"`.                                                                                                                  |
  | Static and temporal link prediction              | `"cross_entropy"`, `"binary_cross_entropy"`.                                                                                                         |
  | Regression and forecasting                       | `"mae"`, `"mse"`, `"huber"`, `"wape"`, `"normal_distribution"`, `"negative_binomial_distribution"`, `"log_normal_distribution"`, `"multi_quantile"`. |

  For custom loss parameters, import the corresponding configuration from `kumoapi.model_plan`:

  | Configuration          | Arguments                                                                                                                                                                 |
  | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `FocalLossConfig`      | `name="focal"`; `alpha` greater than 0 and less than 1 (default `0.25`); `gamma` at least 1 (default `2.0`). Controls class weighting and emphasis on difficult examples. |
  | `HuberLossConfig`      | `name="huber"`; `delta` greater than 0 (default `1.0`). Controls the transition between squared and absolute error.                                                       |
  | `OrdinalLogLossConfig` | `name="ordinal_log"`; `alpha` at least 0 (default `1.0`). Controls the ordinal loss coefficient.                                                                          |
  | `QuantileLossConfig`   | `name="quantile"`; `q` from 0 to 1, inclusive. Selects one quantile for regression or forecasting.                                                                        |

  For a regression query, `plan.optimization.loss = [HuberLossConfig(name="huber", delta=2.0)]` selects a Huber loss with a custom threshold.

  The loss decides what "a good prediction" means during training, so match it to the metric you report:

  | Loss                               | Optimizes for                                                     | Use it when                                                                                                                                                                                                            |
  | ---------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `"mse"`                            | The mean                                                          | You report `"mse"` or `"rmse"` and large errors matter most. Sensitive to outliers.                                                                                                                                    |
  | `"mae"`                            | The median                                                        | You report `"mae"` or the target has outliers you do not want to chase.                                                                                                                                                |
  | `"huber"`                          | A compromise between the mean and the median                      | You want squared error for small residuals but robustness to outliers. A larger `delta` behaves more like `"mse"`.                                                                                                     |
  | `"wape"`                           | Absolute error relative to total volume                           | You report errors relative to total demand, as in many forecasting tasks.                                                                                                                                              |
  | `"negative_binomial_distribution"` | A full count distribution                                         | The target is a nonnegative count with many zeros or high variance.                                                                                                                                                    |
  | `"log_normal_distribution"`        | A full skewed positive distribution                               | The target is positive with a long right tail, such as spend or revenue.                                                                                                                                               |
  | `"multi_quantile"`                 | A fixed set of quantiles, with the median as the point prediction | You need prediction intervals.                                                                                                                                                                                         |
  | `QuantileLossConfig`               | One quantile `q` that you choose                                  | You need deliberately high or low estimates, such as `q=0.9` for stock planning.                                                                                                                                       |
  | `"focal"`                          | Class probabilities, weighted toward hard examples                | Classes are highly imbalanced and easy negatives dominate the loss. A larger `gamma` focuses more on hard examples.                                                                                                    |
  | `"ordinal_log"`                    | Class predictions where distant errors cost more                  | Class labels are numeric values with a meaningful distance, and near misses should cost less than distant ones. Labels that cannot be read as numbers, such as `"low"` and `"high"`, fall back to plain cross entropy. |

  A loss that mismatches the target can lower the reported metric even when training converges.
  For example, `"mse"` on a long-tailed target can let a few extreme rows dominate training.
</details>

## Model Architecture

Refer to [Temporal Hetero-GNN](/sdgm/kumo-engine/user-code-guide/train-a-model/temporal-hetero-gnn).

Set `plan.model_architecture.model` to a list of architecture configurations.
Keep the suggested architecture initially. Set explicit candidates to compare architectures on the same task and data.
The following example illustrates candidate syntax, not recommended channel counts:

```python
from kumoapi.model_plan import GNNModelPlan

plan.model_architecture.model = [
    GNNModelPlan(
        channels=[64, 128],
        aggregation=[["sum", "mean", "max"]],
        dropout=[0.0],
    ),
]
```

### GNN and Graph Transformer

`GNNModelPlan` supports all task types.
`GraphTransformerModelPlan` supports node prediction tasks, including forecasting, but not link prediction.
Import both from `kumoapi.model_plan`.

<details>
  <summary>
    GNN and Graph Transformer parameters
  </summary>

  | Configuration     | Parameter              | Supported values and meaning                                                                                                                 |
  | ----------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
  | Both              | `channels`             | List of even integers from 2 to 512. Hidden representation size.                                                                             |
  | GNN               | `aggregation`          | List of lists containing `"sum"`, `"mean"`, `"min"`, `"max"`, `"std"`, or `"var"`. Each inner list combines neighbor aggregation operations. |
  | Both              | `dropout`              | List of rates at least 0 and less than 1. Fraction of features dropped during training.                                                      |
  | Graph Transformer | `num_layers`           | List of integers 1 to 12. Transformer depth.                                                                                                 |
  | Graph Transformer | `num_heads`            | List of integers 1 to 32. Attention heads. Every candidate channel count must be divisible by every candidate head count.                    |
  | Graph Transformer | `positional_encodings` | List of lists containing `"hop"` or `"random_gnn"`. Use `[[]]` for no positional encoding.                                                   |
</details>

<details>
  <summary>
    How changing GNN and Graph Transformer settings affects results
  </summary>

  | Change                                                       | Typical effect on quality                                                                                                                                                                                                                                                                                                           | Cost and risks                                                                                                                                                                                                                                                          |
  | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Raise `channels`                                             | More capacity to represent many tables, columns, and interactions. Helps most on large datasets where training and validation metrics are both still limited.                                                                                                                                                                       | Parameters and activation memory grow quickly with width. On small datasets, wider models overfit. Suggested plans usually stop at 256 because larger widths rarely repay their cost.                                                                                   |
  | Lower `channels`                                             | Faster training and less overfitting on small datasets.                                                                                                                                                                                                                                                                             | Too narrow a model underfits complex graphs.                                                                                                                                                                                                                            |
  | Add aggregators to `aggregation`                             | Each aggregator keeps different information. `"sum"` preserves how many neighbors a node has, `"mean"` captures averages and rates regardless of count, `"max"` and `"min"` capture extremes such as the largest purchase, and `"std"` and `"var"` capture variability. Include `"sum"` when activity volume matters to the target. | More aggregators add parameters and compute, and slightly raise overfitting risk.                                                                                                                                                                                       |
  | Raise `dropout`                                              | Reduces overfitting, particularly on small datasets or with wide models.                                                                                                                                                                                                                                                            | Too much dropout slows convergence and underfits. Large datasets often train best with little or no dropout.                                                                                                                                                            |
  | Choose `GraphTransformerModelPlan` instead of `GNNModelPlan` | Lets any two sampled rows interact in one layer, which can help when the signal depends on interactions between distant or many rows.                                                                                                                                                                                               | Attention cost grows with the square of the number of rows it attends over. Kumo caps that number per example, so with large fanouts some sampled rows are dropped rather than attended. Link prediction is not supported. Often benefits from a warmup `lr_scheduler`. |
  | Raise `num_layers` (Graph Transformer)                       | More rounds of attention and more capacity.                                                                                                                                                                                                                                                                                         | More compute and memory, and deeper models are harder to optimize. Unlike the GNN, depth does not change what is sampled.                                                                                                                                               |
  | Raise `num_heads` (Graph Transformer)                        | Lets attention track several kinds of relationships at once.                                                                                                                                                                                                                                                                        | Each head has `channels / num_heads` dimensions, so many heads with few channels makes each head too narrow to be useful.                                                                                                                                               |
  | Add `positional_encodings`                                   | Gives the transformer structural information that attention otherwise ignores. `"hop"` adds each row's distance from the target entity at little cost. `"random_gnn"` adds local structure at the cost of an extra small GNN.                                                                                                       | Without any positional encoding, the transformer relies on row features alone to tell how each row relates to the target entity.                                                                                                                                        |
</details>

### Shared Architecture Settings

These fields belong directly to `plan.model_architecture`.

<details>
  <summary>
    Shared architecture parameter reference
  </summary>

  | Parameter                         | Supported values                                                                    | Meaning                                                                                                               |
  | --------------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
  | `num_pre_message_passing_layers`  | List of integers 0 to 4                                                             | MLP layers before message passing.                                                                                    |
  | `num_post_message_passing_layers` | List of integers 1 to 8                                                             | MLP layers after message passing.                                                                                     |
  | `activation`                      | List containing `"relu"`, `"leaky_relu"`, `"elu"`, or `"gelu"`                      | Activation function candidates.                                                                                       |
  | `normalization`                   | List containing `"layer_norm"`, `"batch_norm"`, or `None`                           | Normalization layer candidates.                                                                                       |
  | `use_seq_id`                      | List of booleans                                                                    | Encode the order of fact records as a model feature.                                                                  |
  | `prediction_time_encodings`       | List of booleans                                                                    | Encode absolute prediction time for temporal node prediction.                                                         |
  | `past_encoder`                    | List containing `"decomposed"`, `"normalized"`, `"mlp"`, `"transformer"`, or `None` | Encode historical labels for forecasting with positive `lag_timesteps`. Does not apply to temporal regression.        |
  | `handle_new_entities`             | Boolean                                                                             | Forecasting only. `True` uses a shared prediction head. `False` adds learned entity-specific parameters to that head. |
</details>

<details>
  <summary>
    How changing shared architecture settings affects results
  </summary>

  | Change                                       | Typical effect on quality                                                                                                          | Cost and risks                                                                                                                               |
  | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
  | Raise `num_pre_message_passing_layers` (GNN) | Transforms each row's encoded columns further before rows exchange information. Helps tables with many or interacting columns.     | More parameters per table. `0` passes encoded features directly into message passing.                                                        |
  | Raise `num_post_message_passing_layers`      | A deeper prediction head can combine the graph representation in more nonlinear ways.                                              | Overfits more easily on small datasets. Usually a smaller effect than `channels` or sampling depth.                                          |
  | Change `activation`                          | Usually a small effect. `"gelu"` and `"leaky_relu"` can train more smoothly than `"relu"` in deeper models.                        | Little cost. Worth searching only after the larger settings.                                                                                 |
  | Choose `"layer_norm"` (GNN)                  | Stabilizes training independently of batch size. A safe choice in most cases.                                                      | Small compute cost.                                                                                                                          |
  | Choose `"batch_norm"` (GNN)                  | Can speed convergence with large, representative batches.                                                                          | Depends on batch statistics, so it can be unstable with small batches or when prediction data differs from training data.                    |
  | Choose `None` for `normalization` (GNN)      | Removes normalization overhead.                                                                                                    | Deeper or wider models can train less stably.                                                                                                |
  | Enable `use_seq_id`                          | Adds each sampled row's recency rank by timestamp. Can help when the order of recent events carries signal beyond their time gaps. | Little cost. The rank spans the whole sampled subgraph, so it is least meaningful with deep sampling.                                        |
  | Enable `prediction_time_encodings`           | Lets the model learn effects tied to the calendar, such as time of day, day of week, time of year, and holidays.                   | Encodes repeating calendar features only, not a long-term trend. A seasonal cycle that the training period does not cover cannot be learned. |
</details>

### Forecasting Architecture and Historical Inputs

For a forecasting query, the suggested architecture uses a GNN with a forecasting head.
You can choose GNN or Graph Transformer candidates using the configuration classes above.
The forecasting head combines graph context with the historical target inputs available in the training table. These controls do not turn a regression query into a forecasting query.

<details>
  <summary>
    Configure forecasting history and entity handling
  </summary>

  `TrainingTableGenerationPlan` creates historical inputs separately from the model plan.
  Generated forecasts require a positive integer `lag_timesteps`. Leaving it unspecified uses one previous target window, while `0` is rejected.
  `year_over_year=True` requests the corresponding previous-year sequence. The encoder is activated only when those values are present in the materialized table.
  Changing `past_encoder` after generation does not change the table's lag windows or create missing historical values.
  Follow [Generate Forecast Inputs](/sdgm/kumo-engine/user-code-guide/train-a-model/training-tables#generate-forecast-inputs) before fitting.

  For a forecasting table with positive lag windows, select a historical encoder before fitting:

  ```python
  plan.model_architecture.past_encoder = ["decomposed"]
  plan.model_architecture.handle_new_entities = True
  ```

  `"decomposed"` is the suggested historical encoder. `"normalized"`, `"mlp"`, and `"transformer"` are alternative candidates.
  `handle_new_entities=True` uses a shared head. `False` adds learned parameters for individual training entities. It does not merely replace the shared head.
  Keep it `True` when you need forecasts for new entities, subject to the graph and feature requirements of your model.
  These settings apply to forecasting, not ordinary temporal regression.

  These choices usually affect forecast quality in the following ways:

  * The historical target often carries most of the signal for series with strong persistence or seasonality. Setting `past_encoder` to `None` keeps the raw lag values but removes their dedicated encoding, so compare against the suggested `"decomposed"` encoder before removing it.
  * `"mlp"` and `"transformer"` are more flexible history encoders. They can capture more complex patterns in long lag windows, but have more parameters and can overfit short histories or few series.
  * `handle_new_entities=False` can improve accuracy for entities with long, distinctive histories, because each gets its own parameters. It can overfit entities with few training windows and gives no benefit to new ones.
  * Longer `lag_timesteps` and `year_over_year=True`, set when generating the training table, give the encoder more history. They help when the relevant pattern spans that history, at the cost of larger training rows.

  To disable only the historical target encoder, set this before creating the trainer and fitting:

  ```python
  plan.model_architecture.past_encoder = [None]
  ```

  Keep the generated training table's positive lag setting unchanged. The forecasting head still receives the raw lag values. Disabling their encoder does not remove historical inputs or stop generation of the lag columns.
  It also does not disable the separate year-over-year encoder when the table contains those inputs.
  This choice is distinct from `lag_timesteps=0`, which is rejected when constructing generated or supplied forecast training tables.

  After fitting or loading the model, reuse `trainer.training_table_generation_plan` when generating prediction rows so the horizon, lags, year-over-year inputs, and step size match training.
  Refer to [Select the Prediction Population](/sdgm/kumo-engine/user-code-guide/making-predictions#select-the-population) and the [forecast output example](/sdgm/kumo-engine/user-code-guide/code-examples/linux-deployment/forecasting#inspect-the-saved-forecast).
  The default output has `ENTITY`, `TIMESTAMP`, and `TARGET_PRED`. Select optional `ANCHOR_TIMESTAMP` explicitly when you need the common forecast anchor.
</details>

### Link Prediction and Embeddings

These fields also belong directly to `plan.model_architecture` and apply to link prediction.

<details>
  <summary>
    Link prediction and embedding parameters
  </summary>

  | Parameter                      | Supported values                                                            | Meaning                                                                                                                                         |
  | ------------------------------ | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
  | `module`                       | `"shallow_rhs"`, `"two_tower"`, `"context"`, `"pairwise"`                   | Prediction head. `"context"` and `"pairwise"` require temporal link prediction.                                                                 |
  | `handle_new_target_entities`   | Boolean                                                                     | Allow predictions involving target entities unseen during training. Keep target feature and embedding choices compatible with this requirement. |
  | `target_embedding_mode`        | List containing `"lookup"`, `"feature"`, `"shallow_feature"`, or `"fusion"` | Use learned target lookup embeddings, target features, shallow target features, or a combination of lookup and features.                        |
  | `output_embedding_dim`         | List of integers 1 to 256                                                   | Output embedding dimension.                                                                                                                     |
  | `ranking_embedding_loss_coeff` | List of numbers at least 0                                                  | Auxiliary embedding loss coefficient for temporal link prediction with `module="context"`.                                                      |
  | `embedding_norm_reg_coeff`     | List of numbers at least 0                                                  | L2 regularization coefficient for final embeddings.                                                                                             |
  | `distance_measure`             | List containing `"dot_product"` or `"cosine"`                               | Similarity function for link scores.                                                                                                            |
</details>

`target_embedding_mode` controls the target representation for `"shallow_rhs"` and `"context"`.
For these modules, `handle_new_target_entities=True` requires `"feature"` or `"shallow_feature"`. `"lookup"` and `"fusion"` are incompatible.
The `"two_tower"` and `"pairwise"` modules do not use target lookup embeddings.

Use `"shallow_rhs"` or `"two_tower"` when exported embeddings need to represent the model's ranking.
`"context"` produces approximate embeddings, and `"pairwise"` does not support embedding output.
Legacy `"ranking"` and `"embedding"` module names remain compatibility aliases. Use the explicit module names in new plans.
Refer to [Make Predictions](/sdgm/kumo-engine/user-code-guide/making-predictions).

<details>
  <summary>
    How changing link prediction settings affects results
  </summary>

  | Change                                                                 | Typical effect on quality                                                                                                                                  | Cost and risks                                                                                                                                           |
  | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `module="shallow_rhs"`                                                 | Strong ranking when targets have many training interactions, because each target's embedding is learned directly.                                          | Quality on new or rare targets depends on `target_embedding_mode`.                                                                                       |
  | `module="two_tower"`                                                   | Generalizes to new targets from their features and neighborhoods, and scales to large catalogs.                                                            | A target looks the same to every source, so ranking can trail models that condition on the source.                                                       |
  | `module="pairwise"`                                                    | Conditions each candidate on the source, which is strong for repeat or nearby interactions.                                                                | Scores only candidates inside the source's sampled subgraph, so it cannot recommend anything farther away. More compute per source. No embedding output. |
  | `module="context"`                                                     | Combines pairwise scores for nearby candidates with shallow scores for the rest of the catalog. Often the strongest choice for temporal recommendations.   | More compute than `"shallow_rhs"`. Embeddings are approximate.                                                                                           |
  | `target_embedding_mode="lookup"`                                       | Memorizes behavior specific to each target, which is strong for frequently seen targets.                                                                   | Cannot score new targets and learns little about rare ones.                                                                                              |
  | `target_embedding_mode="feature"` or `"shallow_feature"`               | Generalizes to new and rare targets through their columns. `"feature"` learns a deeper projection than `"shallow_feature"`.                                | Weaker than lookup for popular targets when target columns are uninformative.                                                                            |
  | `target_embedding_mode="fusion"`                                       | Combines memorization with feature generalization. Often the best balance for existing catalogs.                                                           | Cannot score new targets. More parameters.                                                                                                               |
  | Raise `output_embedding_dim`                                           | More expressive similarity scores.                                                                                                                         | Larger exported embeddings and nearest-neighbor indexes. Overfits more easily on small catalogs.                                                         |
  | Raise `embedding_norm_reg_coeff`                                       | Limits how much embedding magnitude, rather than direction, drives dot product scores. This can reduce popularity bias.                                    | Too much regularization weakens the ranking signal.                                                                                                      |
  | Raise `ranking_embedding_loss_coeff` (`"context"` only)                | Gives the auxiliary embedding objective more weight, which tends to make the approximate embeddings more useful on their own.                              | Can trade away some of the main ranking quality.                                                                                                         |
  | `distance_measure="dot_product"`                                       | Embedding magnitude can encode popularity or confidence, which often helps ranking.                                                                        | Scores are unbounded, and popular targets can dominate results.                                                                                          |
  | `distance_measure="cosine"`                                            | Scores depend on direction only, which reduces popularity effects and matches cosine nearest-neighbor indexes.                                             | Discards magnitude information that can help ranking.                                                                                                    |
  | Tune `lookup_optimization`                                             | A separate optimizer and learning rate for lookup embeddings lets them train at their own pace. Raise the rate when target embeddings appear undertrained. | Too high a rate makes training less stable.                                                                                                              |
  | Lower `target_fraction` (static link prediction, `"shallow_rhs"` only) | Supervises on fewer links per entity. Rarely useful on its own. Consider it together with `overlap_ratio`.                                                 | Weaker training signal. Suggested plans use `1.0`, the maximum.                                                                                          |
  | Lower `overlap_ratio` (static link prediction, `"shallow_rhs"` only)   | Hides more supervision links from the graph input, so the model cannot read the answer from links it is asked to predict.                                  | Fewer links remain as graph input for message passing. Suggested plans use `1.0`, the maximum.                                                           |
</details>

## Training Table Generation

Labels, time windows, and train/validation/test splits use a separate `TrainingTableGenerationPlan` passed to `query.generate_training_table()`.
Changing a model plan does not regenerate existing training rows or splits.
Refer to [Generate a Training Table](/sdgm/kumo-engine/user-code-guide/train-a-model/training-tables#generate-a-training-table).

Return to [Train a Model](/sdgm/kumo-engine/user-code-guide/train-a-model/training#train-a-model).