ML models
ELSA, ReALM, beeFormer scoring and training.
06 - ML models & training
Scope: ELSA, ReALM, beeFormer as used by recommendation algorithms.
Audience: Analysts who need scoring intuition; PMs who select these algorithms on scenarios.
How ML fits the serving path
If factors/vectors are missing for a user/item, the engine falls back to behavioral defaults so the placement still returns something.
ELSA (elsa-cf) - collaborative filtering
High-level scoring
ELSA is a shallow autoencoder over user–item interaction patterns.
- User factors: latent vector from the encoder for that user.
- Item factors: vectors derived from the decoder (item side).
user-to-item: score ≈ dot(user_factor, item_factor) for candidate items (top-K).
item-to-item: score ≈ similarity between seed item factor and other item factors.
Interpretation: items that co-occur in similar user taste patterns rank higher - not content look-alikes.
Training (detail)
| Aspect | Behavior |
|---|---|
| Architecture | Linear → SELU → Dropout → Linear |
| Data | Exported interactions (+ catalog support) |
| Warm-start | Load prior checkpoint; resize if item universe grew; fine-tune at ~0.1× LR, ~0.3× epochs |
| Output | User + item factors → Mongo model_factors |
| Trigger | Orchestrator threshold (e.g. ≥1000 new interactions) or Admin “Train Now” |
When to use
Dense interaction graph, “people like you also liked.” Weak on brand-new items until retrained / until fallback kicks in.
Analyst checks
- Scenario algorithm =
elsa-cf. - Training page shows recent successful run.
- Spot-check: cold user should look like popularity/weighted-history fallback, not random.
ReALM (realm-sequential) - sequential / session
High-level scoring
GRU over the user’s interaction sequence predicts likely next items.
- Item embeddings + GRU hidden state → ranking over catalog / candidate set.
- Emphasizes order and recency of path, not only aggregate counts.
user-to-item only in the registry.
Training (detail)
| Aspect | Behavior |
|---|---|
| Architecture | GRU + item embeddings → next-item |
| Warm-start | Preserve item indices; merge new events into sequences; resize layers for new items; reduced LR fine-tune |
| Output | User (hidden) + item factors → Mongo |
| Trigger | Same orchestrator family as ELSA |
When to use
Session-heavy funnels (browse A→B→C). Less ideal if events are sparse or unordered dumps.
beeFormer (beeformer-multimodal) - content similarity
High-level scoring
Content embeddings (text; multimodal pipeline as configured) stored in Qdrant. Serving is nearest-neighbor - same shape as vector-similarity, different embedding space.
Training (detail)
| Aspect | Behavior |
|---|---|
| Base | sentence-transformers style encoder (e.g. MiniLM family) |
| Warm-start | Encode new items only; prune stale |
| Output | Vectors → Qdrant |
| Trigger | Often keyed on new items count (e.g. ≥10) |
vs default vector-similarity
Default similar-products uses the online embeddings service / indexing templates. beeFormer uses the training pipeline’s vectors. Pick one intentionally per scenario; don’t assume they are interchangeable without eval.
Orchestrator overview
Typical schedule: daily off-peak. Admin Training page shows status for non-engineers.
PM guidance
| Goal | Prefer |
|---|---|
| Works with little ML ops | weighted-history / co-occurrence / vector-similarity |
| Taste similarity from behavior | elsa-cf |
| Path / session aware | realm-sequential |
| Richer content similar | beeformer-multimodal (after train+index healthy) |
Always pair ML scenarios with sensible filters/constraints and monitor fallback rate indirectly via “does this rail look popular-generic?” for cold users.
