Skip to content

Add support for token weights during fuzzing - #206

Open
Elias Castegren (EliasC) wants to merge 8 commits into
microsoft:mainfrom
EliasC:features/weights
Open

Add support for token weights during fuzzing#206
Elias Castegren (EliasC) wants to merge 8 commits into
microsoft:mainfrom
EliasC:features/weights

Conversation

@EliasC

Copy link
Copy Markdown
Collaborator

This PR adds support for supplying token weights to the fuzzer. The weights are supplied as a map from tokens to integers and unmapped tokens defaults to 1. The driver CLI has been extended:

$ ./infix_trieste test --weights infix-int 2 infix-output 0
# prefer integers, exclude output statements

Note that setting a weight to zero may cause generation to abort with an exception if there is no viable option for a choice. I thought about checking for that up front (either checking for paths in the WF spec that lead to dead choices, or propagating dead choices upwards so that the path cannot happen), but I think the benefit doesn't outweigh the benefits in this case.

A possible future thing to add would be an automatic tuning of the weights based on the patterns of a pass: if the patterns have In(Foo) and T(Bar) that suggests that we should increase the weights of Foo and Bar. Preliminary experiments suggests that this reduces the number of trivial trees (trees that do not match a single rule).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant