Files
wehub-resource-sync 593b94c120
pytest / Unit Tests (push) Waiting to run
pytest / Integration (integration_tests_a) (push) Waiting to run
pytest / Integration (integration_tests_b) (push) Waiting to run
pytest / Integration (integration_tests_c) (push) Waiting to run
pytest / Integration (integration_tests_d) (push) Waiting to run
pytest / Integration (integration_tests_e) (push) Waiting to run
pytest / Integration (integration_tests_f) (push) Waiting to run
pytest / Integration (integration_tests_g) (push) Waiting to run
pytest / Integration (integration_tests_h) (push) Waiting to run
pytest / Integration (integration_tests_i) (push) Waiting to run
pytest / Integration (integration_tests_j) (push) Waiting to run
pytest / Distributed (distributed_a) (push) Waiting to run
pytest / Distributed (distributed_b) (push) Waiting to run
pytest / Distributed (distributed_c) (push) Waiting to run
pytest / Distributed (distributed_d) (push) Waiting to run
pytest / Distributed (distributed_e) (push) Waiting to run
pytest / Distributed (distributed_f) (push) Waiting to run
pytest / Minimal Install (push) Waiting to run
pytest / Event File (push) Waiting to run
pytest (slow) / py-slow (push) Waiting to run
Publish JSON Schema / publish-schema (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:49:20 +08:00
..

HyperNetworkCombiner: Conditional Feature Processing

Note: This example requires PR #4092 to be merged into Ludwig, or pip install ludwig >= 0.14.

Open In Colab

What the HyperNetworkCombiner does differently

Most combiners — including the default concat combiner — treat all input features symmetrically: they encode each feature independently and then merge the resulting vectors (by concatenation, attention, or summation). The merged representation is the same kind of computation regardless of what any individual feature says.

The hypernetwork combiner breaks this symmetry. One feature, called the conditioning feature, is fed through a small hyper-network that generates the weight matrices and biases of the fully-connected layers that process all other features. In other words, the conditioning feature does not just contribute to the prediction — it rewrites the transformation applied to every other feature before prediction happens.

This is based on HyperFusion (arXiv 2403.13319, 2024).

sensor_type  ──► HyperNetwork ──► generates weights W, b
                                        │
sensor_a ─────────────────────► FC(W, b) ──► combined
sensor_b ─────────────────────► FC(W, b) ──►  repr.
sensor_c ─────────────────────► FC(W, b) ──►

Contrast with concat:

sensor_type ──►  encoder  ──┐
sensor_a    ──►  encoder  ──┤
sensor_b    ──►  encoder  ──┼──► concat ──► FC ──► output
sensor_c    ──►  encoder  ──┘

With concat, the network learns after combining to react to different sensor types. With hypernetwork, the combination itself is conditioned on sensor type.

When to use it

Use the hypernetwork combiner when:

  • One feature is a context or mode that fundamentally changes how other features should be interpreted (sensor type, device class, environment, language).
  • The relationship between inputs and the target changes qualitatively across groups, not just quantitatively.
  • You have enough training data to learn the per-context transformations (at minimum a few hundred samples per conditioning category).

Stick with concat when:

  • All input features contribute on equal footing.
  • The dataset is small (the hyper-network adds parameters).
  • Interpretability of the encoding step is important and you want a fixed transformation.

Files

File Description
hypernetwork.ipynb End-to-end walkthrough with synthetic sensor data
config_concat.yaml Baseline concat config
config_hypernetwork.yaml HyperNetworkCombiner config
train_hypernetwork.py Standalone script — generates data, trains both models, prints comparison

Quick start

pip install "ludwig>=0.14"
python train_hypernetwork.py