Skip to content

Alternation interpolation

ljleb edited this page Aug 20, 2024 · 6 revisions

Alternation interpolation makes it possible to change the pace at which Alternating Words switches from one alternative prompt to the next:

[prompt1|prompt2|prompt3|...:speed]

prompt1, prompt2, prompt3 and so on are separate alternative prompts, and speed is the speed at which to iterate over the prompts. If speed is 1, then prompt1 will be used at the first step, then prompt2 at the second step, then prompt3, etc. If speed is not an integer, then prompt interpolation is used to sample between any two consecutive alternative prompts.

In general, when using integer speeds, it is better if the speed is not a factor of the number of alternative prompts. For example, a speed of 5 with 7 prompts will work well because no prompts will be omitted, whereas a speed of 3 with 6 prompts will always skip 4 of the alternative prompts.

The speed can be omitted, which will use the builtin alternation implementation of a1111.

Corner Cases

  • [a|b|c] - builtin alternation: a, b, c, repeat
  • [a|b|c:] - also builtin alternation: a, b, c, repeat
  • [a|b|c:1] - simulate normal alternation using linear interpolation: a, b, c, repeat
  • [a|b|c:0.5] - interpolate once between 2 consecutive alternative prompts: a, between a and b, b, between b and c, c, between c and a, repeat
  • [a|b|c:2] - skip one alternative prompt at each iteration: a, c, b, repeat. If the number of prompts is even, then only half of the prompts will ever be used
Clone this wiki locally