[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XEDE0KEG43F2J0RKGV4ME8":3,"skill-same:01M6XEDE0KEG43F2J0RKGV4ME8":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":13,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":6,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6XEDE0KEG43F2J0RKGV4ME8","mhc-algorithm",null,"Implement mHC (Manifold-Constrained Hyper-Connections) for stabilizing deep network training. Use when implementing residual connection improvements with doubly stochastic matrices via Sinkhorn-Knopp algorithm. Based on DeepSeek's 2025 paper (arXiv:2512.24880).","Waaaalnut\u002Fskillsbench","Waaaalnut","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F103995656?v=4","01M6XCS9K1V51EY3JMB7DGMX24","01M6XCS9Q4WPW88W62C55G1H44",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"mhc algorithm","via","hyper","when","for","implementing","manifold","connection","with","2025","implement","paper","matrices","deep","deepseek","connections","arxiv","use","network","training","2026-11-10 10:12:30",false,"---\nname: mhc-algorithm\ndescription: Implement mHC (Manifold-Constrained Hyper-Connections) for stabilizing deep network training. Use when implementing residual connection improvements with doubly stochastic matrices via Sinkhorn-Knopp algorithm. Based on DeepSeek's 2025 paper (arXiv:2512.24880).\n---\n\n# mHC: Manifold-Constrained Hyper-Connections\n\n## Overview\n\nmHC (Manifold-Constrained Hyper-Connections) stabilizes deep network training by constraining residual mixing matrices to be **doubly stochastic**. It provides:\n\n- **Stable Training**: Lower gradient norm variance via doubly stochastic constraints\n- **Multiple Streams**: Hyper-Connections with learnable mixing across residual streams\n- **Sinkhorn Projection**: Log-space Sinkhorn-Knopp algorithm for doubly stochastic projection\n- **GPT Integration**: Pattern for wrapping attention and MLP layers\n\nTwo components:\n- **HyperConnections Module**: Core PyTorch module with H_res, H_pre, H_post matrices\n- **Sinkhorn-Knopp**: Log-space projection to doubly stochastic manifold\n\n## Quick Reference\n\n| Topic | Reference |\n|-------|-----------|\n| Core Concepts & Math | [Core Concepts](references\u002Fcore-concepts.md) |\n| Sinkhorn Algorithm | [Sinkhorn-Knopp](references\u002Fsinkhorn-knopp.md) |\n| HyperConnections Module | [Module Implementation](references\u002Fmodule-implementation.md) |\n| GPT Integration | [GPT Integration](references\u002Fgpt-integration.md) |\n| Common Pitfalls | [Pitfalls](references\u002Fpitfalls.md) |\n\n## Installation\n\n```python\n# Required packages\npip install torch einops numpy\n```\n\n## Minimal Example\n\n```python\nimport torch\nimport torch.nn as nn\nfrom einops import rearrange, einsum\n\ndef sinkhorn_knopp(logits, num_iters=20, tau=0.05):\n    log_alpha = logits \u002F tau\n    for _ in range(num_iters):\n        log_alpha = log_alpha - torch.logsumexp(log_alpha, dim=-1, keepdim=True)\n        log_alpha = log_alpha - torch.logsumexp(log_alpha, dim=-2, keepdim=True)\n    return torch.exp(log_alpha)\n\nclass HyperConnections(nn.Module):\n    def __init__(self, num_streams, dim, branch=None, layer_idx=0):\n        super().__init__()\n        self.num_streams = num_streams\n        self.branch = branch\n\n        # Initialize H_res near identity (use small negative for gradient flow)\n        init_h_res = torch.full((num_streams, num_streams), -0.1)\n        init_h_res.fill_diagonal_(0.0)\n        self.H_res_logits = nn.Parameter(init_h_res)\n\n        # H_pre\u002FH_post for depth connections\n        init_h_pre = torch.full((1, num_streams), -0.1)\n        init_h_pre[0, layer_idx % num_streams] = 0.0\n        self.H_pre_logits = nn.Parameter(init_h_pre)\n        self.H_post_logits = nn.Parameter(torch.zeros(1, num_streams))\n\n    def forward(self, x):\n        s = self.num_streams\n        x = rearrange(x, \"(b s) t d -> b t s d\", s=s)\n\n        h_res = sinkhorn_knopp(self.H_res_logits)\n        x_mixed = einsum(h_res, x, \"s t, b n s d -> b n t d\")\n\n        h_pre = self.H_pre_logits.softmax(dim=-1)\n        branch_in = einsum(h_pre, x, \"v s, b n s d -> b n v d\").squeeze(-2)\n\n        branch_out = self.branch(branch_in) if self.branch else branch_in\n\n        h_post = self.H_post_logits.softmax(dim=-1)\n        depth_out = einsum(branch_out, h_post, \"b t d, v s -> b t s d\")\n\n        output = x_mixed + depth_out\n        return rearrange(output, \"b t s d -> (b s) t d\")\n```\n\n## Common Imports\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom einops import rearrange, einsum, repeat, reduce\n```\n\n## When to Use What\n\n| Scenario | Approach |\n|----------|----------|\n| Standard residual connection | No mHC needed |\n| Deep networks (>12 layers) with stability issues | Use mHC with num_streams=4 |\n| GPT\u002FTransformer training | Wrap both attention and MLP with HyperConnections |\n| Custom Sinkhorn iterations | Adjust num_iters (20 default) and tau (0.05 default) |\n| Memory-constrained training | Reduce num_streams or batch size |\n\n## External Resources\n\n- mHC Paper: https:\u002F\u002Farxiv.org\u002Fabs\u002F2512.24880\n- Hyper-Connections: https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.19606\n- Sinkhorn's Theorem: https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FSinkhorn%27s_theorem\n","# mHC: Manifold-Constrained Hyper-Connections\n\n## Overview\n\nmHC (Manifold-Constrained Hyper-Connections) stabilizes deep network training by constraining residual mixing matrices to be **doubly stochastic**. It provides:\n\n- **Stable Training**: Lower gradient norm variance via doubly stochastic constraints\n- **Multiple Streams**: Hyper-Connections with learnable mixing across residual streams\n- **Sinkhorn Projection**: Log-space Sinkhorn-Knopp algorithm for doubly stochastic projection\n- **GPT Integration**: Pattern for wrapping attention and MLP layers\n\nTwo components:\n- **HyperConnections Module**: Core PyTorch module with H_res, H_pre, H_post matrices\n- **Sinkhorn-Knopp**: Log-space projection to doubly stochastic manifold\n\n## Quick Reference\n\n| Topic | Reference |\n|-------|-----------|\n| Core Concepts & Math | [Core Concepts](references\u002Fcore-concepts.md) |\n| Sinkhorn Algorithm | [Sinkhorn-Knopp](references\u002Fsinkhorn-knopp.md) |\n| HyperConnections Module | [Module Implementation](references\u002Fmodule-implementation.md) |\n| GPT Integration | [GPT Integration](references\u002Fgpt-integration.md) |\n| Common Pitfalls | [Pitfalls](references\u002Fpitfalls.md) |\n\n## Installation\n\n```python\n# Required packages\npip install torch einops numpy\n```\n\n## Minimal Example\n\n```python\nimport torch\nimport torch.nn as nn\nfrom einops import rearrange, einsum\n\ndef sinkhorn_knopp(logits, num_iters=20, tau=0.05):\n    log_alpha = logits \u002F tau\n    for _ in range(num_iters):\n        log_alpha = log_alpha - torch.logsumexp(log_alpha, dim=-1, keepdim=True)\n        log_alpha = log_alpha - torch.logsumexp(log_alpha, dim=-2, keepdim=True)\n    return torch.exp(log_alpha)\n\nclass HyperConnections(nn.Module):\n    def __init__(self, num_streams, dim, branch=None, layer_idx=0):\n        super().__init__()\n        self.num_streams = num_streams\n        self.branch = branch\n\n        # Initialize H_res near identity (use small negative for gradient flow)\n        init_h_res = torch.full((num_streams, num_streams), -0.1)\n        init_h_res.fill_diagonal_(0.0)\n        self.H_res_logits = nn.Parameter(init_h_res)\n\n        # H_pre\u002FH_post for depth connections\n        init_h_pre = torch.full((1, num_streams), -0.1)\n        init_h_pre[0, layer_idx % num_streams] = 0.0\n        self.H_pre_logits = nn.Parameter(init_h_pre)\n        self.H_post_logits = nn.Parameter(torch.zeros(1, num_streams))\n\n    def forward(self, x):\n        s = self.num_streams\n        x = rearrange(x, \"(b s) t d -> b t s d\", s=s)\n\n        h_res = sinkhorn_knopp(self.H_res_logits)\n        x_mixed = einsum(h_res, x, \"s t, b n s d -> b n t d\")\n\n        h_pre = self.H_pre_logits.softmax(dim=-1)\n        branch_in = einsum(h_pre, x, \"v s, b n s d -> b n v d\").squeeze(-2)\n\n        branch_out = self.branch(branch_in) if self.branch else branch_in\n\n        h_post = self.H_post_logits.softmax(dim=-1)\n        depth_out = einsum(branch_out, h_post, \"b t d, v s -> b t s d\")\n\n        output = x_mixed + depth_out\n        return rearrange(output, \"b t s d -> (b s) t d\")\n```\n\n## Common Imports\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom einops import rearrange, einsum, repeat, reduce\n```\n\n## When to Use What\n\n| Scenario | Approach |\n|----------|----------|\n| Standard residual connection | No mHC needed |\n| Deep networks (>12 layers) with stability issues | Use mHC with num_streams=4 |\n| GPT\u002FTransformer training | Wrap both attention and MLP with HyperConnections |\n| Custom Sinkhorn iterations | Adjust num_iters (20 default) and tau (0.05 default) |\n| Memory-constrained training | Reduce num_streams or batch size |\n\n## External Resources\n\n- mHC Paper: https:\u002F\u002Farxiv.org\u002Fabs\u002F2512.24880\n- Hyper-Connections: https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.19606\n- Sinkhorn's Theorem: https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FSinkhorn%27s_theorem\n",{"name":5,"description":7},"main","7eeb258ada72b7f58119b0e7a2c00ea89d9beedd","tasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench","https:\u002F\u002Fgithub.com\u002FWaaaalnut","student of Zhejiang University","2026-04-21 23:16:23",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add Waaaalnut\u002Fskillsbench --skill mhc-algorithm",{"tool":56,"command":57},"bunx","bunx skills add Waaaalnut\u002Fskillsbench --skill mhc-algorithm",{"tool":59,"command":60},"pnpm","pnpm dlx skills add Waaaalnut\u002Fskillsbench --skill mhc-algorithm","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002FSKILL.md",true,[64,70,74,78,82],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fcore-concepts.md","REFERENCE","参考文档",1781,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fcore-concepts.md",{"path":71,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fgpt-integration.md",3004,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fgpt-integration.md",{"path":75,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fmodule-implementation.md",3432,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fmodule-implementation.md",{"path":79,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fpitfalls.md",3463,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fpitfalls.md",{"path":83,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fsinkhorn-knopp.md",2357,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fsinkhorn-knopp.md",[87,101,116,142,164,182],{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":97,"publishedAt":38},"01M6XEWMJ6VY3ZC53MPDCPG3GH","data-reconciliation","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fxlsx-recover-data\u002Fenvironment\u002Fskills\u002Fdata-reconciliation\u002FSKILL.md",[92],{"categoryNo":93,"categoryName":94,"taxonomyType":95,"taxonomyTypeDesc":96},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[98,99,100],"data reconciliation","reconciliation","data",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":38},"01M6XEW8MNPMF1KRXV6ATGFRQF","speech-to-text","Transcribe video to timestamped text using Whisper tiny model (pre-installed).","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-tutorial-indexer\u002Fenvironment\u002Fskills\u002Fspeech-to-text\u002FSKILL.md",[],[108,109,110,111,112,113,114,115],"speech","text","speech to text","transcribe video","whisper","model","Video","transcribe",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":127,"publishedAt":38},"01M6XEW3FQZP0T1RKQQJFXVY9T","video-processor","Process videos by removing segments and concatenating remaining parts. Use when you need to remove detected pauses\u002Fopenings from videos, create highlight reels, or batch process segment removals using ffmpeg filter_complex.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fvideo-processor\u002FSKILL.md",[122],{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[114,128,129,130,131,132,21,133,134,135,136,137,138,139,140,35,141],"processor","video processor","batch","create","reels","parts","segments","process","videos","you","segment","filter","ffmpeg","remove",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":149,"publishedAt":38},"01M6XEVXJ5KZ0NTY3XZKRY4AS1","silence-detector","Detect initial silence segments in audio\u002Fvideo using energy-based analysis. Use when you need to find low-energy periods at the start of recordings (title slides, setup time, pre-roll silence).","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fsilence-detector\u002FSKILL.md",[148],{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},[150,151,152,153,21,137,154,155,156,157,158,134,159,160,114,161,162,163,35],"detector","silence detector","title","slides","time","energy","at","recordings","detect","find","Audio","analysis","start","setup",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":38},"01M6XEVT3NGRN1FT7JPMAPXS6M","segment-combiner","Combine multiple segment detection results into a unified list. Use when you need to merge segments from different detectors, prepare removal lists for video processing, or consolidate detection outputs.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fsegment-combiner\u002FSKILL.md",[],[138,171,114,172,173,174,175,22,21,176,177,134,137,178,179,35,180,181],"segment combiner","detection","prepare","merge","video processing","outputs","combine","processing","consolidate","results","list",{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":191,"publishedAt":38},"01M6XEVMPVASGS2KX86QK4FMT7","report-generator","Generate compression reports for video processing. Use when you need to create structured JSON reports with duration statistics, compression ratios, and segment details after video processing.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Freport-generator\u002FSKILL.md",[188],{"categoryNo":189,"categoryName":190,"taxonomyType":95,"taxonomyTypeDesc":96},"01JBSEEDCAT000000000000034","行政与办公人员",[192,193,194,138,21,22,137,26,178,195,196,197,35,175,198,114,199,200,131],"generator","report generator","report","statistics","structured","reports","json","compression","generate"]