ComplEx (Complex Embeddings) is a knowledge graph embedding (KGE) model that represents entities and relations as vectors in a complex space (using real and imaginary components). It formulates the scoring function for a triple (head, relation, tail) as a Hermitian dot product, enabling it to naturally capture fundamental relational patterns like symmetry, asymmetry, and inversion. This mathematical formulation allows ComplEx to overcome key limitations of earlier models like DistMult, which could only model symmetric relations.
Glossary
ComplEx

What is ComplEx?
ComplEx is a foundational knowledge graph embedding model that operates in complex vector space to effectively model symmetric, asymmetric, and inverse relations for link prediction.
The model's ability to handle antisymmetric relations is its primary innovation, making it highly effective for the core knowledge graph completion task of link prediction. It is trained using negative sampling and evaluated using metrics like Hits@K and Mean Reciprocal Rank (MRR). ComplEx is a direct precursor to more advanced rotational models like RotatE and remains a standard baseline in embedding-based inference for enriching enterprise knowledge graphs.
Key Features of ComplEx
ComplEx (Complex Embeddings) is a seminal knowledge graph embedding model that represents entities and relations as vectors in complex space (ℂⁿ), enabling it to effectively model a wide spectrum of relation patterns essential for accurate link prediction.
Complex Vector Space Foundation
ComplEx operates in complex vector space (ℂⁿ), where each embedding has real and imaginary components. This allows the model's scoring function to be non-symmetric, a critical property for modeling diverse relation types. The core scoring function is defined as the real part of a trilinear dot product: score = Re(⟨h, r, conj(t)⟩), where h, r, t are complex vectors for head, relation, and tail, and conj(t) is the complex conjugate of the tail embedding. This formulation is the mathematical key to its expressiveness.
Modeling Antisymmetric Relations
A primary advantage of ComplEx is its inherent ability to model antisymmetric relations. In a real vector space, a symmetric scoring function (where score(h,r,t) = score(t,r,h)) is common, which fails for relations like isParentOf. Because ComplEx uses the complex conjugate of the tail entity, the scores for (h, r, t) and (t, r, h) are generally not equal, allowing it to correctly learn that isParentOf(Alice, Bob) does not imply isParentOf(Bob, Alice). This directly addresses a major limitation of earlier models like DistMult.
Capturing Symmetric & Inverse Relations
Despite its strength with antisymmetric patterns, ComplEx can also effectively model symmetric relations (e.g., isMarriedTo, collaboratesWith) and inverse relations (e.g., isChildOf is the inverse of isParentOf).
- Symmetry emerges when the relation embedding is purely real, causing the scoring function to become symmetric.
- Inversion is captured when one relation's embedding is approximately the complex conjugate of another. This multi-pattern capacity within a single, unified model simplifies architecture and improves generalization across diverse knowledge graphs like FB15k and WN18.
Efficient Bilinear Scoring
The model employs an efficient bilinear scoring mechanism. While the embedding space is complex, the scoring function can be computed as a special case of a real bilinear product, enabling efficient implementation. The decomposition Re(⟨h, r, conj(t)⟩) expands into operations on the real and imaginary parts of the vectors, allowing for optimized tensor operations using standard deep learning libraries like PyTorch and TensorFlow. This efficiency enables training on large-scale graphs with millions of entities and relations.
Link Prediction via Semantic Matching
ComplEx is a semantic matching model. It predicts links by measuring the compatibility between the head, relation, and tail embeddings in the latent space, rather than by simulating a path or translation. To predict a missing tail for a query (h, r, ?), the model scores the head and relation against all candidate entity embeddings, ranking them by the computed score. This approach is evaluated using standard metrics like Hits@k and Mean Reciprocal Rank (MRR), where ComplEx established state-of-the-art results on benchmark datasets upon its introduction.
Foundation for Advanced Models
ComplEx's complex space formulation inspired a lineage of more advanced models. RotatE (2019) reinterpreted relations as rotations in complex space (t = h ◦ r, where |r| = 1), explicitly modeling symmetry/antisymmetry, inversion, and composition. QuatE (2019) extended the idea into hypercomplex (quaternion) space for richer representational capacity. ComplEx's core insight—that moving beyond real-valued embeddings unlocks critical relational patterns—established a fundamental direction for subsequent knowledge graph embedding research, influencing both academic and industrial KGC systems.
ComplEx vs. Other KGE Models
A technical comparison of the ComplEx knowledge graph embedding model against other foundational KGE architectures, highlighting key design choices, capabilities, and performance characteristics.
| Feature / Metric | ComplEx | TransE | DistMult | RotatE |
|---|---|---|---|---|
Mathematical Foundation | Complex vector space, Hermitian dot product | Real vector space, translational distance | Real vector space, bilinear diagonal product | Complex vector space, rotational distance |
Core Relation Operation | Complex-valued bilinear product | Vector translation: h + r ≈ t | Diagonal matrix multiplication | Element-wise rotation: h ◦ r ≈ t |
Modeled Relation Patterns | Symmetric, Asymmetric, Inverse | Inverse, Composition | Symmetric only | Symmetric, Asymmetric, Inverse, Composition |
Handles Antisymmetric Relations | ||||
Parameter Efficiency | Moderate (2x real params per complex dim) | High | High | Moderate (2x real params per complex dim) |
Typical Scoring Function | Re(⟨h, r, t̅⟩) | -||h + r - t|| | ⟨h, r, t⟩ | -||h ◦ r - t|| |
Primary Training Objective | Logistic/Cross-Entropy Loss with Negative Sampling | Margin-Based Ranking Loss | Logistic/Cross-Entropy Loss | Margin-Based Ranking Loss (mod-self) |
Inference Scalability | High (dot product) | High (distance calc) | Very High (diagonal op) | High (rotation calc) |
Common Benchmark Performance (FB15k-237 MRR) | ~0.35 | ~0.29 | ~0.24 | ~0.34 |
Examples and Use Cases
ComplEx's ability to model complex-valued interactions makes it a powerful tool for specific, high-value knowledge graph completion tasks. These cards illustrate its practical applications and operational strengths.
Modeling Asymmetric Relations
ComplEx excels at predicting asymmetric relations, where the relationship direction matters. This is critical for business knowledge graphs.
- Example: Predicting
(Apple, competesWith, Samsung)is true, while(Samsung, competesWith, Apple)is also true (symmetric). However,(Apple, acquires, Beats)is true, but(Beats, acquires, Apple)is false (asymmetric). ComplEx's complex dot product naturally captures this directional asymmetry. - Use Case: In a supply chain knowledge graph, correctly distinguishing
(Supplier, providesPartTo, Manufacturer)from its inverse is essential for dependency analysis and risk modeling.
Handling Inverse Relation Patterns
The model effectively learns inverse relations, where one relation logically reverses another (e.g., hypernym/hyponym, parentOf/childOf).
- Mechanism: If a relation
rand its inverser_invexist, ComplEx can learn embeddings where the score for(h, r, t)is high and the score for(t, r_inv, h)is also high, as the complex conjugate provides a natural mathematical inverse. - Application: In pharmaceutical knowledge graphs, this ensures consistency between
(Drug, treats, Disease)and(Disease, treatedBy, Drug), improving the completeness of therapeutic relationship data.
Enhancing Recommendation Systems
ComplEx embeddings power entity-aware recommendation engines by representing users, items, and their interactions (e.g., likes, purchases) as a knowledge graph.
- Process: Users and items are entities. Relations like
clicked,purchased, orrated_highconnect them. ComplEx predicts missingpurchasedlinks, suggesting new items. - Advantage: Its handling of asymmetric relations improves scenarios where
userA influences userBdoes not implyuserB influences userA. This is vital for modeling social influence in retail and content platforms.
Bioinformatics and Drug Discovery
In molecular knowledge graphs, ComplEx predicts interactions between biological entities, a task rich with complex relation patterns.
- Data Structure: Entities are genes, proteins, diseases, and drugs. Relations include
interactsWith,inhibits,associatedWith. - Prediction Task: Given a known protein and a disease, predict the
targetsrelation to a novel drug candidate. ComplEx's ability to reason over multi-hop paths (e.g., Gene → associatedWith → Disease ← treatedBy → Drug) aids in identifying novel therapeutic pathways.
Enterprise Knowledge Graph Completion
ComplEx is deployed to auto-populate corporate knowledge graphs, inferring missing relationships between internal entities like projects, employees, skills, and departments.
- Example: Inferring that
(Project_Alpha, requiresSkill, MachineLearning)based on similar project profiles, or predicting(Employee_B, reportsTo, Manager_Y)from organizational patterns. - Business Value: This automates the maintenance of HR, IT, and R&D knowledge bases, ensuring data completeness for downstream applications like expert finding or team composition analysis.
Benchmark Performance on Standard Datasets
ComplEx is a staple baseline and competitive solution on public KGC benchmarks, demonstrating its empirical effectiveness.
- Common Datasets: WN18RR (WordNet), FB15k-237 (Freebase). These datasets contain mixtures of symmetric, asymmetric, and inverse relations.
- Typical Metrics: ComplEx consistently achieves strong Hits@10 (proportion of correct answers in top 10 predictions) and Mean Reciprocal Rank (MRR) scores on these benchmarks, validating its design for real-world relation patterns. Its efficiency also makes it suitable for large-scale enterprise graphs.
Frequently Asked Questions
ComplEx is a foundational model for knowledge graph embedding and link prediction. These questions address its core mechanisms, advantages, and practical applications.
ComplEx (Complex Embeddings) is a knowledge graph embedding (KGE) model that represents entities and relations as vectors in a complex space (using complex numbers with real and imaginary parts) to perform link prediction. It works by scoring the likelihood of a fact (a triple like (head, relation, tail)) using a Hermitian dot product. The scoring function is defined as Re(<head, relation, conj(tail)>), where Re denotes the real part, < , , > is the trilinear dot product, and conj is the complex conjugate. This formulation allows ComplEx to effectively model symmetric, asymmetric, and inverse relations by capturing compositional patterns through the multiplicative interactions of complex vectors.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
ComplEx operates within the broader field of knowledge graph completion. These related concepts define the tasks, models, and evaluation frameworks that surround it.
Knowledge Graph Embedding (KGE)
Knowledge Graph Embedding (KGE) is the foundational technique of mapping entities and relations into a continuous vector space. This transformation enables mathematical operations for tasks like link prediction. ComplEx is a specific KGE model that uses complex-valued vectors to capture a richer set of relation patterns (symmetric, asymmetric, inverse) compared to real-valued models.
- Purpose: Create a latent representation where geometric relationships between embeddings correspond to logical relationships in the graph.
- Core Idea: If a triple (h, r, t) is true, the embedding of the head entity
hshould be close to the embedding of the tail entitytafter some transformation defined by the relationr. - Applications: Powering downstream tasks like semantic search, recommendation systems, and data completion.
Link Prediction
Link prediction is the primary task that ComplEx is designed to solve. It involves predicting the existence of a missing relationship between two entities in a knowledge graph. For a given query (head, relation, ?) or (?, relation, tail), the model scores candidate entities to identify the most plausible completion.
- Formal Task: Given (h, r, ?), predict the correct tail entity
t. Given (?, r, t), predict the correct head entityh. - ComplEx's Role: ComplEx provides a scoring function φ(h, r, t) that measures the plausibility of a triple. A higher score indicates a more likely true fact.
- Example: In a biomedical KG, link prediction can infer new gene-disease associations not present in the original data.
TransE & RotatE (Translational & Rotational Models)
TransE and RotatE are other seminal KGE models that, like ComplEx, define specific geometric transformations for relations.
- TransE: Models relations as translations in the vector space:
h + r ≈ t. It is simple and effective but struggles with complex relation patterns like 1-to-N. - RotatE: Models relations as rotations in complex vector space:
t ≈ h ◦ r, where◦denotes element-wise (Hadamard) multiplication. It can model symmetry, anti-symmetry, and inversion. - ComplEx vs. RotatE: While both use complex numbers, RotatE constrains relation embeddings to have unit modulus (a rotation), whereas ComplEx does not, allowing it to also model composition patterns effectively.
DistMult & RESCAL (Bilinear Models)
DistMult and RESCAL are bilinear models that form the direct lineage of ComplEx. ComplEx was developed to overcome a key limitation of DistMult.
- DistMult: Uses a simple, efficient diagonal matrix to represent each relation. Its scoring function is a trilinear dot product:
h · diag(r) · t. A major flaw: it can only model symmetric relations because the dot product is commutative. - RESCAL: A more expressive predecessor that uses a full relation matrix, capturing all pairwise interactions but requiring many more parameters (
O(d^2)). - ComplEx as a Solution: By moving to complex space and using the Hermitian dot product, ComplEx regains the ability to model asymmetric relations (like DistMult cannot) while remaining parameter-efficient (like DistMult,
O(d)).
Tensor Factorization
Tensor factorization is the overarching mathematical framework for many KGE models, including ComplEx. A knowledge graph can be represented as a 3D binary tensor X of size (n_entities, n_relations, n_entities), where a slice for each relation r is an adjacency matrix.
- The Goal: Factorize this sparse, high-dimensional tensor into lower-dimensional, dense embeddings that capture its latent structure.
- ComplEx Factorization: ComplEx performs a canonical polyadic (CP) decomposition of the tensor, where each element
X[h,r,t]is approximated by the real part of the sum of the products of the embedding components:Re(∑ h_i * r_i * conj(t_i)). - Advantage: This formulation directly leads to its efficient scoring function and its theoretical ability to model key relation patterns.
Negative Sampling
Negative sampling is a critical training technique used to optimize ComplEx and other KGE models. Since knowledge graphs contain only positive examples (true triples), the model needs contrasting negative examples to learn meaningful distinctions.
- Process: For each true triple (h, r, t) in a training batch, one or more corrupted triples are generated by randomly replacing the head or tail entity with another entity from the graph (e.g., (h', r, t) or (h, r, t')).
- Loss Function: ComplEx is typically trained with a margin-based ranking loss or binary cross-entropy loss. The objective is to score true triples higher than corrupted ones by at least a defined margin.
- Challenge: Generating informative, "hard" negatives (those that are plausible but false) is an active research area to improve model performance.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us