OMEGA
OMEGA
Bases: EvolutionaryOptimizer
OMEGA: OptiMizEr as Genetic Algorithm.
A genetic optimizer with dominated novelty search.
This optimizer is unique to Synalinks and the result of our research effort on advancing neuro-symbolic AI.
Dominated Novelty Search (DNS), is a SOTA Quality-Diversity optimization method that implements a competition function in a classic genetic algorithm.
The key insight behind Dominated Novelty Search is that candidates should be eliminated from the population if they are both:
- Inferior in reward/fitness
- Similar to existing candidates/solutions
This algorithm creates an evolutionary pressure to focus on high performing candidates Or candidates that explore other approaches.
This approach only add one step to the traditional genetic algorithm and outperform MAP-Elites, Threshold-Elites and Cluster-Elites.
This allow the system to explore the search space more quickly by eliminating non-promising candidates while preserving diversity to avoid local optimum.
At Synalinks, we adapted this algorithm for LM-based optimization, to do so we use an embedding model to compute the candidate's descriptor and a cosine distance between solutions.
Note: In Synalinks, unlike other In-Context learning frameworks, a variable (the module's state to optimize) is a JSON object not a simple string. Which has multiple implications, we maintain a 100% correct structure through constrained JSON decoding, and we allow the state to have variable/dynamic number of fields, which is handled by this approach by embedding each field and averaging them before computing the distance required by DNS.
Example:
import synalinks
import asyncio
async def main():
# ... your program definition
program.compile(
reward=synalinks.rewards.ExactMatch(),
optimizer=synalinks.optimizers.OMEGA(
language_model=language_model,
embedding_model=embedding_model,
)
)
history = await program.fit(...)
Concerning the inspirations for this optimizer
- Dominated Novelty Search for their elegant Quality-Diversity algorithm that outperform many other evolutionary strategies.
- DSPY's GEPA for feeding the optimizer program with the raw training data and for formalizing the evolutionary optimization strategy (NOT the MAP-Elites method used).
- DeepMind's AlphaEvolve have been a huge inspiration, more on the motivational side as they didn't released the code.
References
- Dominated Novelty Search: Rethinking Local Competition in Quality-Diversity (https://arxiv.org/html/2502.00593v1)
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning (https://arxiv.org/pdf/2507.19457)
- AlphaEvolve: A coding agent for scientific and algorithmic discovery (https://arxiv.org/pdf/2506.13131)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instructions
|
str
|
Additional instructions about the task for the optimizer. |
None
|
language_model
|
LanguageModel
|
The language model to use. |
None
|
embedding_model
|
EmbeddingModel
|
The embedding model to use to compute candidates descriptors according to Dominated Novelty Search. |
None
|
k_nearest_fitter
|
int
|
The K nearest fitter used by Dominated Novelty Search. |
5
|
nb_best_predictions
|
int
|
How many of the batch's highest-reward
predictions are shown to the mutation/crossover programs as
|
1
|
nb_worst_predictions
|
int
|
How many of the batch's lowest-reward
predictions are shown as |
3
|
nb_hard_examples
|
int
|
How many recurring hard examples are appended
to |
1
|
hard_example_min_observations
|
int
|
Minimum number of judgements before an input can be a recurring hard example. Default 2. |
2
|
distance_function
|
callable
|
Optional. The distance function to use by Dominated Novelty Search. If no function is provided, use the default cosine distance. |
None
|
mutation_temperature
|
float
|
The temperature for the LM calls of the mutation programs. |
0.3
|
crossover_temperature
|
float
|
The temperature for the LM calls of the crossover programs. |
0.3
|
reasoning_effort
|
string
|
Optional. The reasoning effort for the LM call between ['minimal', 'low', 'medium', 'high', 'xhigh', 'disable', 'none', None]. Default to None (no reasoning). |
None
|
use_chain_of_thought
|
bool
|
Whether the mutation/crossover programs use
a |
True
|
algorithm
|
str
|
The mechanism to use for the genetic algorithm between ['ga', 'dns']. This parameter is provided for ablation studies and shouldn't be modified. (Default to 'dns'). |
'dns'
|
selection
|
str
|
The method to select the candidate to evolve at the beginning of a batch between ['random', 'best', 'softmax']. (Default to 'softmax'). |
'softmax'
|
selection_temperature
|
float
|
The temperature for softmax selection.
Used only when |
0.3
|
merging_rate
|
float
|
Probability that a proposal is a crossover rather than a mutation, constant over training. Default 0.05: about one proposal in twenty is a crossover of two candidates once the population holds at least two; mutation otherwise. |
0.05
|
population_size
|
int
|
The maximum number of best candidates to keep during the optimization process. |
10
|
name
|
str
|
Optional name for the optimizer instance. |
None
|
description
|
str
|
Optional description of the optimizer instance. |
None
|
Source code in synalinks/src/optimizers/omega.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | |
build(trainable_variables)
async
Build the optimizer programs based on the trainable variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trainable_variables
|
list
|
List of variables that will be optimized |
required |
Source code in synalinks/src/optimizers/omega.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | |
competition(candidates)
async
Rank candidates by DNS competition fitness.
There is no distance threshold: the population is truncated by rank
on the competition fitness (see on_epoch_end), so the outcome does
not depend on the scale of the distance function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
list
|
List of candidate dictionaries with 'reward' key |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
List[Dict[str, Any]]
|
The same candidates ranked by decreasing competition fitness, ties broken by decreasing reward. No candidate is removed. |
Source code in synalinks/src/optimizers/omega.py
competition_fitness(candidates)
async
Dominated Novelty Search competition fitness of each candidate.
Following Bahlous-Boldi et al. (2025), a candidate's competition
fitness is the mean distance to its k_nearest_fitter nearest
candidates with a strictly higher reward, or infinity when no
candidate is fitter. A candidate is penalized when it sits close to
better ones, whatever its own reward; the best candidate and the
candidates alone in their region score highest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
list
|
List of candidate dictionaries with 'reward' key |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
List[float]
|
One competition fitness per candidate, in input order. |
Source code in synalinks/src/optimizers/omega.py
hard_examples(exclude_keys=())
The recurring hard examples: lowest mean reward first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude_keys
|
iterable
|
Input keys to skip (the current batch). |
()
|
Returns:
| Type | Description |
|---|---|
list
|
Up to |
Source code in synalinks/src/optimizers/omega.py
merge_candidate(step, trainable_variable, current_candidate, other_candidate, x=None, y=None, y_pred=None, rewards=None, training=False)
async
Apply crossover to merge two selected candidates.
Creates crossover inputs combining two high-performing candidates, then calls the crossover program to generate a merged variant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
The current training step |
required |
trainable_variable
|
Variable
|
The trainable variable (for metadata access) |
required |
current_candidate
|
dict
|
First selected candidate to merge |
required |
other_candidate
|
dict
|
Second selected candidate to merge |
required |
x
|
list
|
Input data batch |
None
|
y
|
list
|
Ground truth data batch |
None
|
y_pred
|
list
|
Predicted outputs from the current model |
None
|
rewards
|
list
|
Per-sample rewards of |
None
|
training
|
bool
|
Whether in training mode |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The merged candidate from the crossover program |
Source code in synalinks/src/optimizers/omega.py
mutate_candidate(step, trainable_variable, selected_candidate, x=None, y=None, y_pred=None, rewards=None, training=False)
async
Apply mutation to generate a new candidate using LLM.
Creates mutation inputs from the selected candidate and training data, then calls the mutation program to generate an optimized variant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
The current training step |
required |
trainable_variable
|
Variable
|
The trainable variable (for metadata access) |
required |
selected_candidate
|
dict
|
The selected candidate to mutate |
required |
x
|
list
|
Input data batch |
None
|
y
|
list
|
Ground truth data batch |
None
|
y_pred
|
list
|
Predicted outputs from the current model |
None
|
rewards
|
list
|
Per-sample rewards of |
None
|
training
|
bool
|
Whether in training mode |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The mutated candidate from the mutation program |
Source code in synalinks/src/optimizers/omega.py
observe_training_batch(x=None, y=None, y_pred=None, rewards=None)
Record each judged training sample in the difficulty memory.
Source code in synalinks/src/optimizers/omega.py
on_epoch_end(epoch, trainable_variables, logs=None, val_size=None)
async
Called at the end of each epoch.
With algorithm="dns", the candidates of the epoch and the current
best candidates are ranked by DNS competition fitness and the top
population_size survive. With algorithm="ga", the top
population_size by reward survive. Before that, the epoch-end
validation reward is folded into the promoted candidate. The base class
then writes the best survivor into the variable and records the history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
int
|
The epoch number |
required |
trainable_variables
|
list
|
The list of trainable variables |
required |
Source code in synalinks/src/optimizers/omega.py
split_predictions(x=None, y=None, y_pred=None, rewards=None)
Split a batch into the best and worst predictions by reward.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
list
|
The batch inputs. |
None
|
y
|
list
|
The batch ground truth (optional). |
None
|
y_pred
|
list
|
The predictions for the batch (optional). |
None
|
rewards
|
list
|
The per-sample rewards (optional). A missing reward ranks the sample as worst. |
None
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
Source code in synalinks/src/optimizers/omega.py
base_instructions()
Base instructions that define the context for all optimization programs.
These instructions explain that the system optimizes JSON variables in a computation graph.
Source code in synalinks/src/optimizers/omega.py
candidate_content_texts(candidate)
The string leaves of a candidate's trainable content, metadata excluded.
Source code in synalinks/src/optimizers/omega.py
crossover_instructions(variables_keys)
Instructions for the crossover program that optimizes variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables_keys
|
list
|
List of keys that the variable should contain |
required |
Source code in synalinks/src/optimizers/omega.py
mutation_instructions(variables_keys)
Instructions for the mutation program that optimizes variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables_keys
|
list
|
List of keys that the variable should contain |
required |
Source code in synalinks/src/optimizers/omega.py
similarity_distance(candidate1, candidate2, embedding_model=None, axis=-1)
async
Cosine distance between two candidates, from their content only.
Each trainable field of a candidate is embedded separately; the unit
vectors are averaged and the mean is renormalized, so two candidates with
the same content are at distance 0 whatever their number of fields.
Candidate metadata (reward, reward_count) is not part of the content
and is ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate1
|
dict
|
First candidate (dict or JSON-serializable object) |
required |
candidate2
|
dict
|
Second candidate (dict or JSON-serializable object) |
required |
embedding_model
|
EmbeddingModel
|
The embedding model for computing embeddings |
None
|
axis
|
int
|
The axis along which to compute the similarity (default: -1) |
-1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Cosine distance between candidates (0 = identical, 1 = orthogonal). The maximal distance 1.0 is returned when an embedding call fails. |