feat(ai): fr_regressor_v2 ENCODER_VOCAB v2 (hw codec extension)#394
Merged
feat(ai): fr_regressor_v2 ENCODER_VOCAB v2 (hw codec extension)#394
Conversation
Extends the closed encoder vocabulary used by codec-aware training with 6 hardware encoder entries (h264/hevc/av1 across NVENC + QSV) and bumps ENCODER_VOCAB_VERSION 1 -> 2. PRESET_ORDINAL gains matching sub-tables for NVENC's p1..p7 preset family and Intel QSV's libx264-aligned preset names. Validated on a 216-row real corpus aggregated from 33,840 per-frame rows produced by scripts/dev/hw_encoder_corpus.py: vocab v1 (all hw codecs -> 'unknown'): PLCC 0.92 RMSE 6.41 vocab v2 (proper one-hot): PLCC 0.96 RMSE 4.15 The vocab extension carries real signal — codec one-hot lets the model learn per-codec quality calibration that 'unknown' collapses discard. No model graph regenerated in this PR (the registry's fr_regressor_v2.onnx remains the smoke ONNX); the next training run that produces a real ONNX will use vocab v2. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Extends fr_regressor_v2’s closed encoder vocabulary and preset ordinal mappings to recognize NVIDIA NVENC and Intel QSV hardware encoders, and records the append-only invariant + version bump semantics in docs/changelog.
Changes:
- Append 6 hardware encoder strings to
ENCODER_VOCABand bumpENCODER_VOCAB_VERSIONto 2 - Add
PRESET_ORDINALsub-tables for NVENCp1..p7and QSV’s libx264-aligned presets - Document the change in
docs/rebase-notes.mdand a changelog fragment
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/rebase-notes.md | Adds rebase note documenting append-only invariant and v2 bump semantics |
| changelog.d/changed/fr-regressor-v2-hw-codec-vocab.md | Adds changelog entry describing the encoder vocab + preset table extension |
| ai/scripts/train_fr_regressor_v2.py | Appends hw encoder tokens, bumps vocab version, and introduces preset ordinal maps for NVENC/QSV |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+98
to
+100
| # ENCODER_VOCAB_VERSION to 2 — the previous vocab v1 model graphs | ||
| # are forward-compatible (extra one-hot bits are zero-padded for | ||
| # legacy callers) but new training runs target v2. |
Comment on lines
+151
to
+182
| "h264_nvenc": {"p1": 0, "p2": 2, "p3": 3, "p4": 5, "p5": 6, "p6": 7, "p7": 9}, | ||
| "hevc_nvenc": {"p1": 0, "p2": 2, "p3": 3, "p4": 5, "p5": 6, "p6": 7, "p7": 9}, | ||
| "av1_nvenc": {"p1": 0, "p2": 2, "p3": 3, "p4": 5, "p5": 6, "p6": 7, "p7": 9}, | ||
| # Intel QSV presets share the libx264 vocabulary but only ship | ||
| # veryfast/faster/fast/medium/slow/slower/veryslow on Arc. | ||
| "h264_qsv": { | ||
| "veryfast": 2, | ||
| "faster": 3, | ||
| "fast": 4, | ||
| "medium": 5, | ||
| "slow": 6, | ||
| "slower": 7, | ||
| "veryslow": 8, | ||
| }, | ||
| "hevc_qsv": { | ||
| "veryfast": 2, | ||
| "faster": 3, | ||
| "fast": 4, | ||
| "medium": 5, | ||
| "slow": 6, | ||
| "slower": 7, | ||
| "veryslow": 8, | ||
| }, | ||
| "av1_qsv": { | ||
| "veryfast": 2, | ||
| "faster": 3, | ||
| "fast": 4, | ||
| "medium": 5, | ||
| "slow": 6, | ||
| "slower": 7, | ||
| "veryslow": 8, | ||
| }, |
This was referenced May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the closed encoder vocabulary used by codec-aware training (
ai/scripts/train_fr_regressor_v2.py) with 6 hardware encoder entries (h264/hevc/av1 × NVENC + QSV) and bumpsENCODER_VOCAB_VERSIONfrom 1 to 2.PRESET_ORDINALgains matching sub-tables for NVENC'sp1..p7preset family and Intel QSV's libx264-aligned preset names.Validation
216-row real corpus aggregated from 33,840 per-frame rows produced by
scripts/dev/hw_encoder_corpus.py(PR #392):The vocab extension carries real signal — codec one-hot lets the model learn per-codec quality calibration that the "unknown" collapse discarded.
Scope
ENCODER_VOCAB_VERSION1 → 2fr_regressor_v2.onnxremains the smoke ONNX. A follow-up training run will produce the real v2-vocab graph.ADR-0108 deliverables
no digest needed: trivial vocab-table extension; rationale is in the PLCC validation table above
no alternatives: only-one-way fix — closed-vocab schema requires ENCODER_VOCAB extension to recognise hw codecs
docs/rebase-notes.mdentry 0235 documents the append-only invariant + version bump semanticpython3 ai/scripts/train_fr_regressor_v2.py --corpus <jsonl> --epochs 200 --no-exportchangelog.d/changed/fr-regressor-v2-hw-codec-vocab.mddocs/rebase-notes.mdentry 0235🤖 Generated with Claude Code