Skip to content

v0.51.2

Choose a tag to compare

@Helldez Helldez released this 02 Dec 20:20

Changed

  • --auto weighs a draft and a card's device cache on whole requests, prompt included (#794). A draft
    computes every prompt again in a narrower context of its own, and a card's expert cache computes a
    wide pass from the host's experts, so either can decode faster and serve a request slower: on a
    rented pair of 16 GB cards the model's own head took Qwen3.6-35B's decode from 83 to 107 tok/s and a
    4612-token prompt from 3208 to 1390 tok/s, and on one 16 GB card the cache decoded 52 tok/s against
    the fitter's 56.8 and computed that prompt at 1252 against 1896. Every load now records the prompt
    rate of the draft side it ran (spec_prompt_tps, drafter_prompt_tps, no_spec_prompt_tps, beside
    the device tier's), and the draft, the card's device tier and the shared-memory cache are settled on
    a request of the machine's own mix (request_costs in bmoe/serving_side.h, one rule for all three).
    Two sides' prompt rates are weighed only where they were measured on prompts alike in length,
    within a doubling of each other (prompt_lengths_alike, the length kept beside each rate as
    *_prompt_at): a prompt's rate grows with its length, and a rented 16 GB card read 63 tok/s for a
    device cache timed on a 40-token prompt against 571 for the fitter's placement on 4612 tokens, where
    the cache computed those 4612 tokens at 1890. Otherwise the decode decides, as before, and no load is
    opened only to time a side's prompt. A drafting load's served rate now counts the draft's own passes, which had kept the head at
    153 tok/s where it served 107.

  • One rule settles every decision fixed at load (#786). The device tier, the graph width, the
    shared-memory device, the device cache in shared memory, the experts' copy and the draft each wrote
    out "a side that failed to open loses; the other takes over only past the margin" for themselves.
    They now call one function, challenger_wins (bmoe/serving_side.h), which weigh_sides uses too.
    Plans are unchanged (the planner test's whole output is identical), except where both sides of a
    decision have failed to open twice on a machine: the side in force now stands, where before each
    decision picked one of its own.

  • The sides of the decisions fixed at load are one table, not five copies. The device tier, the
    graph width, the shared-memory device, the experts' copy and the draft each kept a decode rate, a
    prompt rate and a failed-open count per side, and every place that wrote, read, merged, counted or
    checked them named each field by hand. One table in measured_knobs.cpp now names them, and each of
    those places walks it: a new decision is its fields and its rows. The record's rates of a side are
    now written only once measured, as the later decisions' already were; a missing rate reads as not
    measured, as 0.000 did, so a record written before reads the same. Plans are unchanged.

  • The welcome of an empty conversation says what the engine does, by one rule on every UI. Since
    the strip over a conversation went (0.51.1), the welcome was the only place its words were shown,
    and it is shown only before the first message: the words for an answer being written, read from
    the disk, answered, stopped or failed could no longer appear. They are gone from the web UI, the
    Android app and the iPhone app alike, with the state each was computed from; the welcome says the
    engine's state, and once a model can answer, that nothing leaves the device.

  • Code nothing called any more is gone: a page-cache reader (read_through_cache), a store call
    that removed one item of a conversation, a provider-stream accessor, the router hook's by-name map
    of weight leaves (the by-address list is what the dense policy reads), and ten UI strings.

  • chat_turn_parse also walks each template's tool grammar over the template's own tool call,
    token by token, with thinking on and off: a grammar that refuses the prompt or a token switches
    itself off for every tool turn with a warning only, which several templates risked when 0.51.0
    turned their grammar from lazy to on from the first token.

Fixed

  • A model larger than the memory loads without first reading the whole file (#777). llama.cpp's
    loader prefetched every file it maps whole (WILLNEED), which for a model larger than the RAM read
    pages that were dropped before use and held the load back: on a phone with 22.9 GiB a larger model
    was ready after 46 s instead of 10-14 s and the server was killed by the low-memory killer, and on a
    16 GB Mac the same advice cost ~90 s against 3-5 s (#627). The pinned fork branch now skips that
    prefetch where the files exceed the free memory the CPU backend reports, and logs it; a model that
    fits loads as before. By @intel00000 and @pt7777 (Helldez/llama.cpp#3)
    (seam.md).

  • A draft --auto arms is placed with room for it, on every machine. The rules decide the draft
    after the fitter placed the model without it, and only a card's device expert cache gave it room;
    beside a model held whole on a card, or in memory a device shares with the host, its block, its
    context and the rows of the target's hidden states it reads were in no figure the plan was made
    from. The plan is now placed again with the draft armed, as a draft typed for the run is
    (plan.layout.draft), so the fitter gives it room and the rules charge it wherever the memory is;
    a draft the fitter cannot place beside the model is not armed. Where the fitter placed the model
    with its own MTP head, the head's block is no longer charged a second time out of a device cache.

  • A card with a device expert cache no longer aborts on a long prompt when --auto drafts with the
    model's own MTP head.
    The plan priced the head at the tensors that mark it (nextn.*, 8 MiB for
    Qwen3.6-35B) where llama.cpp loads its whole block, attention and experts, beside the target (~575
    MiB), so the cache it gave up for the head was ~380 MiB short. On a rented 16 GB card the load the
    plan armed the head on aborted in cuBLAS ("the requested functionality is not supported") on a
    4612-token prompt, in 0.51.1 as in this release's candidate; a head typed with --mtp was sized
    right, as the fitter places it. ModelProfile::mtp_block_bytes is now its whole block, and a gate
    holds it to the file.

  • The device answer check reads a model larger than the memory as the stream does (#792). Before
    a load serves a model from a device, it compares the device's answers with a reference on the cores.
    That reference was the same file loaded whole and mapped, so for a model larger than the memory the
    cores faulted its experts in a page at a time: on a 16 GB laptop the first load that moved
    Qwen3.6-35B-A3B Q4_K_M's experts onto the GPU spent 31.7 s on the reference (35.4 s on the check,
    43 s to load), and Inkling 2 Mini 40.7 s. The reference is now the configuration the load would
    reopen with instead of the device (the plan's other part, else the same configuration on the
    cores), opened the way it serves: a model it streams goes through the streamer's own reads, with no
    expert cache and its dense weights left mapped, so it takes no memory the device holds. Measured
    on the same laptop: reference 12.4 s, check 16.1 s, load 24 s for Qwen3.6, and 17.7 s for Inkling's
    reference, with the same verdict to the last digit (top token 97% and 100%, the same NMSE and KL),
    since the stream computes the same bytes. A model held whole is compared as before. About 7 s of
    what is left is llama.cpp's read-ahead of the whole file at open (#777), and on Inkling the device's
    own 64-token graph from its expert cache (20 s) is the larger part.

  • The web UI works on a server reached over the network (#783). On a server bound beyond
    loopback (--host 0.0.0.0, the service included), the UI opened from another machine through the
    server's name or LAN address was refused by its own server on every request (cross-origin request refused): only the loopback origins counted as its own, and --allow-origin '*' is not a wildcard.
    A page whose origin is the address the request was sent to is now the server's own: through an
    address literal always, through a name only where an API key is set (without one, a name could be
    a DNS-rebinding page's; --allow-origin http://name:port admits it). A page on
    another port or scheme is still refused, a loopback server still answers only to loopback names,
    and beyond loopback the key still gates the API (server-api.md). Reported by
    @Shotgun167 on #472.

Contributors: @intel00000 and @pt7777 (the llama.cpp loader's prefetch skipped for a model larger than memory, Helldez/llama.cpp#3).