Prompt optimization
bolt.PO128
Prompt optimization via search in a 128-dimensional embedding space.
The search space consists of 128-dimensional truncated embeddings from EmbeddingGemma.
The full discrete candidate set is accessible at prob.obj_func.Xs, and
can be used directly for discrete optimization. Evaluating any point X via
prob(X) returns the Math500 0-shot accuracy of its nearest neighbor in
the candidate set.
Example usage:
import torch
from bolt import PO128
prob = PO128(noise_std=0.001, negate=False)
X = torch.zeros(1, prob.dim, dtype=torch.double)
y = prob(X)
Source code in bolt/problems/prompt_opt.py
bolt.PO256
Prompt optimization via search in a 256-dimensional embedding space.
The search space consists of 256-dimensional truncated embeddings from EmbeddingGemma.
The full discrete candidate set is accessible at prob.obj_func.Xs, and
can be used directly for discrete optimization. Evaluating any point X via
prob(X) returns the Math500 0-shot accuracy of its nearest neighbor in
the candidate set.
Example usage:
import torch
from bolt import PO256
prob = PO256(noise_std=0.001, negate=False)
X = torch.zeros(1, prob.dim, dtype=torch.double)
y = prob(X)
Source code in bolt/problems/prompt_opt.py
bolt.PO512
Prompt optimization via search in a 512-dimensional embedding space.
The search space consists of 512-dimensional truncated embeddings from EmbeddingGemma.
The full discrete candidate set is accessible at prob.obj_func.Xs, and
can be used directly for discrete optimization. Evaluating any point X via
prob(X) returns the Math500 0-shot accuracy of its nearest neighbor in
the candidate set.
Example usage:
import torch
from bolt import PO512
prob = PO512(noise_std=0.001, negate=False)
X = torch.zeros(1, prob.dim, dtype=torch.double)
y = prob(X)
Source code in bolt/problems/prompt_opt.py
bolt.PO768
Prompt optimization via search in a 768-dimensional embedding space.
The search space consists of 768-dimensional truncated embeddings from EmbeddingGemma.
The full discrete candidate set is accessible at prob.obj_func.Xs, and
can be used directly for discrete optimization. Evaluating any point X via
prob(X) returns the Math500 0-shot accuracy of its nearest neighbor in
the candidate set.
Example usage:
import torch
from bolt import PO768
prob = PO768(noise_std=0.001, negate=False)
X = torch.zeros(1, prob.dim, dtype=torch.double)
y = prob(X)