seed and chat logprobs are silently ignored (200 with no effect); proposal for per-request seeded sampling
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- api, machine-learning
Hướng nghiên cứu
Start in server/api_models.py, where ChatCompletionRequest accepts unknown fields via extra="allow", then openai_api.py around line 658 where CompletionRequest rejects logprobs. Next, engine/sample.py sample_impl() and kernel/triton/sampling.py _gen_u show where seed is dropped. A small first step is returning 400 for unsupported seed or logprobs on the chat route. Full seeded sampling is a design task to agree on with maintainers first, and it depends on #224 for logprobs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened
Two OpenAI request fields are ignored without an error, so the client gets a 200 response that does not do what it asked for:
| Request | Expected | Got |
|---|---|---|
/v1/chat/completions, temperature: 1.0, seed: 1234, the same request twice |
the same output | different output |
/v1/completions, temperature: 1.0, seed: 7, the same request twice |
the same output | different output |
/v1/chat/completions, logprobs: true, top_logprobs: 3 |
choices[].logprobs.content[] |
"logprobs": null, no error |
/v1/completions, logprobs: 2 |
logprobs, or a 400 | 400 logprobs is not supported (correct, but it shows the gap) |
temperature: 0 gives the same output each time in my tests (single short requests, thinking off). Other sampling fields work: top_p, top_k, min_p, the penalties, stop and max_tokens.
Minimal reproduction:
for i in 1 2; do curl -s localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen3.8-Flash-Next", "max_tokens": 20, "temperature": 1.0, "seed": 1234,
"chat_template_kwargs": {"enable_thinking": false},
"messages": [{"role": "user", "content": "Invent a name for a cat."}]}' | jq -r '.choices[0].message.content'; done
Cause (current main, 0bca88f7)
server/api_models.py:ChatCompletionRequesthasmodel_config = ConfigDict(extra="allow")and noseedorlogprobsfield. Both are accepted and then dropped.CompletionRequestalso has noseed, but it rejectslogprobs(openai_api.pyaround line 658).SamplingParamshas no seed, andengine/sample.pysample_impl()calls the sampling functions withoutseed/offset. The Triton sampler (kernel/triton/sampling.py,_gen_u) already acceptsseedandoffset, but only one value for the whole batch.
Proposed fix
seed:
- Add
seed: int | NonetoChatCompletionRequest,CompletionRequestandSamplingParams, and carry it to the scheduler like the other sampling fields. - In
Sampler.prepare(), build a per-row(seed, offset)pair for the rows that have a seed. Use the number of generated tokens as the offset, so each step draws a new number but a replay draws the same one. - Make the uniform draw per row: in the Triton path,
tl.rand(seed_row, offset_row)(Philox) inside the kernel, or one generator per seeded row in_gen_u. Rows without a seed keep the current unseeded draw. A batch with no seeded rows keeps exactly the current path. If the FlashInfer sampling path cannot take per-row seeds, send batches that contain a seeded row to the Triton path. - Document the limit: a seed makes the draw reproducible, but the logits can still differ between batch compositions (see #307 for the near-tie case at temperature 0). So the guarantee is "best effort", like OpenAI's own
seed.
logprobs:
#224 implements logprobs / top_logprobs for both routes, with raw pre-temperature values and no cost when not requested. It has been rebased and tested by several people. Merging it closes this part. Until then, /v1/chat/completions should return 400 for logprobs: true, like /v1/completions already does, and not null.
In general: extra="allow" on the request models turns every unsupported OpenAI field into a silent no-op. A short deny-list of fields that change the result (seed, logprobs, top_logprobs, logit_bias, n (see #682), response_format) that returns 400 until each one is implemented would make these gaps visible to clients.
Environment
- Built from source: upstream
main2d8b9cc1 plus a local deploy stack. I checked each code path above on currentmain0bca88f7, and none of it has changed since. - Ubuntu 24.04, Python 3.12, 2x RTX 6000 Ada 48 GB (driver 595.91), TP=2, 503 GB RAM.
- Checkpoint
nvidia/Qwen3.8-Flash-Next-NVFP4. - All results above are reproducible directly against
ft serve, with no proxy.
- Ngôn ngữ chính
- Python
- Star
- 14.2k
- Fork
- 1.4k
- Merge trung bình
- 21 giờ 17 phút
- Pull request đã merge (30 ngày)
- 97
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của FlashML-org/FreeToken
-
Desktop feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
FlashML-org/FreeToken#800 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FlashML-org/FreeToken#767 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test_gemv_path_matches_the_transcription fails on sm_120 (bf16 rounding tie exceeds the tolerance)Có thể đã có người làm @void-mckenzie đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
FlashML-org/FreeToken#649 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FlashML-org/FreeToken#648 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
FlashML-org/FreeToken#646 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của FlashML-org/FreeToken
Issue tương tự
-
Skill submission: negative-test-first (testing discipline; PR creation is collaborator-only)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ComposioHQ/awesome-claude-skills#2398 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug converter
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
grafana/sigma-rule-deployment#435 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
datamodel-code-generator/datamodel-code-generator#5589 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shell: serve the home app's Cookie Policy on a hard reloadCó thể đã có người làm @2001anshkaushik đã nhận hôm nay. Đang mởfeature module:ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rocketride-org/rocketride-server#2899 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
GEFSv12
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100