[GH-ISSUE #3225] [Feature]: Toggle for Dynamic LLM Prompt Generation in GM Mode Assets #1735

Closed
opened 2026-10-21 05:42:09 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @RyushoYosei on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3225

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

The current GM Mode image generation relies on rigid, hardcoded prose templates in the prompt review panel (e.g., aggressively forcing a humanoid fallback rule: "Unless the description says otherwise, do not infer an animal species...").

While this prevents wild hallucinations on cloud image APIs, it completely breaks compatibility for local text-to-image pipelines. Local diffusion checkpoints—especially fine-tunes like Illustrious or SDXL—rely heavily on dense tag weights and completely choke on conversational, negative prose structures.

Furthermore, applying a hardcoded "humanoid/person" bias template universally across GM Mode bleeds into and muddies up non-character assets like environmental backgrounds and cinematic action scenes. By trying to hardcode these limits to save minor text token overhead, the current setup ironically makes the feature work only with massive cloud LLMs, locking out local hardware setups.

Proposed solution

Add an optional settings toggle under the Illustrator / Image Generation configuration:
[ ] Enable Dynamic LLM Prompt Generation for GM Mode Assets

When enabled, instead of wrapping the asset context in a hardcoded prose template, the engine sends a quick, dedicated text API call to the connected LLM. The LLM is tasked with translating the active context into a highly optimized positive prompt string before passing it to the image provider.

This should apply universally across all three image generation triggers in GM Mode:

  • NPC Portraits: Allows clean tag weights for diverse character species/races without arbitrary human-bias text overrides.
  • Backgrounds: Prevents hardcoded character/humanoid rules from bleeding into and ruining environmental landscape generation.
  • Key Moments: Gives the LLM the freedom to describe complex cinematic action prompts dynamically without being chained to a static template.

Alternatives considered

Leaving the templates as hardcoded text strings was considered, but it fundamentally breaks local image generation workflows. Because local models require specialized formatting (like raw Danbooru / e621 style tag layouts), a static conversational template cannot serve both cloud APIs and local checkpoints simultaneously.

Additional context

This infrastructure isn't a massive structural shift for the codebase—it is already proven to work seamlessly within Marinara Engine's own architecture via the "Selfie responses" mechanism in normal Chat Mode. This suggestion simply extends that flexible, on-demand pipeline to GM Mode.

Additionally, making this an optional toggle completely protects the engine's token-conservation philosophy. Users who are highly sensitive to text API credits can leave it off and use the default baked-in string. Power users running local hardware or who don't mind the minor token cost can choose to flip it on.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @RyushoYosei on GitHub (Jul 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3225 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? The current GM Mode image generation relies on rigid, hardcoded prose templates in the prompt review panel (e.g., aggressively forcing a humanoid fallback rule: *"Unless the description says otherwise, do not infer an animal species..."*). While this prevents wild hallucinations on cloud image APIs, it completely breaks compatibility for local text-to-image pipelines. Local diffusion checkpoints—especially fine-tunes like *Illustrious* or *SDXL*—rely heavily on dense tag weights and completely choke on conversational, negative prose structures. Furthermore, applying a hardcoded "humanoid/person" bias template universally across GM Mode bleeds into and muddies up non-character assets like environmental backgrounds and cinematic action scenes. By trying to hardcode these limits to save minor text token overhead, the current setup ironically makes the feature work *only* with massive cloud LLMs, locking out local hardware setups. ## Proposed solution Add an optional settings toggle under the Illustrator / Image Generation configuration: `[ ] Enable Dynamic LLM Prompt Generation for GM Mode Assets` When enabled, instead of wrapping the asset context in a hardcoded prose template, the engine sends a quick, dedicated text API call to the connected LLM. The LLM is tasked with translating the active context into a highly optimized positive prompt string before passing it to the image provider. This should apply universally across all three image generation triggers in GM Mode: * **NPC Portraits:** Allows clean tag weights for diverse character species/races without arbitrary human-bias text overrides. * **Backgrounds:** Prevents hardcoded character/humanoid rules from bleeding into and ruining environmental landscape generation. * **Key Moments:** Gives the LLM the freedom to describe complex cinematic action prompts dynamically without being chained to a static template. ## Alternatives considered Leaving the templates as hardcoded text strings was considered, but it fundamentally breaks local image generation workflows. Because local models require specialized formatting (like raw **Danbooru / e621 style tag layouts**), a static conversational template cannot serve both cloud APIs and local checkpoints simultaneously. ## Additional context This infrastructure isn't a massive structural shift for the codebase—it is already proven to work seamlessly within Marinara Engine's own architecture via the **"Selfie responses"** mechanism in normal Chat Mode. This suggestion simply extends that flexible, on-demand pipeline to GM Mode. Additionally, making this an *optional toggle* completely protects the engine's token-conservation philosophy. Users who are highly sensitive to text API credits can leave it off and use the default baked-in string. Power users running local hardware or who don't mind the minor token cost can choose to flip it on. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:42:09 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 5, 2026):

Ah, this came from the image generation initially generating all NPCs as animals for some reason? I can just remove those mentions, will be easier.

<!-- gh-comment-id:4885451819 --> @SpicyMarinara commented on GitHub (Jul 5, 2026): Ah, this came from the image generation initially generating all NPCs as animals for some reason? I can just remove those mentions, will be easier.
Author
Owner

@RyushoYosei commented on GitHub (Jul 7, 2026):

Thanks for the quick text patch! However, removing the specific "animal" line only fixes the surface symptom—the core architectural issue is still present.

The main issue isn't just that specific phrase; it is the fact that the generator uses conversational prose templates for everything. Local diffusion models (like Illustrious or SDXL fine-tunes) cannot interpret natural language paragraphs efficiently, especially when they contain structured limitations. They heavily rely on dense, comma-separated Danbooru/e621-style tag weights (e.g., 1girl, solo, portrait, masterwork, upper body).

When GM Mode forces backgrounds, key moments, and portraits into a conversational text layout, the local CLIP text encoder gets completely muddy, leading to broken generation results. Cloud APIs handle prose fine, but local hardware setups choke on it.

This is why an optional settings toggle is still desperately needed. It allows the frontend to stay lightweight by default, but gives local hardware users the option to let the active LLM dynamically generate optimized tag-heavy prompts on the fly (just like the engine already successfully achieves via the Selfie response pipeline). Could we reopen this to consider adding that option?

<!-- gh-comment-id:4900142828 --> @RyushoYosei commented on GitHub (Jul 7, 2026): Thanks for the quick text patch! However, removing the specific "animal" line only fixes the surface symptom—the core architectural issue is still present. The main issue isn't just that specific phrase; it is the fact that the generator uses **conversational prose templates** for everything. Local diffusion models (like *Illustrious* or *SDXL* fine-tunes) cannot interpret natural language paragraphs efficiently, especially when they contain structured limitations. They heavily rely on dense, comma-separated **Danbooru/e621-style tag weights** (e.g., `1girl, solo, portrait, masterwork, upper body`). When GM Mode forces backgrounds, key moments, and portraits into a conversational text layout, the local CLIP text encoder gets completely muddy, leading to broken generation results. Cloud APIs handle prose fine, but local hardware setups choke on it. This is why an optional settings toggle is still desperately needed. It allows the frontend to stay lightweight by default, but gives local hardware users the option to let the active LLM dynamically generate optimized tag-heavy prompts on the fly (just like the engine already successfully achieves via the `Selfie response` pipeline). Could we reopen this to consider adding that option?
Author
Owner

@SpicyMarinara commented on GitHub (Jul 7, 2026):

I addressed this issue, though? Furthermore, go to Settings -> Advanced -> Image Generation -> Style Profiles.

Image
<!-- gh-comment-id:4902701003 --> @SpicyMarinara commented on GitHub (Jul 7, 2026): I addressed this issue, though? Furthermore, go to Settings -> Advanced -> Image Generation -> Style Profiles. <img width="324" height="457" alt="Image" src="https://github.com/user-attachments/assets/69268b07-6b71-43b1-a47c-34de8ce0d3d1" />
Author
Owner

@RyushoYosei commented on GitHub (Jul 8, 2026):

I addressed this issue, though? Furthermore, go to Settings -> Advanced -> Image Generation -> Style Profiles.
Image

I appreciate the pointer to the Style Profiles menu. Which , I admit, I was already using, and had already tried, as well as already tried custom editing to fix the issue. However, that doesn't actually solve the architectural issue for GM Mode assets.

The "Prompt grammar" dropdown in the Style Profiles only changes how the additive style modifiers are formatted. The actual core scene/NPC content payload generated by GM Mode is still being wrapped in a hardcoded natural language prose template before it reaches the image generator.

Selecting "Danbooru tags" there just results in a hybrid prompt:
[Rigid Conversational Prose Description] + [Style Profile Tags]

Because the local CLIP/T5 text encoder hits that conversational prose paragraph first, the prompt attention gets completely muddied, causing local diffusion models (like Illustrious or SDXL) to produce broken or generic outputs.

The requested toggle isn't for formatting style profiles—it's to allow the entire active GM context to be dynamically translated into an optimized tag-weight string by the text LLM on the fly (bypassing the hardcoded prose templates entirely), exactly like the engine already successfully achieves via the Selfie response pipeline in normal Chat Mode.

If you don't understand what I mean, I can offer to simplify the language for you.

<!-- gh-comment-id:4911941962 --> @RyushoYosei commented on GitHub (Jul 8, 2026): > I addressed this issue, though? Furthermore, go to Settings -> Advanced -> Image Generation -> Style Profiles. > <img alt="Image" width="324" height="457" src="https://private-user-images.githubusercontent.com/45567659/618132330-69268b07-6b71-43b1-a47c-34de8ce0d3d1.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM0OTE4NjUsIm5iZiI6MTc4MzQ5MTU2NSwicGF0aCI6Ii80NTU2NzY1OS82MTgxMzIzMzAtNjkyNjhiMDctNmI3MS00M2IxLWE0N2MtMzRkZThjZTBkM2QxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzA4VDA2MTkyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1Y2Q1NTI2OTk1N2QxNDk1YmNjYzA1NzZiODljZTMyZDE5ZGI5NmE2N2ZiNzE4MmFkZGY1NjQyNWVkNTdlMjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.y5E2JGTU7ioH334LAQreLTAylGHETaRYliqarFa5NNw"> I appreciate the pointer to the Style Profiles menu. Which , I admit, I was already using, and had already tried, as well as already tried custom editing to fix the issue. However, that doesn't actually solve the architectural issue for GM Mode assets. The "Prompt grammar" dropdown in the Style Profiles only changes how the **additive style modifiers** are formatted. The actual **core scene/NPC content payload** generated by GM Mode is still being wrapped in a hardcoded natural language prose template *before* it reaches the image generator. Selecting "Danbooru tags" there just results in a hybrid prompt: `[Rigid Conversational Prose Description] + [Style Profile Tags]` Because the local CLIP/T5 text encoder hits that conversational prose paragraph first, the prompt attention gets completely muddied, causing local diffusion models (like *Illustrious* or *SDXL*) to produce broken or generic outputs. The requested toggle isn't for formatting style profiles—it's to allow the **entire active GM context** to be dynamically translated into an optimized tag-weight string by the text LLM on the fly (bypassing the hardcoded prose templates entirely), exactly like the engine already successfully achieves via the `Selfie response` pipeline in normal Chat Mode. If you don't understand what I mean, I can offer to simplify the language for you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1735
No description provided.