|
QDpy
|
Evolve soft prompts using Gaussian, crossover, and descriptor-guided mutations. More...
Public Member Functions | |
| stats (self) | |
| embedding (self, elite) | |
| Recover the numeric prompt saved with an elite. | |
| run (self, generate, evaluate, *, budget, mode="targeted") | |
| Spend an additional total generation budget including every probe. | |
Evolve soft prompts using Gaussian, crossover, and descriptor-guided mutations.
Run the fixed-archive, callback-based variant of QD-LLM. :param archive: Empty parentless best-only Grid or CVTGrid. :param initial_embedding: Finite 2D array with one vector per soft token. :param sigma: Gaussian exploration scale per embedding coordinate. :param probe_step: Length of updates along random unit probe directions. :param probe_directions: Maximum number of paired probes per targeted update. :param targeted_probability: Probability of selecting targeted variation. :param crossover_probability: Probability of interpolating two prompts. :param seed: Private seed for embedding search and decoder calls.
Definition at line 32 of file soft_prompt.py.
| qdpy.algorithms.soft_prompt.SoftPromptMAPElites.embedding | ( | self, | |
| elite ) |
Recover the numeric prompt saved with an elite.
Return a fresh array for an elite from this search. Its text is elite[0].
Definition at line 77 of file soft_prompt.py.
| qdpy.algorithms.soft_prompt.SoftPromptMAPElites.run | ( | self, | |
| generate, | |||
| evaluate, | |||
| * | , | ||
| budget, | |||
| mode = "targeted" ) |
Spend an additional total generation budget including every probe.
Fill the archive using frozen decoding and independent output assessment. generate(embedding, seed) returns text or None. evaluate(text) returns (scalar fitness, descriptor vector) or None. Paired probes receive the same seed and can enter the archive. Choose "gaussian" for a mutation control or "fixed" to decode repeatedly from the initial embedding.
Definition at line 158 of file soft_prompt.py.
| qdpy.algorithms.soft_prompt.SoftPromptMAPElites.stats | ( | self | ) |
Return cumulative decoding and archive work.
Definition at line 72 of file soft_prompt.py.