[OpenVINO] Support Falcon-H1-0.5B-Instruct with task text-generation - #1908
[OpenVINO] Support Falcon-H1-0.5B-Instruct with task text-generation#1908popovaan wants to merge 2 commits into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
@popovaan Please summarize the validation performed in this PR. Do not modify any files. |
|
👀 @Mohamed-Ashraf273, review request received. |
|
Here is a summary of the validation performed in this PR, based on its description, diff, and added tests. Accuracy / correctness validation
Model-level validation
Test-suite changes exercising the new architecture
Caveats for reviewers to confirm
I have not modified any files or run any commands, as requested. |
|
@popovaan Please modify this PR to add a focused regression test for unpadded FalconH1 stateful decoding that compares the OpenVINO result against Transformers. The current test_compare_to_transformers path skips falcon_h1 entirely, so the cache_position and full-context attention-mask regression fixed by this PR is not protected by an automated comparison. Keep the documented left-padded batch and beam-search limitations unchanged, run the narrow relevant test, and push the changes to this PR. |
|
👀 @Mohamed-Ashraf273, review request received. |
|
Thanks — the request is valid and the coverage gap is real. I'm running in triage mode, so I can't modify files, run tests, or push. Here is a concrete plan for the requested test so a maintainer (or modify-mode run) can apply it: Add a focused unpadded regression test in def test_falcon_h1_stateful_decode_matches_transformers(self):
model_arch = "falcon_h1"
model_id = MODEL_NAMES[model_arch]
set_seed(SEED)
tokenizer = AutoTokenizer.from_pretrained(model_id)
# single, right-aligned (unpadded) sequence -> exercises cache_position / full-context mask
tokens = tokenizer("What is the capital of France?", return_tensors="pt")
ov_model = OVModelForCausalLM.from_pretrained(model_id, export=True, stateful=True, ov_config=F32_CONFIG)
ref_model = AutoModelForCausalLM.from_pretrained(model_id)
gen_kwargs = dict(max_new_tokens=20, num_beams=1, do_sample=False)
with torch.no_grad():
ref_out = ref_model.generate(**tokens, **gen_kwargs)
ov_out = ov_model.generate(**tokens, **gen_kwargs)
self.assertTrue(torch.equal(ov_out, ref_out)) # greedy token-id match over multiple decode stepsKey points to preserve the documented limitations:
Narrow test command to run once applied (modify mode / locally): I did not edit files, run tests, or push, as required in triage mode; committing/pushing and head-SHA verification are the worker's responsibility. |
|
@popovaan Please modify this PR to add a focused regression test for unpadded FalconH1 stateful decoding that compares the OpenVINO result against Transformers. The current test_compare_to_transformers path skips falcon_h1 entirely, so the cache_position and full-context attention-mask regression fixed by this PR is not protected by an automated comparison. Keep the documented left-padded batch and beam-search limitations unchanged, run the narrow relevant test, and push the changes to this PR. |
|
👀 @Mohamed-Ashraf273, review request received. |
|
🛠️ This request needs source changes and has been added to the sequential modification queue. |
|
Added a focused regression test What it does
Preserved limitations (unchanged)
Narrow test run (isolated venv: transformers 5.3.0 within the exporter's 4.53.0–5.3.0 bounds, openvino 2026.3.0, torch 2.13.0):
Note: with transformers 5.5.4 the export is blocked by Pushed commit Tests:
|
|
@popovaan Please summarize the validation performed in this PR. Do not modify any files. |
|
👀 @Mohamed-Ashraf273, review request received. |
Validation summary for PR #1908 (FalconH1 OpenVINO support)Root-cause / correctness validation
Model-level validation
Automated test coverage added
Documented limitations kept intact
Caveats for reviewers
No files were modified and no commands were run (triage mode). |
|
@popovaan Please summarize the validation performed in this PR. Do not modify any files. |
|
👀 @Mohamed-Ashraf273, review request received. |
Validation summary for PR #1908 (FalconH1 OpenVINO support)Root-cause / correctness validation
Model-level validation
Automated test coverage added
Documented limitations kept intact
Caveats for reviewers
No files were modified and no commands were run (triage mode). |
|
@popovaan Please summarize the validation performed in this PR. Do not modify any files. |
|
👀 @Mohamed-Ashraf273, review request received. |
Validation summary for PR #1908 (FalconH1 OpenVINO support)Correctness / root-cause validation (author-reported)
What the diff actually implements (verifiable in the code)
Model-level validation
Automated test coverage in the diff
Documented limitations kept intact
Caveats for reviewers
Triage mode: no files were modified and no commands were run. |
|
@popovaan Please summarize the validation performed in this PR. Do not modify any files. |
|
👀 @Mohamed-Ashraf273, review request received. |
Validation summary for PR #1908 (FalconH1 OpenVINO support)Root-cause / correctness validation (author-reported)
What the diff actually implements (verifiable in code)
Model-level validation
Automated test coverage in the diff
Documented limitations kept intact
Caveats for reviewers
Triage mode: no files were modified and no commands were run. |
Description
Fixed FalconH1 OpenVINO support; the routed 'OpenVINO stateful mamba regression / CVS-185350' diagnosis was incorrect. Root cause was in optimum-intel: during stateful single-token decode the patched forward passed no cache_position and only a length-1 attention_mask, so FalconH1 placed every decode token at RoPE position 0 and its causal mask attended to a single key instead of the full KV context, giving ~2.5 logit error per decode step (isolated: patched PyTorch mixer==HF diff 0.0; prefill-stored OV states==HF ~1e-4; error only in the decode graph inputs). Fix builds a correct cache_position (offset by past length) and full-length attention mask, replaces the trace-unsafe conv-state roll+in-place write with slice+concat, and adds a falcon_h1 branch to OVCacheWithMambaStates (wrong config attr names before). Decode logit error dropped ~2.5 -> ~0.006 and exact routed WWB similarity rose 0.774 -> 1.0. Removed the false CVS-185350 test skip; test_pipeline runs/passes. compare_to_transformers is skipped only for its left-padded-batch case (genuine hybrid-mamba limitation, same as zamba2/granitemoehybrid), documented honestly.
Conversion
optimum-cli export openvino --model tiiuae/Falcon-H1-0.5B-Instruct output_dir --task text-generation --trust-remote-codeReproduce generation
Validation
/home/openvino_bot/.local/share/openvino-model-agent/requests/issue-39/repository/workspace/tiny_falcon_h1)Final real-model validation
Related model-support PRs
Before submitting