Add top-p to run_eval.py (#16844)

This commit is contained in:
hlu1
2026-01-10 01:10:37 -08:00
committed by GitHub
parent 9fd2358cc2
commit aeb480c11f
3 changed files with 17 additions and 2 deletions

View File

@@ -190,15 +190,25 @@ Output throughput: 4418.617 token/s
Accuracy benchmark on long context can be tested on GPQA-diamond dataset with long output tokens and thinking enabled:
```bash
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 120000 --repeat 8 --thinking-mode deepseek-v3
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 128000 --repeat 8 --thinking-mode deepseek-v3
```
The mean accuracy over 8 runs shows 0.797, which matches the number 79.9 in official tech report.
The mean accuracy over 8 runs shows 0.797, which matches the number 0.799 in official tech report.
```bash
Repeat: 8, mean: 0.797
Scores: ['0.808', '0.798', '0.808', '0.798', '0.783', '0.788', '0.803', '0.793']
```
For Deepseek V3.2, Deepseek recommends setting the sampling parameters to temperature = 1.0, top_p = 0.95:
```bash
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 128000 --repeat 8 --top-p 0.95 --temperature 1.0 --thinking-mode deepseek-v3
Repeat: 8, mean: 0.840
Scores: ['0.848', '0.808', '0.848', '0.838', '0.879', '0.813', '0.838', '0.848']
```
which matches the official score, 0.824, as reported in the [Deepseek-V3.2 technical report](https://huggingface.co/deepseek-ai/DeepSeek-V3.2/blob/main/assets/paper.pdf).
### Accuracy Test with `aime 2025`
Prepare the environment by installing NeMo-Skills in the docker or your own virtual environment:

View File

@@ -36,6 +36,7 @@ def run_eval_once(args, base_url: str, eval_obj: Eval) -> dict:
sampler = ChatCompletionSampler(
model=args.model,
max_tokens=getattr(args, "max_tokens", 2048),
top_p=getattr(args, "top_p", 1.0),
base_url=base_url,
temperature=getattr(args, "temperature", 0.0),
reasoning_effort=getattr(args, "reasoning_effort", None),
@@ -233,6 +234,7 @@ if __name__ == "__main__":
parser.add_argument("--num-threads", type=int, default=512)
parser.add_argument("--max-tokens", type=int, default=2048)
parser.add_argument("--temperature", type=float, default=0.0)
parser.add_argument("--top-p", type=float, default=1.0)
parser.add_argument("--reasoning-effort", type=str)
parser.add_argument(
"--thinking-mode",

View File

@@ -91,6 +91,7 @@ class ChatCompletionSampler(SamplerBase):
model: Optional[str] = None,
system_message: Optional[str] = None,
temperature: float = 0.0,
top_p: float = 1.0,
reasoning_effort: Optional[str] = None,
max_tokens: int = 2048,
extra_body: Optional[Dict[str, Any]] = None,
@@ -103,6 +104,7 @@ class ChatCompletionSampler(SamplerBase):
self.model = model
self.system_message = system_message
self.temperature = temperature
self.top_p = top_p
self.max_tokens = max_tokens
self.reasoning_effort = reasoning_effort
self.extra_body = extra_body
@@ -144,6 +146,7 @@ class ChatCompletionSampler(SamplerBase):
model=self.model,
messages=message_list,
temperature=self.temperature,
top_p=self.top_p,
max_tokens=self.max_tokens,
reasoning_effort=self.reasoning_effort,
extra_body=self.extra_body,