From cc58402b715693a5b1195bce36a8323999c09aac Mon Sep 17 00:00:00 2001 From: Brandon Bertelsen Date: Thu, 29 Oct 2026 00:02:06 -0400 Subject: [PATCH] laya: a recipe rounding the release's f16 linears to bf16 --- data/recipes/laya-bf16.recipe | 21 +++++++++++++++++++++ docs/GUIDE.md | 6 ++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 data/recipes/laya-bf16.recipe diff --git a/data/recipes/laya-bf16.recipe b/data/recipes/laya-bf16.recipe new file mode 100644 index 00000000..dd90af3a --- /dev/null +++ b/data/recipes/laya-bf16.recipe @@ -0,0 +1,21 @@ +# laya-bf16.recipe -- Convai Innovations' Laya (laya, laya-typed-decisions, laya-multilingual) for the +# laya plugin (arch/laya). +# +# rad-convert convaiinnovations/laya-typed-decisions --recipe data/recipes/laya-bf16.recipe \ +# -o laya-typed-decisions.rad +# +# The release ships f16. The plugin reads its linears and tables in bf16, as the release computes them +# on a card under bf16 autocast, and f16 to bf16 rounds, so it is a rule here. Norms and biases are +# declared f32, an exact widening of f16, and no rule names them. +token_embd.weight cast dtype=bf16 +type_emb.weight cast dtype=bf16 +scorer.fc1.weight cast dtype=bf16 +scorer.fc2.weight cast dtype=bf16 +blk.*.attn_qkv.weight cast dtype=bf16 +blk.*.attn_out.weight cast dtype=bf16 +blk.*.ffn_in_gate.weight cast dtype=bf16 +blk.*.ffn_down.weight cast dtype=bf16 +head.*.attn_qkv.weight cast dtype=bf16 +head.*.attn_out.weight cast dtype=bf16 +head.*.ffn_up.weight cast dtype=bf16 +head.*.ffn_down.weight cast dtype=bf16 diff --git a/docs/GUIDE.md b/docs/GUIDE.md index c7a483c8..c087d885 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -2851,7 +2851,8 @@ runs the encoder and head in the `laya` plugin (`arch/laya`), on the embedding p every question of a request in one step, each answered in its pooled row. ```sh -rad-convert /srv/models/laya-typed-decisions -o laya-typed-decisions.rad --set decision.type=laya +rad-convert /srv/models/laya-typed-decisions -o laya-typed-decisions.rad --set decision.type=laya \ + --recipe data/recipes/laya-bf16.recipe radiance --model laya-typed-decisions.rad --port 8000 ``` @@ -2859,7 +2860,8 @@ rad-convert reads the release's folders: `encoder/config.json` for the geometry, `rl_agent_config.json` for the sequence budget and the fitted temperatures, and `tokenizer/`. The checkpoint's `config.json` already says `model_type: laya`, so `--set decision.type=laya` is optional. A checkpoint as the `laya` package downloads it, with no `config.json` of its own, -converts the same way. +converts the same way. The release ships f16 weights, and the recipe rounds the linears and tables +to bf16, which is how the release computes them on a card. The request and the response are the same as d1's above. What differs: