# 值错误：该模型不支持'mean'池化模式，需要'cls'池化。

- **ID:** `llm/embedding-model-mismatch-pooling`
- **领域:** llm
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在生成嵌入时使用了与句子变换器模型不兼容的池化方法，通常因误读模型卡导致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| sentence-transformers 2.2.0 | active | — | — |
| sentence-transformers 2.3.0 | active | — | — |
| transformers 4.35.0 | active | — | — |

## 解决方案

1. ```
   Change pooling mode to 'cls' explicitly: model = SentenceTransformer('model-name', device='cpu'); embeddings = model.encode(sentences, pool='cls')
   ```
2. ```
   Use a different model that supports 'mean' pooling, e.g., 'all-MiniLM-L6-v2'
   ```

## 无效尝试

- **Upgrading sentence-transformers to latest version without checking model compatibility** — Pooling mode is model-specific, not version-specific; upgrade doesn't change model internals. (90% 失败率)
- **Setting pooling mode to 'auto' hoping library will infer correctly** — Auto-detection may default to unsupported mode if model config is ambiguous. (70% 失败率)
