Skip to content

erllama 0.11.0

Latest

Choose a tag to compare

@benoitc benoitc released this 25 Aug 21:51
· 6 commits to main since this release

Changed

  • chat/3 defaults reasoning_format to deepseek: thinking models
    now return their thinking text in reasoning_content instead of
    inline in content (llama-server's default). Opt out per call with
    reasoning_format => none.
  • chat_apply/3 returns the template's constraint set alongside
    prompt and params: sampler_opts, stop_sequences,
    generation_prompt, supports_thinking, thinking_start_tag,
    thinking_end_tags. Merge sampler_opts + stop_sequences into
    the stream/3 options (the tool-calls guide shows how).

Added

  • erllama:fork_session/3: duplicate a sticky session's live KV into
    a new session (llama_memory_seq_cp), so two continuations explore
    different branches without re-prefilling the shared prefix. Works
    on every model family; never queues (seq_capacity when no
    sequence is free).
  • Load progress: progress_to => Pid on load_model delivers
    {erllama_load_progress, ModelId, Float} messages (whole-percent
    throttled, final 1.0) while the GGUF loads.
  • Native logs: llama.cpp / ggml log lines are forwarded into logger
    under the domain [erllama, native], gated by the native_log_level
    application env (none | error | warning | info | debug, default
    warning).
  • Full llama.cpp sampler surface as request options: typical_p,
    top_n_sigma, xtc_probability / xtc_threshold,
    dynatemp_range / dynatemp_exponent, min_keep,
    frequency_penalty / presence_penalty / penalty_last_n, DRY
    (dry_multiplier, dry_base, dry_allowed_length,
    dry_penalty_last_n, dry_sequence_breakers), mirostat (1 | 2)
    with mirostat_tau / mirostat_eta, logit_bias, ignore_eos
    and infill. Chain order follows llama.cpp's default; see the
    sampling reference in the configuration guide.
  • Per-token logprobs: logprobs => N (1..32) emits
    {erllama, Ref, {logprobs, #{token_id, logprob, top}}} stream
    events and adds a logprobs list to complete/3 / collect/2
    results. Full-vocab log-softmax over the raw model distribution
    (OpenAI semantics).
  • erllama:vocab_info/1: vocabulary size, add_bos / add_eos, and
    the special / FIM token ids (bos, eos, eot, sep, nl,
    pad, mask, fim_pre, fim_suf, fim_mid, fim_pad,
    fim_rep, fim_sep) for fill-in-the-middle prompt assembly.
  • erllama:detokenize/3 with remove_special / unparse_special
    (renders special tokens), backed by llama_detokenize.
    detokenize/2 is untouched: the cache byte-keys are computed over
    its output.
  • Tool-call grammar enforcement: chat/3 merges the grammar llama.cpp
    synthesizes from the chat template into the request, so
    tool_choice => required always yields a parsed call and
    tool_choice => auto arms a lazy grammar that constrains the reply
    once the model opens a call. Template-declared stop strings are
    honoured. A caller grammar combined with active tools is rejected.
  • json_schema chat option (OpenAI response_format semantics): the
    reply's content is grammar-constrained to the schema. Rejected in
    combination with tools.
  • Chat options enable_thinking (default true) and
    continue_final_message (none | auto | content | reasoning) for
    assistant prefill.
  • Request options grammar_lazy, trigger_patterns,
    trigger_tokens, grammar_prefill: the lazy / template-grammar
    sampler shape (llama_sampler_init_grammar_lazy_patterns), usable
    directly with stream/3 and friends.

Fixed

  • Cache correctness on recurrent / hybrid models (Mamba, RWKV, Jamba,
    Qwen3-Next, LFM2, ...): a warm exact hit no longer duplicates the
    last prompt token when the memory refuses the primer's partial
    removal; the engine falls back to a cold prefill and bumps the new
    restore_failed counter. A failed kv_unpack no longer crashes the
    model process (the row is treated as a miss).
  • Partial warm hits (extended prompts) prefill the suffix directly
    instead of dropping and re-decoding the last cached token: one fewer
    decoded token per partial hit, and no partial seq_rm, so the path
    stays warm on recurrent models.
  • nif_kv_seq_rm refreshes the per-seq position bookkeeping on
    failure too, keeping Erlang and llama.cpp in agreement when a
    partial removal is refused.

Added

  • Model-family probe at load: model_info/1 reports arch,
    n_ctx_train, n_params, n_embd, n_layer, n_swa,
    recurrent and hybrid (llama backend). Encoder-decoder (T5) and
    diffusion archs are rejected at load with
    {error, {unsupported_model, encoder_decoder | diffusion}} instead
    of failing confusingly at the first decode.
  • Context option n_rs_seq (recurrent-state rollback snapshots per
    seq); defaults to 1 on recurrent / hybrid models so warm hits work
    where the arch supports rollback.
  • split_mode => tensor (experimental upstream tensor-parallel
    split; row is deprecated upstream).
  • Cache counter restore_failed; stub backend knobs
    fail_seq_rm_last / fail_kv_unpack to test the fallback paths.