
[DevDiary] Adversarial Algorithms Against AI Image Synthesis: A Computational Formalization Using Fortran
Introduction
Recently, technologies designed to counter
the indiscriminate crawling of artistic styles by
AI have been gaining significant attention.
Drawing inspiration from the mechanism of Nightshade—widely
regarded as the most potent among them—
I have explored how to implement this within a modern
C# environment (specifically optimized for 4-core CPUs and memory efficiency).
To ensure a rigorous examination of the pure logical flow,
I have drafted the architectural blueprint using Fortran,
a language renowned for its unparalleled efficiency in numerical arrays
and scientific computation.
1. A Computational Approach: Perturbation of the Feature Space
AI perceives images as high-dimensional vectors
rather than mere pixels.
My objective is to ‘minimize visual disparity while maximizing
the displacement within the vector space.’
Core Data Structures (Memory Efficiency)
To optimize L3 cache efficiency for the i5-4460,
the structure utilizes Fortran’s contiguous array mapping,
which is natively optimized for SIMD operations.
1 | module DataStructures |
2. Core Algorithm: PGD (Projected Gradient Descent)
This is not simple noise, but a precise procedure to refine poisoning
data through the reverse-calculation of the AI’s feature extraction layers.
1 | ! [Algorithm] Projected Gradient Descent: Core Routine for Poisoning While Preserving Originality |
3. Hardware Optimization: Quad-Core Utilization and Addressing I/O Bottlenecks
Considering the 13-year-old PC specifications, Disk I/O and Garbage
Collection (GC) are far more daunting than raw computational speed.
Multi-Stage Pipeline Architecture
Using C#’s System.Threading.Channels,
- Core 1 (Loader): Pre-reads images from the
SSD and loads them into a memory pool - Core 2 & 3 (Processors): Executing the
InjectPoison
logic at high speed using AVX2 (SIMD) instructions, processing 8 pixels at a time. - Core 4 (Saver): Saves the processed images in lossless formats, such as PNG.
4. The Essence of the Mechanism: Ensuring Robustness
To ensure the poisoning effect persists even when
the AI rotates or resizes images during
training, the concept of
EOT (Expectation Over Transformation) is essential.
1 | ! A logic that ensures the poison remains effective on average across various transformed states. |
5. Conclusion and Future Work
While adopting the core concepts of Nightshade,
the actual implementation prioritizes
hardware-specific optimizations for the i5-4460,
specifically focusing on memory pooling and SIMD vectorization.
Limited hardware environments, such as a 13-year-old legacy PC,
do not necessitate
compromise. On the contrary,
these constraints highlight the true value of computational
optimization. The subsequent phase of this research will involve
integrating C# and TorchSharp within the Visual Studio 2022 environment
to develop a functional model based on this Fortran-derived architecture.
Thank you very much for taking the time to read through this long journey.
I wish you all a wonderful day. : )