Skip to content

Releases

mojo-dllm 0.3.0

Choose a tag to compare

@vladimirrott vladimirrott released this 24 Nov 23:13
b7ba024

Added

  • A scorecard workflow runs the OpenSSF Scorecard weekly, on pushes to main and when branch protection changes, and
    publishes the result, so the Scorecard API and a README badge have data. It reports and never gates, and it uploads
    no SARIF.
  • mojo-dllm --version prints a second line, commit: <id>, with the 12-character short id of the commit the binary was
    built from (issue #113, pull request #167). -dirty follows the id when git status reports changes under src/ at
    build time, and unknown stands in for a build without Git metadata or one that did not go through scripts/build.sh.
    scripts/build.sh passes the id as -D MOJO_DLLM_GIT_SHA=g<id> and build_id() removes the g: the compiler reads a
    define of digits only as a number and would drop the leading zeros of an id such as 000000123456.
    scripts/check_build_id.sh builds the binary and compares the line (CI and ci-local.sh --full run it), and
    tests/python/test_build_stamp.py pins the stamp rules against real temporary repositories. The run --json key set
    is unchanged.
  • A Dream run accepts --remasking origin and --remasking random (issue #40, pull request #68). origin follows the
    Python reference: each masked position commits independently with probability 1 - s/t, forced to 1 at the final
    step. random follows llama.cpp: a uniform random confidence per candidate, then the scheduled top-k. Both use
    --seed; the default stays entropy. --no-suppress-mask allows the mask token as a sampled answer again.
  • Optional DiffusionGemma graph traces (--trace-dir, --trace-only) and
    ordinary-buffer replay (--no-repack). scripts/build_dg_ref.sh also builds
    dg_matmul. The projection, matrix, softmax and tiny-model checkers, together
    with compare_dg_traces.py, record the cached/unified arithmetic differences
    and independent forward comparisons for #163.
  • run and tokenize take --prompt-file PATH in place of --prompt (issue #104, pull request #157). - reads standard
    input, one trailing newline is removed, and a file that cannot be read exits 1 before the model is mapped. Both flags, or
    neither, exit 2. Tests now reach the flag through execute for each command: the unit tests called resolve_prompt
    directly, so deleting either call in main.mojo passed all of them.
  • run reads a default for ten value flags from MOJO_DLLM_* variables (issue #122, pull request #191): MODEL,
    MAX_TOKENS, STEPS, BLOCK_LENGTH, SEED, TEMPERATURE, THREADS, DEVICE, REMASKING and THRESHOLD. A flag on
    the command line wins, an empty variable counts as unset, --verbose reports each value that came from a variable on
    stderr, and a bad numeric value names its variable. scripts/check_env.sh drives the real binary through those rules
    (CI and ci-local.sh run it), and docs/cli.md says which scripts need the variables unset.
  • Dream takes --eps F, the final timestep of its schedule (issue #30, pull request #283): 0.001 by default, at least 0
    and below 1. LLaDA and DiffusionGemma refuse it. The schedule lives in dream_transfer_probability and
    dream_n_transfer, so origin remasking and the top-k paths both follow it.

Changed

  • DiffusionGemma's dg-fixed-input-v1 comparison uses the reference's cached/unified
    spread for each prompt and self-conditioning state. It checks the local reference
    against the recorded calibration before evaluating candidate logits, verifies the
    candidate receipt, and checks the model's absolute soft-cap. The calibration and
    fault controls are in bench/checks/2026-11-05-dg-sensitivity.json.
    bench/check_dg_bound.py make-mutant --record saves the changed tensor, sizes and hashes.
  • The mask token can no longer be sampled (issue #40, pull request #68): argmax, the softmax normalizer and Gumbel
    selection skip it, and the Gumbel draw for the skipped candidate is still consumed, so the random stream does not
    move. --no-suppress-mask restores the old behavior for parity experiments. On GPU, suppression turns the device
    row-statistics path off, so LLaDA at temperature 0 and every Dream run copy the logits back to the host (32 rows of
    126,464 floats per LLaDA step); --no-suppress-mask keeps the device path. Excluding the mask inside the
    row-statistics kernel is tracked in #284.
  • GenConfig.mask_id is gone again, as 0.2.0 announced: pull request #68 had added it back with -1 meaning "the model's",
    and no code outside the tests set it. The loops read model.config().mask_id.

Fixed

  • DiffusionGemma refuses an untied output.weight and the seven per-block projection scales (attn_q, attn_k, attn_v,
    attn_output, ffn_gate, ffn_up, ffn_down) by name (issue #170, pull request #293). llama.cpp applies them and this
    loader ignores them, so such a file used to answer with wrong logits. logits now says how many tokens --tokens must
    hold, and an unknown --device gets the same message in option validation and in dispatch.
  • The gemma4 tokenizer ends generation on the set llama.cpp builds (issue #171): <eos>, <turn|> and
    <|tool_response> by their text, plus the ids under tokenizer.ggml.eos_token_id, eot_token_id and eom_token_id,
    each once. A file whose eos_token_id is missing or names another token now stops at <eos> too. The special tokens
    are sorted longest first with a stable merge sort instead of an insertion sort, which was quadratic in their number.
    Neither change moves an id on the DiffusionGemma file.
  • The action-pin check fails when the TruffleHog version input in secret-scan.yml is not the release its pin comment
    names without the v (issue #146): a Dependabot bump moves the pin and leaves the scanner image tag behind. The
    workflow comments now say what runs: a push to main and the weekly run pass no base, so each scans the full history
    that leads to the commit, not the working tree. The check also refuses a TruffleHog step with no version input, whose
    default is latest, and it reads the steps of composite actions under .github/actions as well as those of workflows.
  • ./mojo-dllm doctor refuses any argument with exit 2 and runs no probe (issue #80, pull request #288): doctor --jsno
    used to print the normal report and exit 0. doctor -h and doctor --help still print the help.
  • --remasking origin was refused before the model loaded: the accepted names listed five values and left out origin.
    docs/cli.md now says Dream takes all six names and LLaDA refuses entropy, maskgit_plus, topk_margin and origin.
  • ./mojo-dllm run with the default --device auto no longer stops when nvidia-smi prints a line the launcher cannot
    read (issue #81): like a missing, failing or timed-out nvidia-smi, it runs on the CPU and prints
    device: cpu (nvidia-smi failed: nvidia-smi printed a line the launcher cannot read: '...'). doctor and setup
    already went on with the CPU.

mojo-dllm 0.2.0

Choose a tag to compare

@vladimirrott vladimirrott released this 10 Nov 11:26
06a0cfb

Added

  • bench/engines/sglang.py, an engine for bench/eval_engine.py that answers GSM8K through the OpenAI-compatible
    endpoint of a running SGLang server (issue #180): --engine sglang --base-url URL, with the declared --dtype,
    --algorithm, --checkpoint, --max-running-requests and --chat-template. The request has four fields (model,
    one user message, max_completion_tokens, stream false) and never carries a field that the DiffusionGemma algorithm
    rejects with HTTP 400 (logprobs, a grammar, a penalty, a seed) or ignores (temperature, top_p, top_k). SGLang
    has no /version route, so the release,
    the diffusion algorithm, the dtype and the batch size come from GET /server_info and the checkpoint from
    GET /model_info. A declared value that contradicts a reported one is refused, a server that runs no diffusion
    algorithm or reports a quantization is refused, and the batch size must be 1 (reported or declared). The arm's
    model carries the dtype, so compare --across-weights sees different weights, and flags.model_matches_server is
    true only when --model is the checkpoint the server reports (false for an alias that matches the served name only).
    forward_passes is null in every
    row: SGLang exposes no per-request step count on main or in v0.5.23 (sgl-project/sglang#48675 was open and
    unmerged on 2026-11-09), and the engine never reads /metrics. The model-list and completion checks moved from the
    vLLM engine into bench/engines/_openai.py, unchanged, and both engines use them. The shared HTTP client also
    strips control characters from, and caps, the text of a connection or transport error, as it does for server text.
    docs/benchmarks.md has the runbook with the cookbook's serve command as read on 2026-11-09, the note that the bf16
    checkpoint is 48.1 GiB, the Vast.ai API key read into VAST_API_KEY instead of passed as an argument (a test scans
    the fenced blocks of the file for a key in an argument list), and a
    DiffusionGemma section that lists the llama.cpp reference, vLLM, SGLang and mojo-dllm rows, each marked
    no committed run yet. No server was run and the evaluation on a rented machine has not happened.
  • bench/engines/vllm.py, an engine for bench/eval_engine.py that answers GSM8K through the OpenAI-compatible
    endpoint of a running vLLM server (issue #179): --engine vllm --base-url URL --served-model NAME --quantization Q
    (and the declared --checkpoint, --attention-backend, --chat-template). It sends one chat message at
    temperature 0 and never starts or stops a server. version records the release GET /version reports plus the
    declared checkpoint, quantization and attention backend, and the arm's model carries the quantization so
    compare --across-weights sees different weights. forward_passes is the change of vLLM's
    vllm:diffusion_num_denoising_steps counter (read under that name and under its _total exposition name) across
    one request, null when the server has none, and refused unless --max-num-seqs 1 is declared, because the counter
    is server-wide. Server text in errors is stripped of control characters and capped, and the arm's --model must
    equal the server's reported root or served name. The
    run is refused for a served model the server does not list, an HTTP error, an empty completion or a response
    with no token counts. flags says "server": "remote": the isolation checks see only the client machine.
    bench/engines/_http.py is the shared standard-library client (no credentials, no cookies, no redirects, no
    retries, no environment proxy unless asked, a size bound and one deadline per request). docs/benchmarks.md has
    the runbook (rent, serve, run, destroy) with the recipe page's serve commands as read on 2026-11-09. No server
    was run and the evaluation on a rented GPU has not happened.
  • bench/engines/hf.py, an engine for bench/eval_engine.py that runs GSM8K through the authors' own sampling
    code (issue #178): generate from a checkout of ML-GSAI/LLaDA (--llada-repo, imported and never copied) and
    diffusion_generate from Dream's remote code, at temperature 0 with steps equal to the generation length.
    Options: --hf-model, --quant none|4bit, --model-revision and the shared --device. Each row's version
    records the model repository's commit sha (null when none was given), the LLaDA checkout's commit and the
    transformers, torch and bitsandbytes versions; flags records where a Dream run departs from its README.
    The adapter imports torch and transformers only when it loads a model, so the frozen environment and CI
    never need them. eval_gsm8k.py compare --across-weights compares arms that ran different model files and writes
    both names and weights_differ (compare writes models and weights_differ on every run now, and still
    refuses different models without the flag). docs/benchmarks.md explains why the arm's accuracy includes
    quantization and how to set up one environment per model. A Hugging Face repository now needs
    --model-revision (or --allow-unpinned), because the loader runs the repository's Python; the arm's model
    includes |4bit so compare sees quantization; the load is refused before from_pretrained when MemAvailable is below an estimate from the weights'
    size (and when that size or /proc/meminfo is unknown), and the preflight after the load asks for the 3 GB of
    working memory only. The memory-fit spike and the GSM8K arm of #178 have
    not run.
  • scripts/capped.sh runs a command in its own memory-capped systemd scope: a hard cap, no swap and a
    whole-scope kill on an OOM, so a job that outgrows the machine dies alone instead of taking its terminal with
    it. It refuses to start when less memory is available than the job needs or when the user manager cannot
    enforce limits. docs/development.md ("Heavy jobs") explains the settings and what does not isolate a job.
  • The DiffusionGemma reference (issues #66 and #62). scripts/build_dg_ref.sh
    builds the ggml-org/llama.cpp#24423 branch at a pinned commit, CPU only and
    offline, into its own tree beside the mainline checkout. tools/ref/dg_ref.cpp
    writes the canvas logits of one denoising step for a fixed prompt and canvas:
    the unified [prompt | canvas] pass or the prompt K/V path (prefill, then one
    decode step), each with or without self-conditioning from a given
    previous-step buffer. bench/parity.py --arch diffusion-gemma runs the
    reference phase, and a comparison phase that stops with a message until
    mojo-dllm's own outputs exist (#64). The comparison's bound comes from the
    LLaDA evidence plus a check on each row's largest logit, and every case
    records how far the reference lies from itself. bench/check_dg_bound.py
    shows the bound rejecting a missing final soft-cap and a dropped layer scale
    (bench/checks/2026-11-04-dg-bound.json). The tokenizer goldens for gemma4
    are in tests/fixtures/gemma4-tokenizer-golden.tsv, with their provenance.
  • DiffusionGemma's entropy-bounded denoiser (_generate_diffusion_gemma,
    issue #65): a random canvas over the whole vocabulary, a per-position
    argmax, entropy and draw from one pass over each logits row, acceptance of
    the lowest-entropy positions while the entropies before them sum to at most
    the bound, and a stop once the argmax canvas holds and the mean entropy is
    small. Six flags (--eb-steps, --eb-t-min, --eb-t-max, --eb-bound,
    --eb-stability, --eb-confidence) default to the llama.cpp branch's
    values. --json gains steps_taken and stop_reason for every model. The
    forward pass is #64, and #277 tracks wiring it to this loop; tests use a scripted model.
  • scripts/check_weights.py compares GGUF tensor shapes with safetensors
    headers, with LLaDA/Dream name mapping and a standalone self-test.
  • Q8_0 and Q5_K reference decoders, with GGUF type sizing and reference tests
    for Q8_0, Q5_K and BF16. Matrix kernel support remains Q4_K and Q6_K.
  • A Q5_0 reference decoder (22-byte blocks of 32 weights) with GGUF type sizing,
    a reference test against gguf-py's decoder and a hand-built block test of the
    high-bit layout. It is the first piece of the DiffusionGemma reader (#61).
  • A diffusion-gemma branch of ModelConfig reads the DiffusionGemma
    metadata (per-layer sliding/global pattern and K/V head counts, head sizes and
    RoPE bases per kind, experts, canvas length, soft cap) and checks the tensor
    directory against it: attn_v exactly on sliding layers, K width, the 3-D
    expert tensors and the rope table. A wrong key or tensor is refused by name,
    as are non-zero attention.shared_kv_layers and
    embedding_length_per_layer_input. inspect prints the config. DiffusionLM
    and the GPU model stop on these files (#61). The key names come from the
    unmerged ggml-org/llama.cpp#24423.
  • DiffusionGemma, the CPU forward pass of DiffusionGemma, in
    models/diffusion_gemma.mojo (#64): one unified pass over [prompt | canvas]
    with sliding and global layers, the region masks, RoPE with rope_freqs,
    attention scale 1, the dense MLP plus 128-expert MoE, the two embedding and
    layer-scalar regions, the tied Q6_K head and the soft cap. mojo-dllm logits
    runs it. A numpy forward pass written from the llama.cpp branch
    (scripts/dg_numpy.py) checks it on a tiny fixture: most rows agree to 2e-7,
    a few to 7e-3 where an int8 rounding step lands on a tie. prefill and step
    run the prompt once and then the canvas against its cached K and V; they agree
    with the unified pass bit for bit on the tiny model. forward_sc and step_sc
    add self-conditioning: the previous step's logits, softmaxed at the previous
    temperature, go through the transposed embedding table and the self_cond
    MLP into the canvas embedding. logits --path cached --prev FILE --prev-temp-inv X reaches all four. The real-fi...
Read more

mojo-dllm 0.1.0

Choose a tag to compare

@vladimirrott vladimirrott released this 04 Oct 04:22

First release: CPU inference for two diffusion language models from GGUF.
Measured speed against llama.cpp and diffuse-cpp is in
docs/benchmarks.md; agreement with llama.cpp is in
docs/correctness.md.

Added

  • LLaDA-8B and Dream-7B from Q4_K_M GGUF files (F32, Q4_K and Q6_K tensors).
  • GGUF v2/v3 reader over a memory map, with mojo-dllm inspect.
  • Int8-activation GEMM over weights repacked 8 rows per register, using
    AVX-VNNI when present, with a work-claiming thread pool for hybrid CPUs.
  • Bidirectional attention with grouped-query heads; NORM and NEOX RoPE; Q/K/V
    bias; logits computed only for the positions a step samples.
  • Byte-level BPE tokenizers (bailingmoe, qwen2) matching llama-tokenize
    id for id on a 36-case multilingual corpus each.
  • LLaDA's block sampler (low-confidence or random remasking, Gumbel
    temperature) and Dream's timestep sampler (entropy, maskgit_plus,
    topk_margin).
  • mojo-dllm run, tokenize, inspect and logits.
  • Benchmark, parity and quality harnesses, with every published number
    rendered from their result files.
  • Local-first CI (scripts/ci-local.sh, git hooks) mirrored in GitHub
    Actions; mdBook documentation.

Measured (LLaDA-8B-Instruct Q4_K_M, i5-13420H, 12 threads, 32 steps)

Runtime ms / step tokens / s peak RSS
mojo-dllm 3,005 1.33 5.9 GB
llama.cpp llama-diffusion-cli 5,807 0.69 8.4 GB

Medians of 9 runs from bench/results/2026-10-03-cpu-llada.json; the full tables, Dream-7B and diffuse-cpp included, are in docs/benchmarks.md.

Requirements

Linux on x86-64 with AVX2, about 6 GB free memory, and pixi. Build from source: pixi install && pixi run build. No binaries are attached: the Mojo runtime libraries a build links against ship under Modular's own terms (see NOTICE).