Run this model with HF Jobs

Run vllm-sr/vela3-fast on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/vllm-sr/vela3-fast. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/vllm-sr/vela3-fast on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Attend without dense masks on long rows on GPUs

#1
Semantic Router Labs org

UltrabertModel.forward builds two [B, 1, L, L] float masks per forward under SDPA, one for the ±128 local layers and one for the global layers, although the local layers read only 257 keys per query. On a GPU they cost memory and time with the square of the row width: on a 16 GB RTX 4070 Ti SUPER, four choice questions over a 16,000-word text (64,072 tokens in all) take 60 s, because the masks spill out of device memory.

On a GPU under SDPA, rows of 4,096 tokens or more now skip those masks (blocked_attention). Global layers read a [B, 1, 1, L] key mask, or none when no row is padded. Local layers attend in 128-query blocks over the keys within the window, the blocks folded into the batch axis, with the dense path's mask values. Shorter rows, the CPU, eager attention and FlashAttention 2 run as before.

Tested with four ordinary choice questions, four router questions, the PII label set and an NER question over texts of 1,000 to 32,000 words of the Apache-2.0 licence (p50 of five runs, peak allocated memory), before and after, on one MI300X and on an RTX 4070 Ti SUPER:

Request Tokens MI300X before MI300X after 4070 Ti SUPER before 4070 Ti SUPER after
choice ×4, 8K words 32,072 276 ms, 10.3 GiB 156 ms, 8.1 GiB 1,253 ms, 10.2 GiB 731 ms, 7.9 GiB
choice ×4, 16K words 64,072 847 ms, 20.6 GiB 349 ms, 9.9 GiB 60,451 ms, 20.4 GiB 1,649 ms, 9.7 GiB
choice ×4, 32K words 107,128 2,157 ms, 25.4 GiB 678 ms, 9.5 GiB 42,109 ms, 25.3 GiB 3,228 ms, 9.3 GiB
router ×4, 32K words 86,368 2,294 ms, 10.0 GiB 1,639 ms, 7.7 GiB 22,633 ms, 9.9 GiB 7,327 ms, 7.6 GiB
PII spans, 32K words 28,592 969 ms, 10.0 GiB 750 ms, 7.7 GiB 7,675 ms, 9.9 GiB 2,569 ms, 7.6 GiB

Below 4,096 tokens per row every answer is identical before and after. Above it, the router questions and both span questions are identical on the 4070 Ti SUPER and within 3.2e-6 on MI300X; the ordinary choice questions move by up to 5.2e-3 on the 4070 Ti SUPER and 7.3e-3 on MI300X. Against the dense masks on random inputs, blocked_attention differs by at most 6e-7 on CPU and 3e-7 on MI300X, and not at all on the 4070 Ti SUPER.

adaamko changed pull request status to merged

Sign up or log in to comment