Skip to content

Refactor fetch_official_vectors.py for improvements#26

Open
krataratha wants to merge 1 commit intoantirez:mainfrom
krataratha:patch-1
Open

Refactor fetch_official_vectors.py for improvements#26
krataratha wants to merge 1 commit intoantirez:mainfrom
krataratha:patch-1

Conversation

@krataratha
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 9, 2026 11:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors tests/test-vectors/fetch_official_vectors.py, expanding it from a simple sequential fetcher into a more featureful tool that adds retry behavior, parallel fetching, additional metadata in emitted JSON, and gzip exports for the official vector artifacts.

Changes:

  • Add retry logic to the API call path and factor request payload construction into a helper.
  • Parallelize vector fetching via ThreadPoolExecutor, and emit additional metadata (e.g., prompt hash, basic stats, generated timestamps).
  • Add gzip export support and adjust the compact official.vec generator output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +235 to +237
output.append(
f"case {prompt['id']} {CTX_BY_ID[prompt['id']]} {len(record['steps'])}"
)
Copy link
Copy Markdown

@manucian-official manucian-official May 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — this is a real compatibility regression. The current output format drops the prompt file path, which breaks tests/ds4_test.c:test_read_vector_case, since the parser explicitly expects 4 fields in the case line: case <prompt_path>. Without that field, the generated .vec file becomes non-compliant and will fail --logprob-vectors validation. I will fix this by restoring prompt['prompt_file'] in the case output and ensuring it is consistently included across all generated fixtures, so the format remains fully aligned with the parser contract and test specification.

Comment on lines +364 to +371
futures = [
executor.submit(fetch_and_store, api_key, spec, root)
for spec in selected
]

for future in concurrent.futures.as_completed(futures):
manifest["prompts"].append(future.result())

The API exposes top-logprobs, not full logits. These vectors are therefore
golden continuation slices: useful for catching tokenizer/template/attention
regressions, but not a replacement for a full internal logit dump.
"""Fetch DeepSeek V4 Flash logprob vectors with retries, caching, gzip export,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants