Skip to content

Feb 2024 Release - #187

Merged
danielhanchen merged 432 commits into
mainfrom
nightly
Feb 20, 2024
Merged

danielhanchen merged 432 commits into
mainfrom
nightly

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

@danielhanchen
danielhanchen merged commit 3e4c5a3 into main Feb 20, 2024
mmathew23 pushed a commit to mmathew23/unsloth that referenced this pull request Jul 7, 2025
Stanley00 pushed a commit to stanley-fork/unsloth that referenced this pull request Mar 12, 2026
…nch-colab

removed branch from colab git clone
abiswas-realadvice pushed a commit to abiswas-realadvice/unsloth that referenced this pull request May 14, 2026
* Fast inference repatch

* Update llama.py

* Update utils.py

* Update utils.py

* Update utils.py

* Update mistral.py

* Update __init__.py

* Fix inference

* Update mistral.py

* fast lm_head

* Remove fast path

* Update rope_embedding.py

* Update loader.py

* LlamaAttention_fast_forward_inference

* if past_key_value is not None and q_len == 1:

* revert inference

* Update loader.py

* past_key_value

* Update llama.py

* Update llama.py

* Fix SDPA

* Update llama.py

* padding

* Inference

* Update llama.py

* Revert

* Update mistral.py

* faster inference

* inference

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* inference

* Update llama.py

* Update utils.py

* faster inference

* Update llama.py

* revert

* lm_head

* Update llama.py

* inference

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update mistral.py

* Update llama.py

* faster inference

* Update llama.py

* fast inference

* Update llama.py

* Update llama.py

* Update mistral.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* torch compile

* past_key_values

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update utils.py

* Update utils.py

* Update utils.py

* Update utils.py

* Update llama.py

* fast inference + saving config.json

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update mistral.py

* fast inference again

* more temp matrices

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* fast inference

* Update mistral.py

* Update llama.py

* SDPA

* attention_mask

* New version

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update utils.py

* Update utils.py

* Update save.py

* Update save.py

* Torch 2.2.0

* Update save.py

* mistral swa

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Fix SWA inference

* Fix llm_int8_skip_modules

* SWA inference

* Update save.py

* Update save.py

* Update pyproject.toml

* __version__

* __version__

* Update save.py

* Update save.py

* Update mistral.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Update llama.py

* Chat Templates

* Update chat_templates.py

* Update chat_templates.py

* Update chat_templates.py

* Update chat_templates.py

* patch tokenizer

* Update chat_templates.py

* Saving, LlamaRotaryEmbedding issues

* Update llama.py

* Update mistral.py

* Update mapper.py

* Fix RoPE precision issues

* Bugs

* saving bugs

* Update llama.py

* readme

* spaces

* spaces

* globals

* slash

* slashes

* spaces

* apache

* Update save.py

* Update save.py

* Update loader.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* trainer

* Update save.py

* Update pyproject.toml

* install

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* PeftModel token + saving

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* linking

* llama.cpp bugs

* Update save.py

* Update save.py

* saving

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update save.py

* Update __init__.py

* Update save.py

* Update save.py

* Update save.py

* save

* trainer

* spaces

* original
danielhanchen added a commit that referenced this pull request Sep 6, 2026
…ove 16 rows

unslothai/llama.cpp PR #187 (a1dd7c5e8) gives every pipeline group its own
speculative state, so --pipeline-groups N > 1 is accepted together with
--spec-type draft-mtp and with --model-draft. reconcile_split_speculation no
longer drops one of the two: it picks on the concurrency the load asked for
(the pass-through --parallel / -np, else the slot count), which is the same
number pipeline_groups_plan rounds the launched --parallel up from.

Measured on the pair, Qwen3.8-27B UD-Q4_K_XL split across the two Sparks,
npp 128 / ntg 256, --parallel 32 --cache-ram 0, two repeats, decode tok/s:

  rows | 1 context + MTP | 2 groups | 2 groups + MTP
     8 |      94.6       |   52.8   |      84.6
    32 |     113.6       |  112.2   |     131.1

At 32 rows both together are 1.15x one context with MTP and 1.17x the groups
alone (1.17x and 1.16x on the best cells); at 8 rows two groups halve the rows
per group and one context with MTP wins. Nothing was measured in between, so
the crossover is the geometric midpoint, 16, with both sides measured. The
table, the ratios and groups_x_mtp_note / groups_x_mtp_wins are in
studio/spark_cluster.py beside the PIPELINE_GROUPS_* and MTP_* tables, and
spark_serving mirrors the three numbers it decides on.

The server has to have the per-group state before the combination is asked
for: llama_server_accepts now probes with more than one flag, and
llama_server_accepts_groups_with_drafter passes --pipeline-groups N
--spec-type draft-mtp for real ahead of --help, because the fork prints
neither the flag nor the refusal in its usage. A build that refuses the pair
falls back to what this did before, keep the speculation and drop the groups.
--parallel stays a multiple of the group count, and --mmproj, control vectors
and --sleep-idle-seconds still cost the groups outright, whatever the
speculation (extra_args_refuse_pipeline_groups).

The status surface says which of the three ran and why, in split_config and
split_config_reason beside mtp.

Tests: the crossover above and below (and at 16), a server that refuses the
pair, --parallel not a multiple of the group count, mmproj / control vector /
idle sleep, and a user overriding either flag; plus a check that the mirrored
constants are the planner's measured cells. studio/backend/tests
test_spark_serving.py and test_spark_router.py: 61 passed.

Inert off a Spark with a peer, no new dependency, nothing outside the Spark
serving path.
danielhanchen added a commit that referenced this pull request Sep 6, 2026
…he flag the product launches

The GROUPS_X_MTP_* constants were measured by a hand harness that did not pass
--kv-unified. Studio puts it on every GGUF load, so the constants described a
launch the product never makes. Measured directly at 32 rows on a two-group
split, everything else equal, it is worth 1.27x (137.1 -> 173.7 tok/s), and
--no-context-shift is worth nothing outside noise.

Re-measured on the pair: Qwen3.8-27B UD-Q4_K_XL, --rpc peer --device RPC0,CUDA0
-sm layer --cache-ram 0 -c 16384 --parallel 32, real-text prompts, npp 128 /
ntg 256, the fork of PR #187 at a1dd7c5e8 on both nodes, all four arms at 8 and
32 concurrent, forward then reversed arm order, every cell with --kv-unified.

Both nodes were pinned at 300,1700 MHz for the whole block. The first attempt
was not, and its eight cells spanned three clock states: local capped six minutes
in and the peer nine minutes after that, so no two arms were comparable and it
was discarded. The pin costs about 5 to 7 percent against an uncapped node, which
is small because the decode is memory bound, and it applies to every arm equally.
No cell in the pinned block straddled anything.

  rows | 1 context  | 1 context + MTP | 2 groups   | 2 groups + MTP
     8 | 51.2  51.6 |   91.3   84.3   | 50.6  48.9 |   88.1   81.6
    32 | 96.4  97.9 |  111.0  113.2   |145.7 133.3 |  154.9  150.2

What --kv-unified changes is the two-group arms and nothing else: one shared KV
buffer only pays once the rows are split over two groups. So the win above the
crossover grew, 1.36x of one context with speculation rather than 1.15x, and the
loss below it shrank, 0.97x rather than 0.89x.

The crossover does not move. The winner still flips between the two measured
points, one context with speculation at 8 rows (in both passes, 0.96x and 0.97x)
and both together at 32; nothing between them has been measured; 16 remains the
geometric midpoint of the two bracketing points with both sides measured. What
changed is the stakes: above 16 rows the prize is larger than the old constants
claimed, and below it the two configurations are within 3 percent, so choosing
wrong there costs little.

Acceptance is unchanged by the second group, 0.75 / 0.70 with one context against
0.74 / 0.71 with two, so splitting the rows across two draft contexts costs the
draft head nothing.

GROUPS_X_MTP_ONE_SPARK_MTP_TOKS is the one row not re-measured and is marked as
such: it carries neither the flag nor the pin, and is used only for the wide
margin at 8 rows.

A test now requires GROUPS_X_MTP_MEASUREMENT and the spark_serving mirror to name
--kv-unified, so the next re-measurement has to state the argv it measured.
danielhanchen added a commit that referenced this pull request Oct 18, 2026
An S-stage RPC layer split with one context keeps one batch in flight and
runs at about one device. When llama-server supports --pipeline-groups
(unslothai/llama.cpp PR #187), pick S+1 groups if the slots give at least
16 sequences per group, else S, else none; UNSLOTH_CLUSTER_PIPELINE_GROUPS
overrides (0/off, a forced count, auto).

Every group gets the full -c, so the plan charges G contexts of attention
KV and compute scratch (recurrent state stays per sequence) and falls back
to fewer groups when that does not fit. Groups are skipped with a
projector, control vectors, --sleep-idle-seconds, no explicit context, or
a slot count they do not divide. The flag rides in the managed block, so a
reload strips it; a caller's own --pipeline-groups is kept and priced.

[skip ci]
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