[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QN7GW3JWPM04GAD43WNTSF":3,"skill-same:01M6QN7GW3JWPM04GAD43WNTSF":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":14,"repositoryHtmlUrl":64,"repositoryHomepageUrl":65,"ownerHtmlUrl":66,"ownerBlogUrl":67,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6QN7GW3JWPM04GAD43WNTSF","model-merging",null,"Merge multiple fine-tuned models using mergekit to combine capabilities without retraining. Use when creating specialized models by blending domain-specific expertise (math + coding + chat), improving performance beyond single models, or experimenting rapidly with model variants. Covers SLERP, TIES-Merging, DARE, Task Arithmetic, linear merging, and production deployment strategies.","Tashima-Tarsh\u002FDisha6.6","Tashima-Tarsh","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F269906498?v=4","01M6PBH98X03XERH0HFT4PFB1P","NITISH KUMAR","01M6PBH9DA0M6KM3Z12P848F0K",0,"MIT","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fqc-model-merging\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"model","Model Merging","deployment strategies","capability","variants","combine","Emerging Techniques","fusion","strategies","chat","domain","performance","models","use","specialized","math","coding","capabilities","deployment","research","2026-11-10 10:12:30",false,"---\nname: model-merging\ndescription: Merge multiple fine-tuned models using mergekit to combine capabilities without retraining. Use when creating specialized models by blending domain-specific expertise (math + coding + chat), improving performance beyond single models, or experimenting rapidly with model variants. Covers SLERP, TIES-Merging, DARE, Task Arithmetic, linear merging, and production deployment strategies.\nversion: 1.0.0\nauthor: Orchestra Research\nlicense: MIT\ntags: [Emerging Techniques, Model Merging, Mergekit, SLERP, TIES, DARE, Task Arithmetic, Model Fusion, No Retraining, Multi-Capability, Arcee AI]\ndependencies: [mergekit, transformers, torch]\ncategory: \"ai-research\"\n---\n\n# Model Merging: Combining Pre-trained Models\n\n## When to Use This Skill\n\nUse Model Merging when you need to:\n- **Combine capabilities** from multiple fine-tuned models without retraining\n- **Create specialized models** by blending domain-specific expertise (math + coding + chat)\n- **Improve performance** beyond single models (often +5-10% on benchmarks)\n- **Reduce training costs** - no GPUs needed, merges run on CPU\n- **Experiment rapidly** - create new model variants in minutes, not days\n- **Preserve multiple skills** - merge without catastrophic forgetting\n\n**Success Stories**: Marcoro14-7B-slerp (best on Open LLM Leaderboard 02\u002F2024), many top HuggingFace models use merging\n\n**Tools**: mergekit (Arcee AI), LazyMergekit, Model Soup\n\n## Installation\n\n```bash\n# Install mergekit\ngit clone https:\u002F\u002Fgithub.com\u002Farcee-ai\u002Fmergekit.git\ncd mergekit\npip install -e .\n\n# Or via pip\npip install mergekit\n\n# Optional: Transformer library\npip install transformers torch\n```\n\n## Quick Start\n\n### Simple Linear Merge\n\n```yaml\n# config.yml - Merge two models with equal weights\nmerge_method: linear\nmodels:\n  - model: mistralai\u002FMistral-7B-v0.1\n    parameters:\n      weight: 0.5\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      weight: 0.5\ndtype: bfloat16\n```\n\n```bash\n# Run merge\nmergekit-yaml config.yml .\u002Fmerged-model --cuda\n\n# Use merged model\npython -m transformers.models.auto --model_name_or_path .\u002Fmerged-model\n```\n\n### SLERP Merge (Best for 2 Models)\n\n```yaml\n# config.yml - Spherical interpolation\nmerge_method: slerp\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 32]\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [0, 32]\nparameters:\n  t: 0.5  # Interpolation factor (0=model1, 1=model2)\ndtype: bfloat16\n```\n\n## Core Concepts\n\n### 1. Merge Methods\n\n**Linear (Model Soup)**\n- Simple weighted average of parameters\n- Fast, works well for similar models\n- Can merge 2+ models\n\n```python\nmerged_weights = w1 * model1_weights + w2 * model2_weights + w3 * model3_weights\n# where w1 + w2 + w3 = 1\n```\n\n**SLERP (Spherical Linear Interpolation)**\n- Interpolates along sphere in weight space\n- Preserves magnitude of weight vectors\n- Best for merging 2 models\n- Smoother than linear\n\n```python\n# SLERP formula\nmerged = (sin((1-t)*θ) \u002F sin(θ)) * model1 + (sin(t*θ) \u002F sin(θ)) * model2\n# where θ = arccos(dot(model1, model2))\n# t ∈ [0, 1]\n```\n\n**Task Arithmetic**\n- Extract \"task vectors\" (fine-tuned - base)\n- Combine task vectors, add to base\n- Good for merging multiple specialized models\n\n```python\n# Task vector\ntask_vector = finetuned_model - base_model\n\n# Merge multiple task vectors\nmerged = base_model + α₁*task_vector₁ + α₂*task_vector₂\n```\n\n**TIES-Merging**\n- Task arithmetic + sparsification\n- Resolves sign conflicts in parameters\n- Best for merging many task-specific models\n\n**DARE (Drop And REscale)**\n- Randomly drops fine-tuned parameters\n- Rescales remaining parameters\n- Reduces redundancy, maintains performance\n\n### 2. Configuration Structure\n\n```yaml\n# Basic structure\nmerge_method: \u003Cmethod>  # linear, slerp, ties, dare_ties, task_arithmetic\nbase_model: \u003Cpath>      # Optional: base model for task arithmetic\n\nmodels:\n  - model: \u003Cpath\u002Fto\u002Fmodel1>\n    parameters:\n      weight: \u003Cfloat>   # Merge weight\n      density: \u003Cfloat>  # For TIES\u002FDARE\n\n  - model: \u003Cpath\u002Fto\u002Fmodel2>\n    parameters:\n      weight: \u003Cfloat>\n\nparameters:\n  # Method-specific parameters\n\ndtype: \u003Cdtype>  # bfloat16, float16, float32\n\n# Optional\nslices:  # Layer-wise merging\ntokenizer:  # Tokenizer configuration\n```\n\n## Merge Methods Guide\n\n### Linear Merge\n\n**Best for**: Simple model combinations, equal weighting\n\n```yaml\nmerge_method: linear\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      weight: 0.4\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      weight: 0.3\n  - model: NousResearch\u002FNous-Hermes-2-Mistral-7B-DPO\n    parameters:\n      weight: 0.3\ndtype: bfloat16\n```\n\n### SLERP Merge\n\n**Best for**: Two models, smooth interpolation\n\n```yaml\nmerge_method: slerp\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 32]\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [0, 32]\nparameters:\n  t: 0.5  # 0.0 = first model, 1.0 = second model\ndtype: bfloat16\n```\n\n**Layer-specific SLERP:**\n\n```yaml\nmerge_method: slerp\nslices:\n  - sources:\n      - model: model_a\n        layer_range: [0, 32]\n      - model: model_b\n        layer_range: [0, 32]\nparameters:\n  t:\n    - filter: self_attn    # Attention layers\n      value: 0.3\n    - filter: mlp          # MLP layers\n      value: 0.7\n    - value: 0.5           # Default for other layers\ndtype: bfloat16\n```\n\n### Task Arithmetic\n\n**Best for**: Combining specialized skills\n\n```yaml\nmerge_method: task_arithmetic\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1  # Math\n    parameters:\n      weight: 0.5\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B  # Chat\n    parameters:\n      weight: 0.3\n  - model: ajibawa-2023\u002FCode-Mistral-7B  # Code\n    parameters:\n      weight: 0.2\ndtype: bfloat16\n```\n\n### TIES-Merging\n\n**Best for**: Many models, resolving conflicts\n\n```yaml\nmerge_method: ties\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      density: 0.5  # Keep top 50% of parameters\n      weight: 1.0\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      density: 0.5\n      weight: 1.0\n  - model: NousResearch\u002FNous-Hermes-2-Mistral-7B-DPO\n    parameters:\n      density: 0.5\n      weight: 1.0\nparameters:\n  normalize: true\ndtype: bfloat16\n```\n\n### DARE Merge\n\n**Best for**: Reducing redundancy\n\n```yaml\nmerge_method: dare_ties\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      density: 0.5    # Drop 50% of deltas\n      weight: 0.6\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      density: 0.5\n      weight: 0.4\nparameters:\n  int8_mask: true  # Use int8 for masks (saves memory)\ndtype: bfloat16\n```\n\n## Advanced Patterns\n\n### Layer-wise Merging\n\n```yaml\n# Different models for different layers\nmerge_method: passthrough\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 16]   # First half\n  - sources:\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [16, 32]  # Second half\ndtype: bfloat16\n```\n\n### MoE from Merged Models\n\n```yaml\n# Create Mixture of Experts\nmerge_method: moe\nbase_model: mistralai\u002FMistral-7B-v0.1\nexperts:\n  - source_model: WizardLM\u002FWizardMath-7B-V1.1\n    positive_prompts:\n      - \"math\"\n      - \"calculate\"\n  - source_model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    positive_prompts:\n      - \"chat\"\n      - \"conversation\"\n  - source_model: ajibawa-2023\u002FCode-Mistral-7B\n    positive_prompts:\n      - \"code\"\n      - \"python\"\ndtype: bfloat16\n```\n\n### Tokenizer Merging\n\n```yaml\nmerge_method: linear\nmodels:\n  - model: mistralai\u002FMistral-7B-v0.1\n  - model: custom\u002Fspecialized-model\n\ntokenizer:\n  source: \"union\"  # Combine vocabularies from both models\n  tokens:\n    \u003C|special_token|>:\n      source: \"custom\u002Fspecialized-model\"\n```\n\n## Best Practices\n\n### 1. Model Compatibility\n\n```python\n# ✅ Good: Same architecture\nmodels = [\n    \"mistralai\u002FMistral-7B-v0.1\",\n    \"teknium\u002FOpenHermes-2.5-Mistral-7B\",  # Both Mistral 7B\n]\n\n# ❌ Bad: Different architectures\nmodels = [\n    \"meta-llama\u002FLlama-2-7b-hf\",  # Llama\n    \"mistralai\u002FMistral-7B-v0.1\",  # Mistral (incompatible!)\n]\n```\n\n### 2. Weight Selection\n\n```yaml\n# ✅ Good: Weights sum to 1.0\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.6\n  - model: model_b\n    parameters:\n      weight: 0.4  # 0.6 + 0.4 = 1.0\n\n# ⚠️  Acceptable: Weights don't sum to 1 (for task arithmetic)\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.8\n  - model: model_b\n    parameters:\n      weight: 0.8  # May boost performance\n```\n\n### 3. Method Selection\n\n```python\n# Choose merge method based on use case:\n\n# 2 models, smooth blend → SLERP\nmerge_method = \"slerp\"\n\n# 3+ models, simple average → Linear\nmerge_method = \"linear\"\n\n# Multiple task-specific models → Task Arithmetic or TIES\nmerge_method = \"ties\"\n\n# Want to reduce redundancy → DARE\nmerge_method = \"dare_ties\"\n```\n\n### 4. Density Tuning (TIES\u002FDARE)\n\n```yaml\n# Start conservative (keep more parameters)\nparameters:\n  density: 0.8  # Keep 80%\n\n# If performance good, increase sparsity\nparameters:\n  density: 0.5  # Keep 50%\n\n# If performance degrades, reduce sparsity\nparameters:\n  density: 0.9  # Keep 90%\n```\n\n### 5. Layer-specific Merging\n\n```yaml\n# Preserve base model's beginning and end\nmerge_method: passthrough\nslices:\n  - sources:\n      - model: base_model\n        layer_range: [0, 2]     # Keep first layers\n  - sources:\n      - model: merged_middle    # Merge middle layers\n        layer_range: [2, 30]\n  - sources:\n      - model: base_model\n        layer_range: [30, 32]   # Keep last layers\n```\n\n## Evaluation & Testing\n\n### Benchmark Merged Models\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load merged model\nmodel = AutoModelForCausalLM.from_pretrained(\".\u002Fmerged-model\")\ntokenizer = AutoTokenizer.from_pretrained(\".\u002Fmerged-model\")\n\n# Test on various tasks\ntest_prompts = {\n    \"math\": \"Calculate: 25 * 17 =\",\n    \"code\": \"Write a Python function to reverse a string:\",\n    \"chat\": \"What is the capital of France?\",\n}\n\nfor task, prompt in test_prompts.items():\n    inputs = tokenizer(prompt, return_tensors=\"pt\")\n    outputs = model.generate(**inputs, max_length=100)\n    print(f\"{task}: {tokenizer.decode(outputs[0])}\")\n```\n\n### Common Benchmarks\n\n- **Open LLM Leaderboard**: General capabilities\n- **MT-Bench**: Multi-turn conversation\n- **MMLU**: Multitask accuracy\n- **HumanEval**: Code generation\n- **GSM8K**: Math reasoning\n\n## Production Deployment\n\n### Save and Upload\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load merged model\nmodel = AutoModelForCausalLM.from_pretrained(\".\u002Fmerged-model\")\ntokenizer = AutoTokenizer.from_pretrained(\".\u002Fmerged-model\")\n\n# Upload to HuggingFace Hub\nmodel.push_to_hub(\"username\u002Fmy-merged-model\")\ntokenizer.push_to_hub(\"username\u002Fmy-merged-model\")\n```\n\n### Quantize Merged Model\n\n```bash\n# Quantize with GGUF\npython convert.py .\u002Fmerged-model --outtype f16 --outfile merged-model.gguf\n\n# Quantize with GPTQ\npython quantize_gptq.py .\u002Fmerged-model --bits 4 --group_size 128\n```\n\n## Common Pitfalls\n\n### ❌ Pitfall 1: Merging Incompatible Models\n\n```yaml\n# Wrong: Different architectures\nmodels:\n  - model: meta-llama\u002FLlama-2-7b  # Llama architecture\n  - model: mistralai\u002FMistral-7B   # Mistral architecture\n```\n\n**Fix**: Only merge models with same architecture\n\n### ❌ Pitfall 2: Over-weighting One Model\n\n```yaml\n# Suboptimal: One model dominates\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.95  # Too high\n  - model: model_b\n    parameters:\n      weight: 0.05  # Too low\n```\n\n**Fix**: Use more balanced weights (0.3-0.7 range)\n\n### ❌ Pitfall 3: Not Evaluating\n\n```bash\n# Wrong: Merge and deploy without testing\nmergekit-yaml config.yml .\u002Fmerged-model\n# Deploy immediately (risky!)\n```\n\n**Fix**: Always benchmark before deploying\n\n## Resources\n\n- **mergekit GitHub**: https:\u002F\u002Fgithub.com\u002Farcee-ai\u002Fmergekit\n- **HuggingFace Tutorial**: https:\u002F\u002Fhuggingface.co\u002Fblog\u002Fmlabonne\u002Fmerge-models\n- **LazyMergekit**: Automated merging notebook\n- **TIES Paper**: https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.01708\n- **DARE Paper**: https:\u002F\u002Farxiv.org\u002Fabs\u002F2311.03099\n\n## See Also\n\n- `references\u002Fmethods.md` - Deep dive into merge algorithms\n- `references\u002Fexamples.md` - Real-world merge configurations\n- `references\u002Fevaluation.md` - Benchmarking and testing strategies\n\n\n","# Model Merging: Combining Pre-trained Models\n\n## When to Use This Skill\n\nUse Model Merging when you need to:\n- **Combine capabilities** from multiple fine-tuned models without retraining\n- **Create specialized models** by blending domain-specific expertise (math + coding + chat)\n- **Improve performance** beyond single models (often +5-10% on benchmarks)\n- **Reduce training costs** - no GPUs needed, merges run on CPU\n- **Experiment rapidly** - create new model variants in minutes, not days\n- **Preserve multiple skills** - merge without catastrophic forgetting\n\n**Success Stories**: Marcoro14-7B-slerp (best on Open LLM Leaderboard 02\u002F2024), many top HuggingFace models use merging\n\n**Tools**: mergekit (Arcee AI), LazyMergekit, Model Soup\n\n## Installation\n\n```bash\n# Install mergekit\ngit clone https:\u002F\u002Fgithub.com\u002Farcee-ai\u002Fmergekit.git\ncd mergekit\npip install -e .\n\n# Or via pip\npip install mergekit\n\n# Optional: Transformer library\npip install transformers torch\n```\n\n## Quick Start\n\n### Simple Linear Merge\n\n```yaml\n# config.yml - Merge two models with equal weights\nmerge_method: linear\nmodels:\n  - model: mistralai\u002FMistral-7B-v0.1\n    parameters:\n      weight: 0.5\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      weight: 0.5\ndtype: bfloat16\n```\n\n```bash\n# Run merge\nmergekit-yaml config.yml .\u002Fmerged-model --cuda\n\n# Use merged model\npython -m transformers.models.auto --model_name_or_path .\u002Fmerged-model\n```\n\n### SLERP Merge (Best for 2 Models)\n\n```yaml\n# config.yml - Spherical interpolation\nmerge_method: slerp\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 32]\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [0, 32]\nparameters:\n  t: 0.5  # Interpolation factor (0=model1, 1=model2)\ndtype: bfloat16\n```\n\n## Core Concepts\n\n### 1. Merge Methods\n\n**Linear (Model Soup)**\n- Simple weighted average of parameters\n- Fast, works well for similar models\n- Can merge 2+ models\n\n```python\nmerged_weights = w1 * model1_weights + w2 * model2_weights + w3 * model3_weights\n# where w1 + w2 + w3 = 1\n```\n\n**SLERP (Spherical Linear Interpolation)**\n- Interpolates along sphere in weight space\n- Preserves magnitude of weight vectors\n- Best for merging 2 models\n- Smoother than linear\n\n```python\n# SLERP formula\nmerged = (sin((1-t)*θ) \u002F sin(θ)) * model1 + (sin(t*θ) \u002F sin(θ)) * model2\n# where θ = arccos(dot(model1, model2))\n# t ∈ [0, 1]\n```\n\n**Task Arithmetic**\n- Extract \"task vectors\" (fine-tuned - base)\n- Combine task vectors, add to base\n- Good for merging multiple specialized models\n\n```python\n# Task vector\ntask_vector = finetuned_model - base_model\n\n# Merge multiple task vectors\nmerged = base_model + α₁*task_vector₁ + α₂*task_vector₂\n```\n\n**TIES-Merging**\n- Task arithmetic + sparsification\n- Resolves sign conflicts in parameters\n- Best for merging many task-specific models\n\n**DARE (Drop And REscale)**\n- Randomly drops fine-tuned parameters\n- Rescales remaining parameters\n- Reduces redundancy, maintains performance\n\n### 2. Configuration Structure\n\n```yaml\n# Basic structure\nmerge_method: \u003Cmethod>  # linear, slerp, ties, dare_ties, task_arithmetic\nbase_model: \u003Cpath>      # Optional: base model for task arithmetic\n\nmodels:\n  - model: \u003Cpath\u002Fto\u002Fmodel1>\n    parameters:\n      weight: \u003Cfloat>   # Merge weight\n      density: \u003Cfloat>  # For TIES\u002FDARE\n\n  - model: \u003Cpath\u002Fto\u002Fmodel2>\n    parameters:\n      weight: \u003Cfloat>\n\nparameters:\n  # Method-specific parameters\n\ndtype: \u003Cdtype>  # bfloat16, float16, float32\n\n# Optional\nslices:  # Layer-wise merging\ntokenizer:  # Tokenizer configuration\n```\n\n## Merge Methods Guide\n\n### Linear Merge\n\n**Best for**: Simple model combinations, equal weighting\n\n```yaml\nmerge_method: linear\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      weight: 0.4\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      weight: 0.3\n  - model: NousResearch\u002FNous-Hermes-2-Mistral-7B-DPO\n    parameters:\n      weight: 0.3\ndtype: bfloat16\n```\n\n### SLERP Merge\n\n**Best for**: Two models, smooth interpolation\n\n```yaml\nmerge_method: slerp\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 32]\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [0, 32]\nparameters:\n  t: 0.5  # 0.0 = first model, 1.0 = second model\ndtype: bfloat16\n```\n\n**Layer-specific SLERP:**\n\n```yaml\nmerge_method: slerp\nslices:\n  - sources:\n      - model: model_a\n        layer_range: [0, 32]\n      - model: model_b\n        layer_range: [0, 32]\nparameters:\n  t:\n    - filter: self_attn    # Attention layers\n      value: 0.3\n    - filter: mlp          # MLP layers\n      value: 0.7\n    - value: 0.5           # Default for other layers\ndtype: bfloat16\n```\n\n### Task Arithmetic\n\n**Best for**: Combining specialized skills\n\n```yaml\nmerge_method: task_arithmetic\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1  # Math\n    parameters:\n      weight: 0.5\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B  # Chat\n    parameters:\n      weight: 0.3\n  - model: ajibawa-2023\u002FCode-Mistral-7B  # Code\n    parameters:\n      weight: 0.2\ndtype: bfloat16\n```\n\n### TIES-Merging\n\n**Best for**: Many models, resolving conflicts\n\n```yaml\nmerge_method: ties\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      density: 0.5  # Keep top 50% of parameters\n      weight: 1.0\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      density: 0.5\n      weight: 1.0\n  - model: NousResearch\u002FNous-Hermes-2-Mistral-7B-DPO\n    parameters:\n      density: 0.5\n      weight: 1.0\nparameters:\n  normalize: true\ndtype: bfloat16\n```\n\n### DARE Merge\n\n**Best for**: Reducing redundancy\n\n```yaml\nmerge_method: dare_ties\nbase_model: mistralai\u002FMistral-7B-v0.1\nmodels:\n  - model: WizardLM\u002FWizardMath-7B-V1.1\n    parameters:\n      density: 0.5    # Drop 50% of deltas\n      weight: 0.6\n  - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    parameters:\n      density: 0.5\n      weight: 0.4\nparameters:\n  int8_mask: true  # Use int8 for masks (saves memory)\ndtype: bfloat16\n```\n\n## Advanced Patterns\n\n### Layer-wise Merging\n\n```yaml\n# Different models for different layers\nmerge_method: passthrough\nslices:\n  - sources:\n      - model: mistralai\u002FMistral-7B-v0.1\n        layer_range: [0, 16]   # First half\n  - sources:\n      - model: teknium\u002FOpenHermes-2.5-Mistral-7B\n        layer_range: [16, 32]  # Second half\ndtype: bfloat16\n```\n\n### MoE from Merged Models\n\n```yaml\n# Create Mixture of Experts\nmerge_method: moe\nbase_model: mistralai\u002FMistral-7B-v0.1\nexperts:\n  - source_model: WizardLM\u002FWizardMath-7B-V1.1\n    positive_prompts:\n      - \"math\"\n      - \"calculate\"\n  - source_model: teknium\u002FOpenHermes-2.5-Mistral-7B\n    positive_prompts:\n      - \"chat\"\n      - \"conversation\"\n  - source_model: ajibawa-2023\u002FCode-Mistral-7B\n    positive_prompts:\n      - \"code\"\n      - \"python\"\ndtype: bfloat16\n```\n\n### Tokenizer Merging\n\n```yaml\nmerge_method: linear\nmodels:\n  - model: mistralai\u002FMistral-7B-v0.1\n  - model: custom\u002Fspecialized-model\n\ntokenizer:\n  source: \"union\"  # Combine vocabularies from both models\n  tokens:\n    \u003C|special_token|>:\n      source: \"custom\u002Fspecialized-model\"\n```\n\n## Best Practices\n\n### 1. Model Compatibility\n\n```python\n# ✅ Good: Same architecture\nmodels = [\n    \"mistralai\u002FMistral-7B-v0.1\",\n    \"teknium\u002FOpenHermes-2.5-Mistral-7B\",  # Both Mistral 7B\n]\n\n# ❌ Bad: Different architectures\nmodels = [\n    \"meta-llama\u002FLlama-2-7b-hf\",  # Llama\n    \"mistralai\u002FMistral-7B-v0.1\",  # Mistral (incompatible!)\n]\n```\n\n### 2. Weight Selection\n\n```yaml\n# ✅ Good: Weights sum to 1.0\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.6\n  - model: model_b\n    parameters:\n      weight: 0.4  # 0.6 + 0.4 = 1.0\n\n# ⚠️  Acceptable: Weights don't sum to 1 (for task arithmetic)\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.8\n  - model: model_b\n    parameters:\n      weight: 0.8  # May boost performance\n```\n\n### 3. Method Selection\n\n```python\n# Choose merge method based on use case:\n\n# 2 models, smooth blend → SLERP\nmerge_method = \"slerp\"\n\n# 3+ models, simple average → Linear\nmerge_method = \"linear\"\n\n# Multiple task-specific models → Task Arithmetic or TIES\nmerge_method = \"ties\"\n\n# Want to reduce redundancy → DARE\nmerge_method = \"dare_ties\"\n```\n\n### 4. Density Tuning (TIES\u002FDARE)\n\n```yaml\n# Start conservative (keep more parameters)\nparameters:\n  density: 0.8  # Keep 80%\n\n# If performance good, increase sparsity\nparameters:\n  density: 0.5  # Keep 50%\n\n# If performance degrades, reduce sparsity\nparameters:\n  density: 0.9  # Keep 90%\n```\n\n### 5. Layer-specific Merging\n\n```yaml\n# Preserve base model's beginning and end\nmerge_method: passthrough\nslices:\n  - sources:\n      - model: base_model\n        layer_range: [0, 2]     # Keep first layers\n  - sources:\n      - model: merged_middle    # Merge middle layers\n        layer_range: [2, 30]\n  - sources:\n      - model: base_model\n        layer_range: [30, 32]   # Keep last layers\n```\n\n## Evaluation & Testing\n\n### Benchmark Merged Models\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load merged model\nmodel = AutoModelForCausalLM.from_pretrained(\".\u002Fmerged-model\")\ntokenizer = AutoTokenizer.from_pretrained(\".\u002Fmerged-model\")\n\n# Test on various tasks\ntest_prompts = {\n    \"math\": \"Calculate: 25 * 17 =\",\n    \"code\": \"Write a Python function to reverse a string:\",\n    \"chat\": \"What is the capital of France?\",\n}\n\nfor task, prompt in test_prompts.items():\n    inputs = tokenizer(prompt, return_tensors=\"pt\")\n    outputs = model.generate(**inputs, max_length=100)\n    print(f\"{task}: {tokenizer.decode(outputs[0])}\")\n```\n\n### Common Benchmarks\n\n- **Open LLM Leaderboard**: General capabilities\n- **MT-Bench**: Multi-turn conversation\n- **MMLU**: Multitask accuracy\n- **HumanEval**: Code generation\n- **GSM8K**: Math reasoning\n\n## Production Deployment\n\n### Save and Upload\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load merged model\nmodel = AutoModelForCausalLM.from_pretrained(\".\u002Fmerged-model\")\ntokenizer = AutoTokenizer.from_pretrained(\".\u002Fmerged-model\")\n\n# Upload to HuggingFace Hub\nmodel.push_to_hub(\"username\u002Fmy-merged-model\")\ntokenizer.push_to_hub(\"username\u002Fmy-merged-model\")\n```\n\n### Quantize Merged Model\n\n```bash\n# Quantize with GGUF\npython convert.py .\u002Fmerged-model --outtype f16 --outfile merged-model.gguf\n\n# Quantize with GPTQ\npython quantize_gptq.py .\u002Fmerged-model --bits 4 --group_size 128\n```\n\n## Common Pitfalls\n\n### ❌ Pitfall 1: Merging Incompatible Models\n\n```yaml\n# Wrong: Different architectures\nmodels:\n  - model: meta-llama\u002FLlama-2-7b  # Llama architecture\n  - model: mistralai\u002FMistral-7B   # Mistral architecture\n```\n\n**Fix**: Only merge models with same architecture\n\n### ❌ Pitfall 2: Over-weighting One Model\n\n```yaml\n# Suboptimal: One model dominates\nmodels:\n  - model: model_a\n    parameters:\n      weight: 0.95  # Too high\n  - model: model_b\n    parameters:\n      weight: 0.05  # Too low\n```\n\n**Fix**: Use more balanced weights (0.3-0.7 range)\n\n### ❌ Pitfall 3: Not Evaluating\n\n```bash\n# Wrong: Merge and deploy without testing\nmergekit-yaml config.yml .\u002Fmerged-model\n# Deploy immediately (risky!)\n```\n\n**Fix**: Always benchmark before deploying\n\n## Resources\n\n- **mergekit GitHub**: https:\u002F\u002Fgithub.com\u002Farcee-ai\u002Fmergekit\n- **HuggingFace Tutorial**: https:\u002F\u002Fhuggingface.co\u002Fblog\u002Fmlabonne\u002Fmerge-models\n- **LazyMergekit**: Automated merging notebook\n- **TIES Paper**: https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.01708\n- **DARE Paper**: https:\u002F\u002Farxiv.org\u002Fabs\u002F2311.03099\n\n## See Also\n\n- `references\u002Fmethods.md` - Deep dive into merge algorithms\n- `references\u002Fexamples.md` - Real-world merge configurations\n- `references\u002Fevaluation.md` - Benchmarking and testing strategies\n\n\n",{"name":5,"tags":44,"author":54,"license":15,"version":55,"category":56,"description":7,"dependencies":57},[25,20,45,46,47,48,49,50,51,52,53],"Mergekit","SLERP","TIES","DARE","Task Arithmetic","Model Fusion","No Retraining","Multi-Capability","Arcee AI","Orchestra Research","1.0.0","ai-research",[58,59,60],"mergekit","transformers","torch","main","0da4485785ee599388900be50db1635489d53056",".agents\u002Fskills\u002Fqc-model-merging","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6","https:\u002F\u002Fdisha6.6.thenitishkr.in\u002F","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh","www.thenitishkr","thenitishkr | AI • Cyber-security • Research\r\n","2026-11-08 03:33:25",{"source":8,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add Tashima-Tarsh\u002FDisha6.6 --skill model-merging",{"tool":76,"command":77},"bunx","bunx skills add Tashima-Tarsh\u002FDisha6.6 --skill model-merging",{"tool":79,"command":80},"pnpm","pnpm dlx skills add Tashima-Tarsh\u002FDisha6.6 --skill model-merging","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fqc-model-merging\u002FSKILL.md",true,[84,90,94],{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fevaluation.md","REFERENCE","参考文档",11705,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fqc-model-merging\u002Freferences\u002Fevaluation.md",{"path":91,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fexamples.md",8813,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fqc-model-merging\u002Freferences\u002Fexamples.md",{"path":95,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fmethods.md",9562,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fqc-model-merging\u002Freferences\u002Fmethods.md",[99,131,154,181,205,229],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":110,"publishedAt":39},"01M6QRD07D4TGNDK6VJ4EHF8BV","youtube-full","Use when the user needs YouTube transcripts, video search, channel browsing, playlist extraction, or content monitoring. Trigger phrases: 'get the transcript for', 'search YouTube for', 'what are the latest videos on', 'list this playlist', 'monitor this channel', or any request involving a YouTube URL, video ID, or @handle. Do NOT use for downloading video or audio files, YouTube engagement data (likes, comments), or private\u002Fage-restricted videos.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-full\u002FSKILL.md",[105],{"categoryNo":106,"categoryName":107,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130],"youtube full","youtube","full","transcript","search","monitoring","data","Video","Audio","list","files","do","get","age","trigger","URL","for","browsing","request","youtube transcripts",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":39},"01M6QRCJ3112VYPA97YG7KGMC2","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[138,139,140,38,115,141,142,143,144,145,146,147,148,149,32,150,151,152,153,127],"twitter","x twitter growth","growth","content","engineering","plan","web search","competitors","analyze","engine","write","strategy","platform","grow","posting","competitive",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":163,"publishedAt":39},"01M6QRBN3EHQNJY42RERP7A149","write-a-skill","Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, build, or author a new skill.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[160],{"categoryNo":161,"categoryName":162,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000023","Skill与智能体开发",[164,148,165,166,167,168,169,170,32,171,172,61,173,174,175,176,177,178,179,180],"write a skill","github","create","https","productivity","matt pocock","direct","example","build","new skill","structure","new agent","resources","with","tree","progressive disclosure","author",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":39},"01M6QRB6G8P33PNGAF9Y69EJ9T","wrap-up","Close out a launched Claude Managed Agent — recap every primitive the founder now owns, regenerate the single-file overview page, and suggest the next 1-2 upgrades. Use when the user says \"wrap up\", \"close this out\", \"what do I own now\", \"give me the summary\", \"recap the agent\", or when the orchestrator routes phase=wrap-up. primitives_inventory.py tables everything owned (agent, environment, session, memory, outcome, deployment); overview_page.py regenerates a self-contained .\u002Fmy-agent\u002Fagent-overview.html; upgrade_suggester.py ranks the next moves from recorded deferrals plus standing hardening steps. Companion to run-without-you; the last stop before phase=done.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[188,189,190,191,37,192,193,194,195,32,196,122,197,198,199,200,201,202,203,204],"wrap up","up","wrap","gemini","run","file","hardening","closeout","stop","upgrade","founder","close","companion","you","tables","directions","phase",{"skillNo":206,"name":207,"nameZh":6,"description":208,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":209,"categories":210,"keywords":212,"publishedAt":39},"01M6QRA5AYC1RBFZ39GTWGS3N8","workflow-builder","Design and write deterministic multi-agent workflow scripts (.js files in .claude\u002Fworkflows\u002F) for Claude Code's Workflow tool. Use when a user wants to build, create, author, scaffold, or run a custom Claude Code workflow, orchestrate sub-agents (fan-out, pipeline, loop, judge-panel), or automate a repeatable multi-step task across fresh-context agents.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworkflow-builder\u002FSKILL.md",[211],{"categoryNo":161,"categoryName":162,"taxonomyType":108,"taxonomyTypeDesc":109},[213,214,215,216,217,166,192,218,219,220,221,222,148,223,121,224,225,226,227,228],"workflow","workflow builder","builder","design","workflows","code","orchestrate","pipeline","loop","multi-agent","context","across","fresh","scripts","judge","claude code workflow",{"skillNo":230,"name":231,"nameZh":6,"description":232,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":233,"categories":234,"keywords":235,"publishedAt":39},"01M6QR7QMCZESKQA0ERW1E657M","weekly-review","Use when someone wants to run a weekly review, close open loops, audit stalled projects and commitments, get their system back to trusted, restart a lapsed review habit, or says \"\u002Fcs:weekly-review\". Walks David Allen's three-phase loop — GET CLEAR, GET CURRENT, GET CREATIVE — with deterministic scripts that inventory open loops, gate the checklist with named gaps, and score commitment health 0-100.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweekly-review\u002FSKILL.md",[],[236,237,238,239,240,241,242,243,244,221,245,246,247,248,249,250,123,251,252,204],"review","weekly review","weekly","deterministic scripts","reflect","feeds","inventory","open","team","projects","project-management","scanner","conversation","back","project","sprint","cadence"]