This is a very insightful question, and you're absolutely right to be thinking about the symmetry and relational structure of Dota 2 matches. Let’s break down both approaches and then recommend the best one.
✅ Problem Recap
You are predicting match outcome (radiant win / dire win) based on hero compositions.
- Each team has 5 heroes.
- You’re using an embedding layer for heroes (shared between radiant and dire).
- You apply sum pooling per team → each team becomes a single vector.
- Now you want to combine the two team embeddings to predict the outcome.
Your intuition:
“Since radiant and dire are opposing teams, the dire embedding should be ‘inverted’ relative to radiant — or else the model can’t distinguish which side is which.”
This is correct and crucial.
🔍 Option 1: Shared Embedding + Invert Dire Embedding
How it works:
- One shared hero embedding matrix
E (size: num_heroes × embed_dim)
- For radiant team: sum over embeddings of its 5 heroes →
r = sum(E[radiant_heroes])
- For dire team: sum over embeddings →
d = sum(E[dire_heroes])
- Then:
concat(r, -d) or concat(r, d * -1) → feed to final layers
Pros:
- Parameter efficient: Only one embedding table.
- Enforces symmetry: The model learns that dire is the "opposite" of radiant by construction.
- Encourages meaningful representation: If a hero is strong for radiant, it’s implicitly weak for dire (or vice versa), and the negative sign makes this explicit.
Cons:
- Slight risk of gradient instability if the negative sign causes vanishing/exploding gradients (rare with modern norms).
- Requires careful initialization and training dynamics.
✅ Why this is good:
In Dota 2, hero matchups matter. A hero like Medusa is strong against physical damage teams — but if she's on dire, she's countering radiant’s composition. The relative relationship matters more than absolute strength.
By using -d, you’re telling the network:
“Dire’s presence subtracts from radiant’s advantage.”
This mirrors how real Dota 2 works: it’s a zero-sum game. The outcome depends on the difference in team strengths, not their absolute values.
💡 Think of it like: predict(win) = f(radiant - dire) — you’re modeling the margin of victory, not two independent scores.
🔍 Option 2: Separate Embedding Layers for Radiant and Dire
How it works:
- Two separate embedding matrices:
E_radiant, E_dire (each size: num_heroes × embed_dim)
- Sum pool each →
r = sum(E_radiant[radiant_heroes]), d = sum(E_dire[dire_heroes])
- Concatenate:
concat(r, d)
Pros:
- More expressive: Each team can learn different representations (e.g., maybe Dire heroes have different roles in practice?).
- No need to force symmetry.
Cons:
- Massive overparameterization: You now have twice as many parameters, but only ~50% as much data per embedding (since each hero appears roughly equally often on each side).
- Risk of learning spurious correlations: E.g., the model might just learn “if hero X is on radiant → win”, ignoring matchup context.
- Breaks symmetry: The network doesn’t inherently know that Radiant and Dire are symmetric roles. It may learn that Radiant has an inherent advantage (bias) even if none exists.
🚫 This approach violates the fundamental symmetry of Dota 2: swapping radiant and dire teams should flip the label. Your model should be invariant under this swap (except for label flipping).
🏆 Recommended Approach: Shared Embedding + Negative Dire
# Pseudocode
hero_embedding = nn.Embedding(num_heroes, embed_dim)
radiant_heroes = [...] # shape: (batch, 5)
dire_heroes = [...] # shape: (batch, 5)
r = torch.sum(hero_embedding(radiant_heroes), dim=1) # (batch, embed_dim)
d = torch.sum(hero_embedding(dire_heroes), dim=1) # (batch, embed_dim)
# Key insight: invert dire to represent opposition
team_features = torch.cat([r, -d], dim=1) # or r - d directly!
output = nn.Sequential(
nn.Linear(2 * embed_dim, 128),
nn.ReLU(),
nn.Linear(128, 1)
)(team_features)
✅ Even better: Instead of concatenating [r, -d], just use r - d as your input!
Why? Because you’re modeling the difference in team strength — exactly what determines the winner.
💡 Best Practice: Use r - d instead of concat(r, -d)
team_diff = r - d # (batch, embed_dim)
output = nn.Linear(embed_dim, 1)(team_diff)
This is:
- More efficient (half the dimensionality)
- More interpretable: Directly models team strength difference
- Symmetric: If you swap radiant and dire →
d - r = -(r - d) → output flips → label flips ✅
- Proven in literature: Similar ideas used in chess engines, competitive games (e.g., AlphaStar, Dota 2 AI research)
📚 Supporting Evidence
- Papers like "Dota 2 with Large Scale Deep Reinforcement Learning" (OpenAI, 2019) and "Learning to Play Competitive Multiplayer Games" implicitly model team differences.
- In recommendation systems and matching problems (e.g., user-item interactions), pairwise differences are standard (e.g., Siamese networks, contrastive losses).
- In neural MMOs or sports prediction, team vs team difference vectors outperform concatenated team features.
✅ Final Recommendation
| Approach | Recommendation |
|---|
Shared embedding + r - d | ✅ BEST — Symmetric, efficient, interpretable, physics-aligned |
Shared embedding + concat(r, -d) | ✅ Good alternative if you want richer interaction later |
| Two separate embeddings | ❌ Avoid — wastes parameters, breaks symmetry, risks bias |
Bonus Tip: Add Hero Pair Interactions?
If you want to go further, consider adding pairwise attention between radiant and dire heroes (e.g., cross-attention) to capture direct counters (e.g., Anti-Mage vs Lina). But for a baseline, r - d is king.
🧠 Intuition Summary
In Dota 2, the winner is determined by who has the stronger team relative to the other — not by absolute power.
So model the difference, not the sum.
Use one embedding table, and let the model learn that dire is the opposite side via subtraction: r - d.
This is elegant, effective, and aligned with the game’s design.
Go with r - d 👊