embedding-fusion-strategy
$
npx mdskill add lyndonkl/claude/embedding-fusion-strategyDesigns fusion strategies merging semantic and structural graph embeddings.
- Optimizes knowledge graph representations by combining text and topology signals.
- Selects appropriate granularity levels from node to subgraph contexts.
- Applies concatenation, attention, or contrastive alignment fusion methods.
- Generates precise embedding specifications for downstream retrieval tasks.
SKILL.md
.github/skills/embedding-fusion-strategyView on GitHub ↗
--- name: embedding-fusion-strategy description: Designs embedding strategies that combine semantic (text-based) and structural (graph-based) information at node, edge, path, and subgraph levels for knowledge graphs. Use when selecting embedding granularity, choosing complementary semantic and structural approaches, designing fusion strategies (concatenation, attention, contrastive alignment), or when user mentions node embeddings, embedding fusion, vector representations for graphs, or combining text and graph signals. --- ## Table of Contents - [What Is It?](#what-is-it) - [Workflow](#workflow) - [Granularity Selection Guide](#granularity-selection-guide) - [Fusion Approaches](#fusion-approaches) - [Output Template](#output-template) # Embedding Fusion Strategy ## Workflow Copy this checklist and work through each step: ``` Embedding Fusion Strategy Progress: - [ ] Step 1: Identify available features and data sources - [ ] Step 2: Determine task requirements and success criteria - [ ] Step 3: Select granularity level(s) - [ ] Step 4: Choose semantic embedding approach - [ ] Step 5: Choose structural embedding approach - [ ] Step 6: Design fusion strategy - [ ] Step 7: Produce embedding strategy specification ``` **Step 1: Identify available features and data sources** Inventory what signals exist in the knowledge graph: node text attributes (names, descriptions, types), edge labels and properties, graph topology (density, diameter, heterogeneity), any external text corpora or pre-trained models available. Understanding the raw material determines what embeddings are feasible. See [resources/methodology.md](resources/methodology.md) for the full taxonomy of embedding types. **Step 2: Determine task requirements and success criteria** Clarify the downstream task: entity retrieval, link prediction, question answering, node classification, recommendation, or subgraph matching. Each task favors different granularities and fusion approaches. Establish evaluation metrics (MRR, Hits@K, F1, latency budgets). See [resources/methodology.md](resources/methodology.md) for task-to-approach mapping and selection criteria. **Step 3: Select granularity level(s)** Choose which levels of the graph to embed using the [Granularity Selection Guide](#granularity-selection-guide). Many strategies combine multiple granularities (e.g., node embeddings for retrieval plus subgraph embeddings for re-ranking). See [resources/embedding-catalog.md](resources/embedding-catalog.md) for specific techniques at each level. **Step 4: Choose semantic embedding approach** Select how to capture text-based meaning: LLM encoder for rich contextual embeddings, Sentence-BERT for efficient sentence-level similarity, or text descriptions of neighborhoods for context-aware semantics. Match the approach to your computational budget and freshness requirements. See [resources/methodology.md](resources/methodology.md) for semantic approach details and trade-offs. **Step 5: Choose structural embedding approach** Select how to capture graph topology: Node2Vec for flexible neighborhood sampling, DeepWalk for uniform random walks, GraphSAGE for inductive learning on unseen nodes, or positional encodings for capturing graph roles. Match the approach to your graph density and update frequency. See [resources/embedding-catalog.md](resources/embedding-catalog.md) for the full structural technique catalog. **Step 6: Design fusion strategy** Combine semantic and structural embeddings using one of the [Fusion Approaches](#fusion-approaches). Key decisions: early vs. late fusion, alignment training, dimensionality management, and whether to maintain multiple vectors per entity. See [resources/methodology.md](resources/methodology.md) for detailed fusion design methodology, including dynamic vs. static trade-offs and storage considerations. **Step 7: Produce embedding strategy specification** Document the complete design using the [Output Template](#output-template). Include embedding dimensions, training procedures, indexing strategy, and update mechanisms. Self-assess using [resources/evaluators/rubric_embedding_strategy.json](resources/evaluators/rubric_embedding_strategy.json). Minimum standard: Average score >= 3.0. ## Granularity Selection Guide | Granularity | Description | Use Cases | |-------------|-------------|-----------| | **Node** | Embed individual entities combining their text attributes with local structural context | Entity retrieval, node classification, entity linking, recommendation | | **Edge** | Embed relationships including relation type, endpoint context, and edge properties | Link prediction, relation classification, triple verification | | **Path** | Embed sequences of nodes and edges capturing multi-hop patterns and metapath semantics | Multi-hop reasoning, pathway discovery, explainable retrieval | | **Subgraph** | Embed local neighborhoods (ego-networks, motifs) capturing community structure | Subgraph matching, anomaly detection, community-aware retrieval | | **Community** | Embed clusters or partitions summarizing high-level graph regions | Topic modeling, coarse-grained search, hierarchical navigation | ## Fusion Approaches ### Concatenation Combine semantic and structural vectors by concatenation: `v_fused = [v_semantic; v_structural]`. Simple and preserves all information, but doubles dimensionality and treats both signals as independent. **When to use**: Baseline approach, fast prototyping, when downstream model can learn weighting. ### Attention-Based Fusion Learn a weighting over semantic and structural components: `v_fused = alpha * v_semantic + (1 - alpha) * v_structural`, where alpha is learned per entity or per query. Allows the model to emphasize the most informative signal. **When to use**: When relative importance of semantic vs. structural varies across entities or queries. ### Contrastive Alignment Train semantic and structural embeddings to coincide for the same entity using contrastive loss (e.g., InfoNCE). Produces a shared embedding space where both views agree. Enables cross-modal retrieval. **When to use**: When you want a single unified space, cross-modal search, or when training data for alignment is available. ### Late Fusion / Re-Ranking Use bi-encoder (separate semantic and structural retrieval) followed by cross-encoder re-ranking that considers both signals jointly. Separates fast candidate generation from precise scoring. **When to use**: Large-scale retrieval where full fusion at query time is too expensive; when latency budget allows two-stage pipeline. ### Multi-Vector Representation Maintain multiple embeddings per entity (semantic facets, structural roles, contextual variants). Match queries against the most relevant facet using max-sim or attention pooling. **When to use**: Entities with multiple roles or meanings, faceted search, when a single vector loses too much information. ## Output Template ``` EMBEDDING STRATEGY SPECIFICATION ================================= Domain: [Knowledge graph domain and scale] Task: [Primary downstream task(s)] Success Metrics: [MRR, Hits@K, latency, etc.] Granularity Level(s): [Node / Edge / Path / Subgraph / Community] Semantic Approach: - Method: [LLM encoder / Sentence-BERT / Description-based / etc.] - Input: [What text is embedded] - Dimension: [embedding size] - Model: [specific model name/version] - Update frequency: [static / periodic / real-time] Structural Approach: - Method: [Node2Vec / DeepWalk / GraphSAGE / Positional / etc.] - Parameters: [walk length, dimensions, neighborhood size, etc.] - Dimension: [embedding size] - Update frequency: [static / periodic / incremental] Fusion Strategy: - Method: [Concatenation / Attention / Contrastive / Late Fusion / Multi-Vector] - Final dimension: [fused embedding size] - Alignment training: [loss function, training procedure if applicable] - Rationale: [why this fusion approach for this task] Indexing & Storage: - Index type: [HNSW / IVF / flat / etc.] - Vector database: [if applicable] - Approximate nearest neighbor parameters: [ef, nprobe, etc.] - Storage estimate: [total size] Update & Maintenance: - Recomputation strategy: [full retrain / incremental / streaming] - Staleness tolerance: [how old before recompute] - Incremental update mechanism: [if applicable] NEXT STEPS: - Implement embedding pipeline - Train fusion/alignment if applicable - Build ANN index and benchmark retrieval quality - Validate end-to-end on downstream task - Monitor embedding drift in production ```
More from lyndonkl/claude
- abstraction-concrete-examplesBuilds structured abstraction ladders that translate high-level principles into concrete, actionable examples across 3-5 levels. Bridges communication gaps, reveals hidden assumptions, and tests whether abstract ideas work in practice. Use when explaining concepts at different expertise levels, moving between abstract principles and concrete implementation, identifying edge cases by testing ideas against scenarios, designing layered documentation, decomposing complex problems into actionable steps, or bridging strategy-execution gaps.
- academic-letter-architectGuides the creation of evidence-based academic recommendation letters, reference letters, and award nominations that combine concrete examples, meaningful comparisons, and genuine enthusiasm. Use when writing recommendation letters for students, postdocs, or colleagues, or when user mentions recommendation letter, reference, nomination, letter of support, endorsement, or needs help with strong advocacy and comparative statements.
- adr-architectureDocuments significant architectural and technical decisions with full context, alternatives considered, trade-offs analyzed, and consequences understood. Creates a decision trail that helps teams understand why decisions were made. Use when choosing between technology options, making infrastructure decisions, establishing standards, migrating systems, or when user mentions ADR, architecture decision, technical decision record, or decision documentation.
- adverse-selection-priorProduces a Bayesian prior probability that an offered transaction is +EV for the recipient, given that the counterparty chose to propose it. Applies Akerlof market-for-lemons logic -- if they offered it, they believe it is +EV for them, so the prior that it is +EV for us is materially below 50%. Reusable across trade evaluation, waiver drops (another team dropping a player is also adverse selection), job-offer analysis, M&A, and any "someone offered me this" situation. Use when you receive an unsolicited trade/offer/proposal, analyzing incoming trade prior, evaluating why a counterparty proposed a deal, or when user mentions adverse selection, market for lemons, why did they offer this, incoming trade prior, they proposed it, Bayesian adjustment on received offer.
- alignment-values-north-starCreates actionable alignment frameworks that give teams a shared North Star (direction), values (guardrails), and decision tenets (behavioral standards). Enables autonomous decision-making while maintaining organizational coherence. Use when starting new teams, scaling organizations, defining culture, establishing product vision, resolving misalignment, creating strategic clarity, or when user mentions North Star, team values, mission, principles, guardrails, decision framework, or cultural alignment.
- analogy-weight-checkFor every analogy in a substacker draft, verifies it carries mechanical weight — the analogy does real work explaining the mechanism, not merely decorates it. Cross-references analogy-catalog.md for novelty (is this analogy reused from a prior post?) and domain fit (biology > organizational > sports preferred; physics/military disfavored). Use whenever an analogy appears in the draft. Trigger keywords: analogy weight, decorative, mechanical weight, reused analogy, catalog check, metaphor check.
- answer-uncomfortable-questionTakes one strategic question about substacker ("should we launch paid?", "is this section dead?", "are we writing for the wrong audience?") and produces the mandatory evidence + reasoning + downside triad plus a recommendation. Used 3 times per Growth Strategist review. Trigger keywords: uncomfortable question, strategic question, evidence reasoning downside, triad.
- attribute-performanceFor each substacker post that materially over- or under-performs the rolling baseline (|z| ≥ 1.0), produces a plain-English attribution paragraph with calibrated confidence (high / medium / low / unexplained). Considers subject-line effect, topic zeitgeist, external share, day-of-week, length effect, and audience-notes signals. Labels unexplained outliers explicitly rather than fabricating a story. Use after compute-baseline when outlier posts exist. Trigger keywords: attribution, why did this post work, outlier explanation, performance analysis.
- auction-first-price-shadingComputes the optimal shaded bid for a first-price sealed-bid auction given a true private value, an estimate of the number of competing bidders N, and a value-distribution assumption. Implements the `(N-1)/N` equilibrium shading rule for uniform private values, adjusts for log-normal or empirical value distributions, layers a risk-aversion adjustment, and caps output against the bidder's remaining budget. Domain-neutral auction theory reusable across fantasy sports (baseball FAAB, NBA/NHL waiver auctions), prediction-market limit sizing, sealed procurement bids, and any blind-bid context. Use when user mentions "first-price auction bid", "sealed bid shading", "(N-1)/N", "FAAB bid amount", "auction shading", "optimal bid first-price", "bid for sealed-bid", "blind bid sizing", or when downstream logic needs a principled shade factor rather than an ad-hoc heuristic.
- auction-winners-curse-haircutApplies a Bayesian haircut to a bid valuation for common-value auctions where winning is itself evidence the bidder over-estimated. Takes a raw valuation, a value-type classification (common_value / private_value / mixed), the number of informed bidders N, and a signal-dispersion estimate, and returns an adjusted valuation. Domain-neutral and reusable across fantasy FAAB, prediction markets, M&A bids, ad-auction budgets, and any generic bidding context. Use when user mentions "winner's curse", "common value auction", "valuation haircut", "adverse valuation", "Bayesian bid adjustment", or "over-paying in auction".