Add Simple-evals supports to maxtext runner - #4644
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
1270fdf to
eec8114
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
eec8114 to
c5f3e34
Compare
| "max_tokens": max_tokens, | ||
| "temperature": temperature, | ||
| } | ||
| async with semaphore: |
There was a problem hiding this comment.
why did you remove this?
There was a problem hiding this comment.
i do not remove this, i move it into the loop in line 107. it is still semaphore bounded but the slot is released before retry backoff.
|
🤖 Hi @entrpn, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @entrpn, but I was unable to process your request. Please see the logs for more details. |
|
🤖 Hi @entrpn, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
This Pull Request introduces comprehensive support for OpenAI's simple-evals framework to the MaxText runner, enabling grader-free benchmarks like MMLU, GPQA, DROP, MGSM, GSM8K, and AIME. The implementation is highly structured, including concurrent OpenAI-compatible chat sampling, request batching for TPU efficiency, robust server warmup capabilities, and extensive diagnostic/debug reporting.
🔍 General Feedback
- Excellent Architecture: The addition of the in-process
_ChatBatchQueueis a standout feature, enabling concurrent requests to safely coalesce into larger TPU generation batches. This solves the serialization bottleneck and maximizes hardware throughput. - Strong Unit Test Coverage: The PR includes high-quality unit tests covering the task validation, scoring mechanics, server managers, concurrency bounds, and HTTP retry classifiers.
- Robust Warmup Logic: Pre-compiling XLA graphs with representative shapes before running the benchmark is an excellent design choice that avoids latency spikes and compilation timeouts during evaluation.
| sampling_params = SamplingParams(**sp_kwargs) | ||
| except (TypeError, ValueError, KeyError) as exc: |
There was a problem hiding this comment.
| sampling_params = SamplingParams(**sp_kwargs) | |
| except (TypeError, ValueError, KeyError) as exc: | |
| except Exception as exc: # pylint: disable=broad-except | |
| raise fastapi.HTTPException(status_code=400, detail=f"Request formatting failed: {exc}") from exc |
| body = await resp.text() | ||
| last_error = f"HTTP {resp.status}: {body[:200]}" | ||
| retryable = _is_retryable_http_status(resp.status) | ||
| else: | ||
| data = await resp.json() | ||
| latency = time.monotonic() - t0 | ||
| choice = data["choices"][0] | ||
| usage = data.get("usage", {}) | ||
| return GenerationResult( |
There was a problem hiding this comment.
| body = await resp.text() | |
| last_error = f"HTTP {resp.status}: {body[:200]}" | |
| retryable = _is_retryable_http_status(resp.status) | |
| else: | |
| data = await resp.json() | |
| latency = time.monotonic() - t0 | |
| choice = data["choices"][0] | |
| usage = data.get("usage", {}) | |
| return GenerationResult( | |
| else: | |
| try: | |
| data = await resp.json() | |
| latency = time.monotonic() - t0 | |
| choice = data["choices"][0] | |
| usage = data.get("usage", {}) | |
| return GenerationResult( | |
| text=choice.get("text", ""), | |
| prompt_tokens=usage.get("prompt_tokens", 0), | |
| completion_tokens=usage.get("completion_tokens", 0), | |
| latency_s=latency, | |
| ) | |
| except (KeyError, IndexError, ValueError, TypeError) as exc: | |
| last_error = f"Malformed response: {type(exc).__name__}: {exc}" | |
| retryable = False |
There was a problem hiding this comment.
let's use this fail fast design since abnormal failure case is worth checking.
| if len(examples) != 1319: | ||
| raise ValueError(f"Expected 1319 GSM8K main/test examples, found {len(examples)}.") |
There was a problem hiding this comment.
| if len(examples) != 1319: | |
| raise ValueError(f"Expected 1319 GSM8K main/test examples, found {len(examples)}.") | |
| if len(examples) != 1319: | |
| logger.warning("Expected 1319 GSM8K main/test examples, but found %d.", len(examples)) | |
| if not examples: | |
| raise ValueError("GSM8K dataset split is empty.") |
There was a problem hiding this comment.
let's use this fail fast design since this is worth checking if hf modify the dataset.
| def __init__(self, year: int, num_examples: int | None = None, n_repeats: int = 1): | ||
| if year not in _DATASET_BY_YEAR: | ||
| raise ValueError(f"Unsupported AIME year: {year}. Supported: {sorted(_DATASET_BY_YEAR)}.") | ||
| url, problem_col, answer_col = _DATASET_BY_YEAR[year] | ||
| df = pandas.read_parquet(url) |
There was a problem hiding this comment.
| def __init__(self, year: int, num_examples: int | None = None, n_repeats: int = 1): | |
| if year not in _DATASET_BY_YEAR: | |
| raise ValueError(f"Unsupported AIME year: {year}. Supported: {sorted(_DATASET_BY_YEAR)}.") | |
| url, problem_col, answer_col = _DATASET_BY_YEAR[year] | |
| df = pandas.read_parquet(url) | |
| def __init__(self, year: int, num_examples: int | None = None, n_repeats: int = 1): | |
| if year not in _DATASET_BY_YEAR: | |
| raise ValueError(f"Unsupported AIME year: {year}. Supported: {sorted(_DATASET_BY_YEAR)}.") | |
| url, problem_col, answer_col = _DATASET_BY_YEAR[year] | |
| try: | |
| from huggingface_hub import hf_hub_download | |
| # Map raw URL to hf_hub_download parameters | |
| if "AIME_2024" in url: | |
| parquet_path = hf_hub_download(repo_id="Maxwell-Jia/AIME_2024", repo_type="dataset", filename="default/train/0000.parquet") | |
| else: | |
| parquet_path = hf_hub_download(repo_id="math-ai/aime25", repo_type="dataset", filename="default/test/0000.parquet") | |
| except Exception as exc: | |
| raise RuntimeError(f"Could not download AIME dataset: {exc}") from exc | |
| df = pandas.read_parquet(parquet_path) |
Description
This PR is an extension of vLLM Eval Framework. It added simple_evals runner to support gpt-oss model family.
Tests
Added dedicated unit tests.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.