[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XDD5XQ6ZA3DYHFT82WQVMD":3,"skill-same:01M6XDD5XQ6ZA3DYHFT82WQVMD":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},"01M6XDD5XQ6ZA3DYHFT82WQVMD","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-no-skills\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-no-skills\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-no-skills\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-no-skills\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-no-skills\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-no-skills\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-no-skills\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-no-skills\u002Fmhc-layer-impl\u002Fenvironment\u002Fskills\u002Fmhc-algorithm\u002Freferences\u002Fsinkhorn-knopp.md",[87,96,111,132,153,171],{"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":92,"publishedAt":38},"01M6XEWMJ6VY3ZC53MPDCPG3GH","data-reconciliation","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fxlsx-recover-data\u002Fenvironment\u002Fskills\u002Fdata-reconciliation\u002FSKILL.md",[],[93,94,95],"data reconciliation","reconciliation","data",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"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",[],[103,104,105,106,107,108,109,110],"speech","text","speech to text","transcribe video","whisper","model","Video","transcribe",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"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",[],[109,118,119,120,121,122,21,123,124,125,126,127,128,129,130,35,131],"processor","video processor","batch","create","reels","parts","segments","process","videos","you","segment","filter","ffmpeg","remove",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"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",[],[139,140,141,142,21,127,143,144,145,146,147,124,148,149,109,150,151,152,35],"detector","silence detector","title","slides","time","energy","at","recordings","detect","find","Audio","analysis","start","setup",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"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",[],[128,160,109,161,162,163,164,22,21,165,166,124,127,167,168,35,169,170],"segment combiner","detection","prepare","merge","video processing","outputs","combine","processing","consolidate","results","list",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"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",[],[178,179,180,128,21,22,127,26,167,181,182,183,35,164,184,109,185,186,121],"generator","report generator","report","statistics","structured","reports","json","compression","generate"]