► KerasHub: Pretrained Models / API documentation / Model Architectures / MuseGlimmer / MuseGlimmerAssistantCausalLM model

MuseGlimmerAssistantCausalLM model

[source]

MuseGlimmerAssistantCausalLM class

keras_hub.models.MuseGlimmerAssistantCausalLM(
    backbone, block_size=16, mask_token_id=None, **kwargs
)

A DFlash block-diffusion drafter for speculative decoding.

Drafts an entire block_size-token block of denoised hidden states in one forward pass, conditioned on hidden states pulled from several layers of the separate, larger MuseGlimmer target model. The target model then verifies the block in parallel. Origin: DFlash (arXiv:2602.06036).

Unlike a standard causal-LM drafter, this model has no vocabulary and no LM head. It predicts continuous denoised block hidden states, not discrete tokens. It must NOT be used standalone — call() and generate_step() both raise NotImplementedError. Pass this model as assistant_model to keras_hub.models.MuseGlimmerCausalLM.generate() for end-to-end speculative decoding — that path calls call_with_cache(), which persists the context stream across drafting cycles (matches modeling_muse_glimmer_assistant.py's real forward(), which is likewise always called with a real DFlashCache from the actual speculative-decoding driver, DFlashTokenCandidateGenerator.get_candidates() — its cache-free mode exists on the base class but is never exercised in practice).

Arguments

  • backbone: A keras_hub.models.MuseGlimmerBackbone configured with the drafter's own dimensions and use_bidirectional_attention=True, context_projection_layer_ids set to the target model's target_layer_ids, use_external_embeddings=True, enable_qk_scale_and_gate=False, qk_norm_with_scale=True, use_sandwich_norm=False, and use_centered_norm=False.
  • block_size: int. Number of denoised-block positions drafted per forward pass. Defaults to 16.
  • mask_token_id: int. Token id used to fill the noise/mask positions of the block, one anchor token followed by block_size - 1 copies of this id, before embedding via the target model's own token embedding table. Required for speculative decoding via MuseGlimmerCausalLM.generate(assistant_model=...).

Example

target = keras_hub.models.MuseGlimmerCausalLM.from_preset(
    "muse_glimmer_30b"
)
assistant = keras_hub.models.MuseGlimmerAssistantCausalLM.from_preset(
    "muse_glimmer_30b_assistant"
)
# The assistant drafts each block. The target verifies the block.
target.generate(
    "What is Keras?", max_length=64, assistant_model=assistant
)

[source]

from_preset method

MuseGlimmerAssistantCausalLM.from_preset(preset, load_weights=True, **kwargs)

Instantiate a keras_hub.models.Task from a model preset.

A preset is a directory of configs, weights and other file assets used to save and load a pre-trained model. The preset can be passed as one of:

  1. a built-in preset identifier like 'bert_base_en'
  2. a Kaggle Models handle like 'kaggle://user/bert/keras/bert_base_en'
  3. a Hugging Face handle like 'hf://user/bert_base_en'
  4. a path to a local preset directory like './bert_base_en'

For any Task subclass, you can run cls.presets.keys() to list all built-in presets available on the class.

This constructor can be called in one of two ways. Either from a task specific base class like keras_hub.models.CausalLM.from_preset(), or from a model class like keras_hub.models.BertTextClassifier.from_preset(). If calling from the a base class, the subclass of the returning object will be inferred from the config in the preset directory.

Arguments

  • preset: string. A built-in preset identifier, a Kaggle Models handle, a Hugging Face handle, or a path to a local directory.
  • load_weights: bool. If True, saved weights will be loaded into the model architecture. If False, all weights will be randomly initialized.

Examples

# Load a Gemma generative task.
causal_lm = keras_hub.models.CausalLM.from_preset(
    "gemma_2b_en",
)

# Load a Bert classification task.
model = keras_hub.models.TextClassifier.from_preset(
    "bert_base_en",
    num_classes=2,
)
Preset Parameters Description
muse_glimmer_30b_assistant 2.56B MuseGlimmer 30B DFlash Assistant model: 5-layer speculative-decoding drafter for the 30B model. Drafts a 16-token block-diffusion denoised block per forward pass, conditioned on the target model's hidden states. This model must NOT be used standalone. It is designed exclusively as a draft model used from the target model's generation loop.
muse_glimmer_30b 29.78B 30B-parameter dense causal decoder with an attached windowed-attention perception encoder, distilled from Muse Spark for local agentic use.

backbone property

keras_hub.models.MuseGlimmerAssistantCausalLM.backbone

A keras_hub.models.Backbone model with the core architecture.