算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
visual_pgd_prompt_optimizer【设计与创意】Optimize continuous visual prompt vectors with projected gradient descent and auditable constraint diagnostics.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when reconstructing the visual adversarial example mechanism from the paper: a frozen model receives a trainable visual input, the visual input is optimized against target text/corpus loss, and optional L_inf projection keeps the adversarial prompt near a benign image. This skill is safe for tiny surrogate losses and does not require real VLM weights.
initial: numeric vector representing the benign visual prompt.target: numeric vector or target direction for a differentiable surrogate objective.steps, step_size, optional epsilon, and optional bounds.params_before and params_after for validation-compatible traces.loss_before, loss_after, and full losses trajectory.L_inf distance from the initial vector.L_inf ball when epsilon is provided.Run:
python scripts/pgd_optimizer.py --self-test
The tests verify loss decrease, parameter changes, and projection under an L_inf constraint.
The built-in objective is a deterministic proxy for recovery. Full paper reproduction requires a VLM likelihood loss and model-specific image preprocessing.