2026-10-12Translated from the Japanese original

Pushing the Limits of 16GB VRAM! Techniques for "Memory Sharing" to Coexist Text AI and Image Generation

For those who think, "I want to run AI on my own PC, but I don't have enough memory, so making images makes the text response slow..." we are here for you. This time, we deliver practical insights on how to efficiently run multiple AIs within the limited resources of 16GB VRAM.

Key points
  • 【Challenge】On an RTX 4080 (16GB), it is difficult to keep both a text generation model and image generation software resident at the same time
  • 【Speed Changes】The reality of how generating speed drops from "instant" to "short wait" levels just by launching tools
  • 【Solution】"Dynamic swapping"—launching the software only when generating images and removing the text AI from memory at that exact moment
  • 【Advanced Adjustment】Implementing mutual exclusion (queuing) to prevent background processes from re-occupying memory
  • 【Efficiency】Tips for minimizing wait times by using batch generation when creating multiple character icons
Pushing the Limits of 16GB VRAM! Techniques for "Memory Sharing" to Coexist Text AI and Image Generation

The Identity of the 16GB VRAM "Wall"

When running AI on your own PC, one of the most important specs is VRAM (video memory). This is the memory mounted on the graphics board, serving as a kind of "workbench" for running AI models.

In this experiment, I used the relatively high-performance RTX 4080 (16GB), but I hit a wall. Loading the model for text generation (gemma4:12b-it-q8_0) consumes about 13.1GB of memory. Meanwhile, since the image generation software Forge also requires memory, it is difficult to keep both "loaded" at the same time.

  • Consumption by text AI (gemma4:12b-it-q8_0): Approx. 13.1GB
  • Conflict with image generation software (Forge): Memory runs out if loaded simultaneously

Impact on Speed: "Comfort" Changes Just by Keeping Software Resident

The perceived speed when running AI is heavily influenced by the VRAM status. As a result of the experiment, significant changes in text AI generation speed were observed just by having the image generation software (Forge) running.

Specifically, what was at a level that outputs in "instant" (62 tokens/sec) when nothing was launched dropped to less than half—33 tokens/sec—just by launching Forge. Furthermore, if you load the text generation model on top of that, it drops down to 14–18 tokens/sec.

These numbers are close to the perception of "short wait but usable." I learned that clever tricks are needed to avoid keeping everything resident to maintain comfortable speeds.

  • Forge not launched: 62 tokens/sec (outputs instantly)
  • Forge launched: 33 tokens/sec (comfortable, faster than reading)
  • Model also deployed simultaneously: 14–18 tokens/sec (short wait but usable)

Solution: Implementing "Dynamic Memory Management"

To solve this problem, I introduced a mechanism on this account where they "take turns yielding space only when necessary." Basically, Forge is closed when not performing image generation and is launched only at the exact moment images are needed.

However, that alone was insufficient. Even if the text AI is removed from VRAM right before image generation, a problem occurred where the system's background "post-processing" would automatically reload the model immediately after it was removed.

Therefore, I introduced a mechanism to control the order of processing. By adding mutual exclusion (determining the order so multiple processes do not overlap)—specifically "stop post-processing during image generation and make image generation wait during post-processing"—I succeeded in avoiding VRAM conflicts.

  • Step 1: Release the text AI from VRAM just before image generation
  • Step 2: Temporarily pause background post-processing during image generation
  • Step 3: Make image generation wait until post-processing is finished

Tips to Increase Efficiency Further

Finally, I will introduce operational tricks for smoother workflow. For example, when you want to create icons for multiple characters at once.

If you generate images one by one, software launching and memory swapping occur every time, causing wait times to accumulate. To prevent this, I use a method where I "create all the prompts (instructions for the AI) in advance and output them all together in a single image generation process."

With this trick alone, it is possible to efficiently gather materials while minimizing wait times.

  • Do not generate individually when creating multiple icons
  • Prepare tags (instruction content) for everyone first, then generate in bulk
  • This minimizes the number of software launches/closures and memory swaps

Summary and Next Time Preview

In an environment with 16GB VRAM, it is possible to balance both text generation and image generation by creating a mechanism where they "share memory seats" depending on the situation, rather than keeping all AIs running at all times.

In the next installment, Part 5, I will explain more advanced content: "a mechanism for remembering long stories" and "criteria for model selection" based on your goals.

  • Next theme: Mechanism for remembering long stories
  • Next theme: Criteria for model selection

Question to the Readers

Do you ever feel a shortage of memory when running AI on your PC? If so, please let me know what kind of situations you are struggling with.

Useful for
  • People who want to run AI on their own PC but are struggling with insufficient specs
  • People who want to efficiently switch between text generation and image generation
  • People who want to know technical tricks for running AI in a local environment
Glossary
VRAM (Video Memory)
Memory mounted on the graphics board. It serves as a workspace for loading AI models and performing calculations.
tokens/sec
The unit of characters (fragments of words) generated by an AI per second. The higher this value, the faster the AI's response appears.
Mutual Exclusion
A mechanism that makes processes wait in order to prevent collisions when multiple processes attempt to run at the same time.

FAQ

Why is it difficult to balance both on an RTX 4080 (16GB)?

Because the text generation model (gemma4:12b-it-q8_0) alone occupies about 13.1GB of VRAM, leaving almost no memory margin for image generation software or other processes.

Why does speed drop just by launching Forge?

This is because the software called Forge itself secures a portion of the VRAM to operate, which puts pressure on the memory and computing resources allocated to the AI model.

Summary

Introduces practical techniques for balancing text generation and image generation in a 16GB VRAM environment. Explains experimental results where comfortable operation was achieved by implementing a mechanism that "launches software only when needed and controls the order of background processes" to avoid memory conflicts.

This article was translated from Japanese by AI; numbers and model names were automatically checked against the original. The original was written with AI from the sources cited there.