Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Recommenders team Recommenders News Hyperparameter Configuration

From Leeroopedia


Knowledge Sources
Domains News Recommendation, Hyperparameter Management, Configuration
Last Updated 2026-02-10 00:00 GMT

Overview

Hyperparameter management for neural news recommenders encompasses loading configuration from YAML files, overriding values with keyword arguments, and validating that all neural network parameters have correct types and required fields.

Description

Neural news recommendation models such as NRMS, NAML, LSTUR, and NPA require a carefully tuned set of hyperparameters that govern model architecture, training behavior, and data processing. The hyperparameter configuration principle addresses three concerns:

  1. Loading — Base configurations are stored in YAML files that define default values for all model parameters. These YAML files serve as reproducible experiment configurations.
  2. Overriding — At runtime, any parameter can be overridden via keyword arguments. This allows dynamic customization (e.g., pointing to specific embedding files or adjusting batch sizes) without modifying the YAML file.
  3. Validation — Before the configuration is accepted, all parameters are validated for:
    • Completeness — Model-specific required parameters are checked (e.g., NRMS requires head_num, head_dim, attention_hidden_dim).
    • Type correctness — Integer, float, string, list, and boolean parameters are verified against their expected types.
    • Format constraints — The data_format must match the model type (e.g., NRMS requires "news" format).

Key hyperparameter categories include:

Category Parameters Description
Architecture head_num, head_dim, attention_hidden_dim, word_emb_dim Define the multi-head self-attention and embedding dimensions
Training learning_rate, epochs, batch_size, optimizer, dropout Control the training loop behavior
Data title_size, his_size, npratio, data_format Define input shapes and negative sampling ratio
Resources wordEmb_file, wordDict_file, userDict_file Paths to pre-trained embeddings and dictionaries
Scoring support_quick_scoring Enables fast evaluation via pre-computed embeddings

Usage

Use hyperparameter configuration immediately after dataset preparation and before model initialization. This step produces the HParams object that is passed to the model constructor. It is required for every news recommendation experiment.

Theoretical Basis

The configuration system follows a layered defaults pattern:

Configuration Resolution Order:
1. Hard-coded defaults (in create_hparams):
   - learning_rate = 0.001
   - optimizer = "adam"
   - epochs = 10
   - batch_size = 1
   - head_num = 4
   - head_dim = 100
   - dropout = 0.0
   - attention_hidden_dim = 200

2. YAML file values (override defaults)

3. Keyword arguments (override YAML values)

Final config = defaults <- YAML <- kwargs

For NRMS specifically, the required parameters are:

  • title_size, his_size, wordEmb_file, wordDict_file, userDict_file
  • npratio, data_format (must be "news"), word_emb_dim
  • head_num, head_dim, attention_hidden_dim
  • loss, dropout

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment