Skip to content

Fix chunk fbank fallback on current runtime - #24

Merged
praveenperera merged 3 commits into
masterfrom
integrate/pr-17-fbank-fallback
Sep 16, 2026
Merged

praveenperera merged 3 commits into
masterfrom
integrate/pr-17-fbank-fallback

Conversation

@praveenperera

@praveenperera praveenperera commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Closes #16

Carries the original fix from #17 onto the current runtime implementation.

Summary

  • Fall back to the 10-second CoreML fbank model when the 30-second model is unavailable.
  • Preserve the current normalization-scope selection and tensor-shape validation.
  • Return an invariant error when no compatible fbank model is available.
  • Cover chunk scope, segment scope, long audio, fallback, and missing-model selection.
  • Update rustls to 0.23.45 to resolve RUSTSEC-2026-0285, which blocked Cargo Deny on current master.

Root cause

The chunk-scope branch only entered the 10-second path when the audio length or normalization scope rejected the 30-second path. A supported short chunk with no 30-second model therefore returned the preallocated all-zero fbank.

Validation

  • cargo fmt --all
  • cargo clippy (passes with one existing warning in powerset.rs)
  • cargo test (137 passed; seven fixture-backed tests could not run because the local model and PLDA fixtures are absent)

Summary by CodeRabbit

  • Bug Fixes

    • Reports an invariant error when no compatible feature-bank model is available, instead of silently returning an all-zero result.
    • Detects missing selected models and reports an error rather than continuing with invalid data.
  • Tests

    • Added coverage for feature-bank model path selection.

davidamacey and others added 2 commits August 25, 2026 18:44
…sent

compute_chunk_fbank treated 'chunk fits in the 30s model' and 'the 30s
model exists' as one condition: for chunk_audio.len() <= 480_000 with
fbank_30s == None it fell through to the end of the function and returned
the all-zero tensor it had allocated, producing silently wrong embeddings
rather than an error.

orchestrate.rs already handles this correctly by falling back to the 10s
model. Route both call sites through a pure select_fbank_path helper so
the choice is explicit and unit-testable.
Port the short-chunk fallback onto current CoreML tensor validation and normalization-scope handling. Return an invariant error when no compatible fbank model is available.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 77d7ccf0-a3d1-431e-ad45-f50727124b2f

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfc322 and df4a6a0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/pipeline/chunk_embedding/prep.rs

📝 Walkthrough

Walkthrough

The chunk fbank pipeline now selects an available model explicitly. It returns errors when no compatible model or a selected model is unavailable. Tests cover model selection and fallback behavior.

Changes

Chunk fbank model selection

Layer / File(s) Summary
Model path selection and validation
src/pipeline/chunk_embedding/prep.rs
The new FbankPath selector chooses the 30-second model for eligible chunk-scope audio, otherwise the 10-second model. Tests cover fallback, scope, length, and unavailable-model cases.
Fbank computation error handling
src/pipeline/chunk_embedding/prep.rs
compute_chunk_fbank returns invariant_error when no compatible model exists or when the selected model is missing. The existing 30-second padding and 10-second sliding-window processing remains in place.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Medium

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch integrate/pr-17-fbank-fallback

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.

@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Greptile Summary

This PR corrects CoreML filter-bank model selection so compatible short-model inference is used instead of silently retaining zero-filled features, while preserving normalization and tensor-shape behavior. It also updates the locked Rustls stack to address the identified advisory.

  • Selects the 30-second model for supported chunk-scoped audio when available.
  • Falls back to the 10-second model when the 30-second model cannot be used.
  • Returns an invariant error when neither model is compatible.
  • Adds focused tests for model-selection boundaries and missing-model cases.
  • Updates rustls, rustls-webpki, and associated Windows dependencies.
Confidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule issue was identified.

The fallback selection preserves the established 10-second model geometry, bounds copied output to the allocated frame capacity, and returns an explicit error when no compatible model exists. The subsequent lockfile update is limited to the intended Rustls dependency stack.

Important Files Changed
Filename Overview
src/pipeline/chunk_embedding/prep.rs Adds explicit, tested fbank-path selection and safely routes unavailable 30-second inference through the established 10-second model path.
Cargo.lock Updates Rustls and its related locked transitive dependencies without changing application APIs.
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Chunk audio and normalization scope] --> B{Chunk scope, at most 30s,<br/>and 30s model available?}
    B -->|Yes| C[Run 30s fbank model]
    B -->|No| D{10s model available?}
    D -->|Yes| E[Run stitched 10s fbank windows]
    D -->|No| F[Return invariant error]
    C --> G[Validate and copy fbank tensor]
    E --> G
    G --> H[Prepare chunk embedding input]
Loading

Reviews (2): Last reviewed commit: "Update rustls for security advisory" | Re-trigger Greptile

Upgrade rustls to 0.23.45 to address RUSTSEC-2026-0285 and restore the Cargo Deny check.
@praveenperera
praveenperera marked this pull request as ready for review September 16, 2026 19:22
@praveenperera
praveenperera merged commit 1cc120c into master Sep 16, 2026
13 of 14 checks passed
@praveenperera
praveenperera deleted the integrate/pr-17-fbank-fallback branch September 16, 2026 19:22
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.

Chunk embedding prep silently returns an all-zero fbank when the 30s model is absent

2 participants