Skip to content

MOSS: line breaks, negative prompt and an opt-in layout; fix VIP junk slots - #267

Merged
iamwavecut merged 1 commit into
mainfrom
feat/moss-layout-route
Oct 20, 2026
Merged

iamwavecut merged 1 commit into
mainfrom
feat/moss-layout-route

Conversation

@iamwavecut

Copy link
Copy Markdown
Owner

Summary

  • Line breaks. Every slot keeps the user's line breaks inside quoted text as \n; a literal backslash-n (double escaping) is normalized to a line break.
  • Negative prompt. With a MOSS-Image slot the optimizer also returns slot_moss_negative (up to three phrases the request excludes, e.g. "без шапки" → hat, text after |). The bot sends it — or the typed negative of a verbatim !draw — to moss_generate only; draw-api appends its general negative (iamwavecut/aifarm-draw#37).
  • Layout, opt-in. "prompt_layout": true in the MOSS model config adds slot_moss_design + slot_moss_layout (official summary + flat items, yxyx on a 0-1000 grid) to the prompt and schema, and the bot sends a designed picture's layout to moss_generate. Default off: in the A/B the prose route drew all text correctly, the layout route did not.
  • VIP junk slots (production bug). The schema serializes keys alphabetically, so the grammar-constrained Gemma writes aspect_ratio, input, nsfw_result, outputs; the examples were in another order. In the three-slot VIP call the model then wrote a field name such as nsfw_result_slot_0_1_2 as a prompt or looped until the token limit. Examples now follow the grammar order, the slot rules say every element is a full prompt, and replace_placeholder_outputs swaps a placeholder for the nearest real prompt.

Evidence

  • Production Gemma (as a client), VIP Krea 2 + FLUX.3 + MOSS: original prompt 44 % bad answers; slot instruction alone 4/16; examples in grammar order 0/24. Exclusions extracted correctly in 24/24 (hat, people, people, boats, people, plants, empty otherwise). User line breaks reached all three slots in 2/2 requests.
  • MOSS A/B (RTX 4090, production settings, 12 requests × 2 seeds, 96 images): prose route all text correct on 12/12 designed images; layout route had a typo, a stray sign, a card drawn as a mock-up, a style drift; negatives changed nothing visibly.

Tests

  • cargo test --locked --workspace, cargo clippy --locked --workspace --all-targets --all-features -- -D warnings, cargo fmt --all -- --check: pass.
  • New: schema gating (slot_moss_negative only / with layout), prompt_layout from the routed model config, layout and negative reach only the MOSS endpoint and stay with their slot, placeholder replacement, forbidden requests drop the MOSS fields, word replacements reach layout captions but not lettering, and examples_write_their_keys_in_the_order_the_grammar_does.

… slots

Line breaks: every slot keeps the user's line breaks inside the quoted
text, written as \n in the JSON string; a literal backslash-n from a
model that escapes twice becomes a line break.

Negative prompt: a call with a MOSS-Image slot also returns
slot_moss_negative, up to three short phrases the request rules out
("без шапки" gives "hat", the text after `|`). The bot sends it, or the
typed negative of a verbatim !draw, to the moss_generate endpoint only;
draw-api appends its general negative.

Layout: with "prompt_layout": true in the MOSS model config, the optimizer
also writes slot_moss_design and slot_moss_layout (official summary plus
flat items, yxyx boxes on a 0-1000 grid) and the bot sends the layout of a
designed picture to moss_generate. Off by default: in an A/B at
production settings (12 requests, 2 seeds) the prose route drew all text
correctly and the layout route did not.

VIP junk slots: the optimizer schema serializes its keys alphabetically,
so the grammar-constrained model writes aspect_ratio, input, nsfw_result,
outputs. The examples were written input, outputs, nsfw_result,
aspect_ratio; after the first prompt they promised nsfw_result, and in
the three-slot VIP call the model wrote a field name such as
"nsfw_result_slot_0_1_2" as the next prompt or looped in it to the token
limit (44 % of answers on production Gemma). The examples now follow the
grammar's order, the slot rules say every element is a full prompt, and a
placeholder output is replaced by the nearest real prompt: 0 of 24 bad
answers. A test keeps the examples in the schema's key order.
@github-actions

Copy link
Copy Markdown
Warnings
⚠️ Prompt files are cache-sensitive contracts; confirm prompt shape and role markers were preserved intentionally.
Messages
📖 Danger checked 7 changed file(s).

Generated by 🚫 dangerJS against b7dd3f7

@iamwavecut
iamwavecut merged commit a3619ca into main Oct 20, 2026
12 checks passed
@iamwavecut
iamwavecut deleted the feat/moss-layout-route branch October 20, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant