# 警告：当温度接近 0 时，seed 参数可能无法产生确定性结果

- **ID:** `llm/seed-parameter-ignored-with-low-temp`
- **领域:** llm
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

即使 temperature=0，某些 LLM 提供商（如 OpenAI）也不能保证完全确定性，因为 GPU 非确定性、批处理或模型更新，seed 仅作为尽力而为的提示。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| openai-python>=1.0.0 | active | — | — |
| gpt-4-turbo-2024-04-09 | active | — | — |
| gpt-3.5-turbo-0125 | active | — | — |

## 解决方案

1. ```
   Accept non-determinism and implement idempotency in your application logic. For testing, compare outputs using fuzzy matching or semantic similarity instead of exact equality.
   ```
2. ```
   Use a self-hosted model (e.g., Llama 3 with vLLM) where you can control CUDA determinism flags: `export CUBLAS_WORKSPACE_CONFIG=:4096:8` and set `torch.use_deterministic_algorithms(True)`.
   ```
3. ```
   Log the full request parameters and response ID for reproducibility; retry with same parameters if output is anomalous.
   ```

## 无效尝试

- **** — This is the standard approach but still fails; the warning indicates it's not a configuration issue but a platform limitation. (60% 失败率)
- **** — All seeds behave identically; the non-determinism is inherent to the API, not seed-specific. (90% 失败率)
- **** — Streaming vs non-streaming both exhibit the same non-determinism at the output level. (80% 失败率)
