{
  "id": "llm/embedding-model-mismatch-pooling",
  "signature": "ValueError: Pooling mode 'mean' not supported for this model. Expected 'cls' pooling.",
  "signature_zh": "值错误：该模型不支持'mean'池化模式，需要'cls'池化。",
  "regex": "Pooling mode 'mean' not supported for this model",
  "domain": "llm",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Using a sentence-transformer model with an incompatible pooling method during embedding generation, often due to model card misreading.",
  "root_cause_type": "generic",
  "root_cause_zh": "在生成嵌入时使用了与句子变换器模型不兼容的池化方法，通常因误读模型卡导致。",
  "versions": [
    {
      "version": "sentence-transformers 2.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "sentence-transformers 2.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "transformers 4.35.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Upgrading sentence-transformers to latest version without checking model compatibility",
      "why_fails": "Pooling mode is model-specific, not version-specific; upgrade doesn't change model internals.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting pooling mode to 'auto' hoping library will infer correctly",
      "why_fails": "Auto-detection may default to unsupported mode if model config is ambiguous.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Change pooling mode to 'cls' explicitly: model = SentenceTransformer('model-name', device='cpu'); embeddings = model.encode(sentences, pool='cls')",
      "success_rate": 0.95,
      "how": "Change pooling mode to 'cls' explicitly: model = SentenceTransformer('model-name', device='cpu'); embeddings = model.encode(sentences, pool='cls')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a different model that supports 'mean' pooling, e.g., 'all-MiniLM-L6-v2'",
      "success_rate": 0.85,
      "how": "Use a different model that supports 'mean' pooling, e.g., 'all-MiniLM-L6-v2'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Change pooling mode to 'cls' explicitly: model = SentenceTransformer('model-name', device='cpu'); embeddings = model.encode(sentences, pool='cls')",
    "Use a different model that supports 'mean' pooling, e.g., 'all-MiniLM-L6-v2'"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.sbert.net/docs/pretrained_models.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}