Skip to content

ci: add DeepSeek V4 generation accuracy guard#67

Merged
bumble0918 merged 1 commit into
hw-native-sys:mainfrom
ndleslx:dsv4-ci
Jul 13, 2026
Merged

ci: add DeepSeek V4 generation accuracy guard#67
bumble0918 merged 1 commit into
hw-native-sys:mainfrom
ndleslx:dsv4-ci

Conversation

@ndleslx

@ndleslx ndleslx commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an HTTP-level DeepSeek V4 generation accuracy test with a deterministic six-token golden
  • allocate eight NPUs through task-submit with 20-minute inactivity and 30-minute absolute limits
  • mirror the documented DeepSeek V4 serving command and clean up orphaned submitted tasks

Validation

  • python -m pytest tests/test_deepseek_v4.py -q (45 passed)
  • python -m pytest tests/test_parallel.py -q (9 passed)
  • header, English-only, changed-file Ruff, YAML, and whitespace checks passed
  • TP=8 E2E is delegated to CI because the configured CI checkpoint is not mounted in the development shell

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f7ae2c4-b0cf-4554-83df-d03f6972ccea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request adds a DeepSeek V4 HTTP completion accuracy test and integrates it into the unit-test CI job with extended time limits, required packages, task submission, and orphan cleanup.

Changes

DeepSeek V4 accuracy validation

Layer / File(s) Summary
Test configuration and server setup
tests/test_deepseek_v4_accuracy.py
Defines expected generation output, validates eight task devices, allocates a local port, and constructs the server command.
HTTP readiness and process lifecycle
tests/test_deepseek_v4_accuracy.py
Starts the server, polls health, sends a timed completion request, validates the response, terminates process groups, and prints failure logs.
CI execution and orphan cleanup
.github/workflows/ci.yml, tests/test_deepseek_v4_accuracy.py
Extends the job timeout, installs HTTP test packages, submits the accuracy guard through task-submit, and cleans up marked orphan tasks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI as unit-tests CI job
  participant Task as task-submit
  participant Test as DeepSeek accuracy test
  participant Server as DeepSeek HTTP server
  participant API as HTTP completion API
  CI->>Task: submit accuracy command with device and timeout settings
  Task->>Test: execute pytest test
  Test->>Server: start server
  Test->>Server: poll /health
  Test->>API: POST /v1/completions
  API-->>Test: return generated completion
  Test->>Test: validate expected response
  Test->>Server: terminate process group
Loading

Poem

I’m a rabbit with tests in my paws,
Checking DeepSeek for text without flaws.
Ports bloom, servers hum,
Eight devices run,
Then orphaned tasks vanish—because!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding a DeepSeek V4 CI accuracy guard.
Description check ✅ Passed The description matches the changeset, describing the DeepSeek V4 accuracy test, task-submit limits, and cleanup steps.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new integration test (tests/test_deepseek_v4_accuracy.py) to verify the HTTP generation accuracy of DeepSeek V4 in CI. The test launches a local server, waits for health checks, performs a completion request, and asserts the output. The review feedback highlights two important improvement opportunities: first, handling urllib.error.HTTPError explicitly in _request_completion to capture detailed error bodies for better debuggability, and second, optimizing _print_server_log to read only the tail of the log file instead of loading the entire file into memory, which prevents potential Out Of Memory (OOM) issues in CI.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tests/test_deepseek_v4_accuracy.py
Comment thread tests/test_deepseek_v4_accuracy.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_deepseek_v4_accuracy.py`:
- Around line 171-199: Update _stop_process_group so cleanup never propagates a
subprocess.TimeoutExpired or other process-wait failure from the final
process.wait call after SIGKILL. Catch and suppress the timeout (and ensure
cleanup exceptions do not replace the original test failure), while preserving
the existing graceful termination and forced-kill sequence.
- Around line 156-168: Update the RuntimeError raised when the DeepSeek server
exits during generation in the queue.Empty handling path to explicitly use
exception chaining with from None. Keep the existing error message and
surrounding completion logic unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85b2141f-fbbb-46d1-83f4-ec43396d3697

📥 Commits

Reviewing files that changed from the base of the PR and between 19f24f0 and c13d9d3.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • tests/test_deepseek_v4_accuracy.py

Comment thread tests/test_deepseek_v4_accuracy.py
Comment thread tests/test_deepseek_v4_accuracy.py
@ndleslx ndleslx closed this Jul 12, 2026
@ndleslx ndleslx reopened this Jul 12, 2026
@ndleslx ndleslx force-pushed the dsv4-ci branch 3 times, most recently from 794006a to 45bb4ee Compare July 13, 2026 02:00
Add an end-to-end DeepSeek V4 HTTP completion test that starts the serving command with the documented TP=8 configuration, sends the prompt 'Huawei is' with greedy decoding, and requires the exact six-token completion ' a leading global provider of ICT'. Bound server startup and generation, preserve HTTP error response bodies, and print only a bounded server-log tail on failure.

Make process-group shutdown best-effort so stuck or failed waits cannot mask the original accuracy failure. Add focused CPU coverage for HTTP error diagnostics, bounded log reads, and the forced-kill timeout path.

Run the DeepSeek guard through task-submit with automatic eight-device allocation outside the configured whitelist, a 20-minute allocation wait, a 30-minute runtime limit, the CI model at /data/l00955553/model/dsv4-flash-w8a8, and the runtime settings required by the documented server configuration. Move both Qwen guards into their own automatic task-submit reservations and add a run-scoped marker so cancelled CI jobs can reap orphaned submissions.

Make serving workers close executor-owned runtime resources on every exit path, including initialization and inference failures, so distributed workers do not retain NPU memory after tests finish. Cover normal, exceptional, and repeated cleanup behavior with focused unit tests, and extend the NPU job timeout and dependencies for the HTTP guard.
@bumble0918 bumble0918 merged commit 354de7f into hw-native-sys:main Jul 13, 2026
6 of 7 checks passed
zhangqi-chen pushed a commit to hw-native-sys/pypto-lib that referenced this pull request Jul 13, 2026
## Summary
- generalize the pypto-serving test action with model-name and model-dir
inputs
- use one PR-only serving job with model-specific Qwen and DeepSeek
change detection
- run the merged pypto-serving DeepSeek V4 accuracy guard with automatic
eight-device allocation and whitelist bypass
- apply 20-minute allocation and 30-minute runtime limits to both Qwen
and DeepSeek task submissions

## Validation
- parsed the composite action and workflow YAML locally
- passed header, English-only, Ruff, and diff checks
- verified Qwen-only, DeepSeek-only, combined, unrelated, and non-PR
selection behavior
- verified the DeepSeek PTO2 ring inputs and task-submit arguments are
forwarded explicitly

Depends on the DeepSeek accuracy guard merged in
hw-native-sys/pypto-serving#67.
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.

2 participants