# uliontse/mlgb architecture

> Architecture diagram of the GitHub repository uliontse/mlgb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uliontse/mlgb
- Repository: https://github.com/uliontse/mlgb

## Overview

MLGB is a TensorFlow/PyTorch library for CTR prediction and recommendation. The main workflow is selecting a model through the public API, preparing feature inputs, and running ranking, matching, or multitask model implementations. Both framework stacks provide parallel input, component, and model layers; matching also has retrieval-related components. The README excerpt is truncated, so detailed capabilities are represented at the documented model-family level. Edges rely on the README or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`mlgb/tf/agg.py`](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/agg.py) (TF model registry), [`mlgb/tf/models/ranking.py`](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/ranking.py) (Ranking models), [`mlgb/tf/models/mtl.py`](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/mtl.py) (Multitask models), [`mlgb/torch/agg.py`](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/agg.py) (Torch model registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api_data["API and data"]
  node_public_api["Model API<br/>[main.py]"]
  node_data["Data utilities<br/>[data.py]"]
  node_fe["Feature engineering<br/>[fe.py]"]
end

subgraph group_tf["TensorFlow"]
  node_tf_registry["TF model registry<br/>[agg.py]"]
  node_tf_inputs["Feature inputs<br/>[inputs.py]"]
  node_tf_components["Model components"]
  node_tf_rank["Ranking models<br/>[ranking.py]"]
  node_tf_match["Matching models<br/>[matching.py]"]
  node_tf_mtl["Multitask models<br/>[mtl.py]"]
  node_tf_rank_modules["Ranking modules"]
  node_tf_match_modules["Matching modules<br/>[matching.py]"]
end

subgraph group_torch["PyTorch"]
  node_torch_registry["Torch model registry<br/>[agg.py]"]
  node_torch_inputs["Feature inputs<br/>[inputs.py]"]
  node_torch_components["Model components"]
  node_torch_rank["Ranking models<br/>[ranking.py]"]
  node_torch_match["Matching models<br/>[matching.py]"]
  node_torch_mtl["Multitask models<br/>[mtl.py]"]
  node_torch_rank_modules["Ranking modules"]
  node_torch_match_modules["Matching modules<br/>[matching.py]"]
end

subgraph group_shared["Shared support"]
  node_utils["Utility helpers<br/>[utils.py]"]
end

node_user(("Library user"))

node_user -->|"requests model"| node_public_api
node_public_api -->|"dispatches TF"| node_tf_registry
node_public_api -->|"dispatches Torch"| node_torch_registry
node_data -->|"uses features"| node_fe
node_data -->|"uses helpers"| node_utils
node_tf_registry -->|"exposes ranking"| node_tf_rank
node_tf_registry -->|"exposes matching"| node_tf_match
node_tf_registry -->|"exposes multitask"| node_tf_mtl
node_tf_rank -->|"uses inputs"| node_tf_inputs
node_tf_rank -->|"uses components"| node_tf_components
node_tf_rank -->|"uses modules"| node_tf_rank_modules
node_tf_match -->|"uses components"| node_tf_components
node_tf_match -->|"uses modules"| node_tf_match_modules
node_tf_mtl -->|"uses inputs"| node_tf_inputs
node_tf_mtl -->|"uses components"| node_tf_components
node_tf_mtl -->|"uses multitask module"| node_tf_rank_modules
node_torch_registry -->|"exposes ranking"| node_torch_rank
node_torch_registry -->|"exposes matching"| node_torch_match
node_torch_registry -->|"exposes multitask"| node_torch_mtl
node_torch_rank -->|"uses inputs"| node_torch_inputs
node_torch_rank -->|"uses components"| node_torch_components
node_torch_rank -->|"uses modules"| node_torch_rank_modules
node_torch_match -->|"uses components"| node_torch_components
node_torch_match -->|"uses modules"| node_torch_match_modules
node_torch_mtl -->|"uses inputs"| node_torch_inputs
node_torch_mtl -->|"uses components"| node_torch_components
node_torch_mtl -->|"uses multitask module"| node_torch_rank_modules

click node_public_api "https://github.com/uliontse/mlgb/blob/main/mlgb/main.py"
click node_tf_registry "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/agg.py"
click node_torch_registry "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/agg.py"
click node_data "https://github.com/uliontse/mlgb/blob/main/mlgb/data.py"
click node_fe "https://github.com/uliontse/mlgb/blob/main/mlgb/fe.py"
click node_utils "https://github.com/uliontse/mlgb/blob/main/mlgb/utils.py"
click node_tf_inputs "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/inputs.py"
click node_tf_components "https://github.com/uliontse/mlgb/tree/main/mlgb/tf/components"
click node_tf_rank "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/ranking.py"
click node_tf_match "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/matching.py"
click node_tf_mtl "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/mtl.py"
click node_tf_rank_modules "https://github.com/uliontse/mlgb/tree/main/mlgb/tf/modules/ranking"
click node_tf_match_modules "https://github.com/uliontse/mlgb/blob/main/mlgb/tf/modules/matching.py"
click node_torch_inputs "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/inputs.py"
click node_torch_components "https://github.com/uliontse/mlgb/tree/main/mlgb/torch/components"
click node_torch_rank "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/ranking.py"
click node_torch_match "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/matching.py"
click node_torch_mtl "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/mtl.py"
click node_torch_rank_modules "https://github.com/uliontse/mlgb/tree/main/mlgb/torch/modules/ranking"
click node_torch_match_modules "https://github.com/uliontse/mlgb/blob/main/mlgb/torch/modules/matching.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_api,node_data,node_fe,node_user toneBlue
class node_tf_registry,node_tf_inputs,node_tf_components,node_tf_rank,node_tf_match,node_tf_mtl,node_tf_rank_modules,node_tf_match_modules toneAmber
class node_torch_registry,node_torch_inputs,node_torch_components,node_torch_rank,node_torch_match,node_torch_mtl,node_torch_rank_modules,node_torch_match_modules toneMint
class node_utils toneRose
```

## Components

### API and data

- [Model API](https://github.com/uliontse/mlgb/blob/main/mlgb/main.py): `mlgb/main.py`
- [Data utilities](https://github.com/uliontse/mlgb/blob/main/mlgb/data.py): `mlgb/data.py`
- [Feature engineering](https://github.com/uliontse/mlgb/blob/main/mlgb/fe.py): `mlgb/fe.py`

### TensorFlow

- [TF model registry](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/agg.py): `mlgb/tf/agg.py`
- [Feature inputs](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/inputs.py): `mlgb/tf/inputs.py`
- [Model components](https://github.com/uliontse/mlgb/tree/main/mlgb/tf/components): `mlgb/tf/components`
- [Ranking models](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/ranking.py): `mlgb/tf/models/ranking.py`
- [Matching models](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/matching.py): `mlgb/tf/models/matching.py`
- [Multitask models](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/models/mtl.py): `mlgb/tf/models/mtl.py`
- [Ranking modules](https://github.com/uliontse/mlgb/tree/main/mlgb/tf/modules/ranking): `mlgb/tf/modules/ranking`
- [Matching modules](https://github.com/uliontse/mlgb/blob/main/mlgb/tf/modules/matching.py): `mlgb/tf/modules/matching.py`

### PyTorch

- [Torch model registry](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/agg.py): `mlgb/torch/agg.py`
- [Feature inputs](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/inputs.py): `mlgb/torch/inputs.py`
- [Model components](https://github.com/uliontse/mlgb/tree/main/mlgb/torch/components): `mlgb/torch/components`
- [Ranking models](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/ranking.py): `mlgb/torch/models/ranking.py`
- [Matching models](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/matching.py): `mlgb/torch/models/matching.py`
- [Multitask models](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/models/mtl.py): `mlgb/torch/models/mtl.py`
- [Ranking modules](https://github.com/uliontse/mlgb/tree/main/mlgb/torch/modules/ranking): `mlgb/torch/modules/ranking`
- [Matching modules](https://github.com/uliontse/mlgb/blob/main/mlgb/torch/modules/matching.py): `mlgb/torch/modules/matching.py`

### Shared support

- [Utility helpers](https://github.com/uliontse/mlgb/blob/main/mlgb/utils.py): `mlgb/utils.py`

### Other components

- **Library user**

## Connections

- Library user → Model API: requests model
- Model API → TF model registry: dispatches TF (evidence: `mlgb/main.py`)
- Model API → Torch model registry: dispatches Torch (evidence: `mlgb/main.py`)
- Data utilities → Feature engineering: uses features (evidence: `mlgb/data.py`)
- Data utilities → Utility helpers: uses helpers (evidence: `mlgb/data.py`)
- TF model registry → Ranking models: exposes ranking (evidence: `mlgb/tf/agg.py`)
- TF model registry → Matching models: exposes matching (evidence: `mlgb/tf/agg.py`)
- TF model registry → Multitask models: exposes multitask (evidence: `mlgb/tf/agg.py`)
- Ranking models → Feature inputs: uses inputs (evidence: `mlgb/tf/models/ranking.py`)
- Ranking models → Model components: uses components (evidence: `mlgb/tf/models/ranking.py`)
- Ranking models → Ranking modules: uses modules (evidence: `mlgb/tf/models/ranking.py`)
- Matching models → Model components: uses components (evidence: `mlgb/tf/models/matching.py`)
- Matching models → Matching modules: uses modules (evidence: `mlgb/tf/models/matching.py`)
- Multitask models → Feature inputs: uses inputs (evidence: `mlgb/tf/models/mtl.py`)
- Multitask models → Model components: uses components (evidence: `mlgb/tf/models/mtl.py`)
- Multitask models → Ranking modules: uses multitask module (evidence: `mlgb/tf/models/mtl.py`)
- Torch model registry → Ranking models: exposes ranking (evidence: `mlgb/torch/agg.py`)
- Torch model registry → Matching models: exposes matching (evidence: `mlgb/torch/agg.py`)
- Torch model registry → Multitask models: exposes multitask (evidence: `mlgb/torch/agg.py`)
- Ranking models → Feature inputs: uses inputs (evidence: `mlgb/torch/models/ranking.py`)
- Ranking models → Model components: uses components (evidence: `mlgb/torch/models/ranking.py`)
- Ranking models → Ranking modules: uses modules (evidence: `mlgb/torch/models/ranking.py`)
- Matching models → Model components: uses components (evidence: `mlgb/torch/models/matching.py`)
- Matching models → Matching modules: uses modules (evidence: `mlgb/torch/models/matching.py`)
- Multitask models → Feature inputs: uses inputs (evidence: `mlgb/torch/models/mtl.py`)
- Multitask models → Model components: uses components (evidence: `mlgb/torch/models/mtl.py`)
- Multitask models → Ranking modules: uses multitask module (evidence: `mlgb/torch/models/mtl.py`)
