Skip to content

[hw-agnostic] Adding embedding layer and lm_head - #52355

Open
bohnstingl wants to merge 1 commit into
vllm-project:mainfrom
bohnstingl:transformer_hw-agnostic_p3
Open

[hw-agnostic] Adding embedding layer and lm_head#52355
bohnstingl wants to merge 1 commit into
vllm-project:mainfrom
bohnstingl:transformer_hw-agnostic_p3

Conversation

@bohnstingl

Copy link
Copy Markdown
Contributor

Purpose

Extends the hardware-agnostic layer path in the Transformers modeling backend to
cover the token-embedding boundary: input embedding (VocabParallelEmbedding),
LM head (ParallelLMHead), and the logits projection (LogitsProcessor).

When VLLM_USE_HW_AGNOSTIC is unset (the default), behavior is unchanged: every
site resolves to the same vLLM class it used before.

Test Plan

I ran an lm_eval with the Granite3.3-8B model, to demonstrate that the new additional layers do not introduce numerical issues.

export VLLM_USE_HW_AGNOSTIC=1
lm_eval --model vllm \
  --model_args "pretrained=ibm-granite/granite-3.3-8b-instruct,model_impl=transformers,tensor_parallel_size=1,gpu_memory_utilization=0.85,max_model_len=4096,enforce_eager=True" \
  --tasks gsm8k \
  --num_fewshot 5 \
  --batch_size auto \
  --output_path /block/boh/vllm_dev/claude/granite_eval_logs/flag_on

In addition, I also added some new, specific tests for the layers.

Test Result

lm_eval results:

Metric OFF ON Δ
flexible-extract 0.7240 ± 0.0123 0.7225 ± 0.0123 −0.0015
strict-match 0.6710 ± 0.0129 0.6664 ± 0.0130 −0.0046

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

cc @tdoublep @hmellor @zou3519

Signed-off-by: Thomas Ortner <boh@zurich.ibm.com>
@bohnstingl
bohnstingl requested a review from hmellor as a code owner August 14, 2026 13:45

@claude claude 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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.

1 participant