Mutators

List of ParlAI mutators. Mutators are teacher-independent transformations, and are useful for writing transformations you want to apply to multiple datasets.

Mutators are available any time teachers are used, i.e. when there is a --task argument. Mutators may also be stacked, e.g. --mutators flatten,word_shuffle.

Below, we list all the currently supported mutators and give an example of their output, as well as their options when available.

Original output

We show the unmutated output of the examples for reference:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
   i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
i do not . but i do have a favorite meat since that is all i eat exclusively .
   what is your favorite meat to eat ?
i would have to say its prime rib . do you have any favorite foods ?
   i like chicken or macaroni and cheese .


context_shuffle

Shuffles all the lines in the context.

Context is defined to be any text prepended to the first turn of a conversation, for example, personas.

Example usage:

parlai display_data -t convai2:sample --mutators context_shuffle

Example output:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to shoot a bow.
your persona: i like to go hunting.
your persona: my favorite holiday is halloween.
your persona: i like to remodel homes.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
   i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
i do not . but i do have a favorite meat since that is all i eat exclusively .
   what is your favorite meat to eat ?
i would have to say its prime rib . do you have any favorite foods ?
   i like chicken or macaroni and cheese .


episode_reverse

Reverses all the turns in a conversation.

Labels remain in the original ordering, but the order of text (prompts) is mixed up. Thus “one half” of the conversation is reordered.

Example usage:

parlai display_data -t convai2:sample --mutators episode_reverse

Example output:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
i would have to say its prime rib . do you have any favorite foods ?
   you must be very fast . hunting is one of my favorite hobbies .
i do not . but i do have a favorite meat since that is all i eat exclusively .
   i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
i am ! for my hobby i like to do canning or some whittling .
   what is your favorite meat to eat ?
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   i like chicken or macaroni and cheese .

Optional Arguments

Argument

Description

--preserve-context

If extra context is provided, keep it prepended to the first turn

Default: True.


episode_shuffle

Shuffles all the turns in a conversation.

Labels remain in the original ordering, but the order of text (prompts) is mixed up. Thus “one half” of the conversation is reordered.

Example usage:

parlai display_data -t convai2:sample --mutators episode_shuffle

Example output:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
i do not . but i do have a favorite meat since that is all i eat exclusively .
   you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
   i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
i would have to say its prime rib . do you have any favorite foods ?
   what is your favorite meat to eat ?
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   i like chicken or macaroni and cheese .

Optional Arguments

Argument

Description

--preserve-context

If extra context is provided, keep it prepended to the first turn

Default: True.


flatten

Flattens the entire conversation history.

Simply concatentates all turns in the conversation with a newline. Frequently useful when composed with other mutators.

Example usage:

parlai display_data -t convai2:sample --mutators flatten

Example output:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   you must be very fast . hunting is one of my favorite hobbies .
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
   i also remodel homes when i am not out bow hunting .
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
that's awesome . do you have a favorite season or time of year ?
i do not . but i do have a favorite meat since that is all i eat exclusively .
   what is your favorite meat to eat ?
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
you must be very fast . hunting is one of my favorite hobbies .
i am ! for my hobby i like to do canning or some whittling .
i also remodel homes when i am not out bow hunting .
that's neat . when i was in high school i placed 6th in 100m dash !
that's awesome . do you have a favorite season or time of year ?
i do not . but i do have a favorite meat since that is all i eat exclusively .
what is your favorite meat to eat ?
i would have to say its prime rib . do you have any favorite foods ?
   i like chicken or macaroni and cheese .


last_turn

Keep only the most recent turn.

This mutator obliterates the history of the conversation, keeping only the very last thing said. Every turn is still evaluated, but treated as a new episode.

Example usage:

parlai display_data -t convai2:sample --mutators last_turn

Example output:

- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
hi , how are you doing ? i'm getting ready to do some cheetah chasing to stay in shape .
   you must be very fast . hunting is one of my favorite hobbies .
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
i am ! for my hobby i like to do canning or some whittling .
   i also remodel homes when i am not out bow hunting .
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
that's neat . when i was in high school i placed 6th in 100m dash !
   that's awesome . do you have a favorite season or time of year ?
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
i do not . but i do have a favorite meat since that is all i eat exclusively .
   what is your favorite meat to eat ?
- - - NEW EPISODE: convai2:sample - - -
your persona: i like to remodel homes.
your persona: i like to go hunting.
your persona: i like to shoot a bow.
your persona: my favorite holiday is halloween.
i would have to say its prime rib . do you have any favorite foods ?
   i like chicken or macaroni and cheese .

Optional Arguments

Argument

Description

--preserve-context

If extra context is provided, keep it prepended to all turns.

Default: True.


word_reverse

Reverses the words of each turn.

Only the text (prompt) is modified, not the labels. Utterances separated by newlines will not be shuffled across boundaries. You may wish to combine it with the flatten mutator to reverse both labels and texts.

Example usage:

parlai display_data -t convai2:sample --mutators word_reverse

Example output:

- - - NEW EPISODE: convai2:sample - - -
homes. remodel to like i persona: your
hunting. go to like i persona: your
bow. a shoot to like i persona: your
halloween. is holiday favorite my persona: your
. shape in stay to chasing cheetah some do to ready getting i'm ? doing you are how , hi
   you must be very fast . hunting is one of my favorite hobbies .
. whittling some or canning do to like i hobby my for ! am i
   i also remodel homes when i am not out bow hunting .
! dash 100m in 6th placed i school high in was i when . neat that's
   that's awesome . do you have a favorite season or time of year ?
. exclusively eat i all is that since meat favorite a have do i but . not do i
   what is your favorite meat to eat ?
? foods favorite any have you do . rib prime its say to have would i
   i like chicken or macaroni and cheese .


word_shuffle

Shuffles all the words in the message.

Only the text (prompt) is modified, not the labels. Utterances separated by newlines will not be shuffled across boundaries. You may wish to combine it with the flatten mutator to shuffle labels and texts.

Example usage:

parlai display_data -t convai2:sample --mutators word_shuffle

Example output:

- - - NEW EPISODE: convai2:sample - - -
persona: like to i homes. your remodel
like hunting. i to your go persona:
like shoot i to persona: a bow. your
my is your favorite halloween. persona: holiday
do . i'm to to some in ? ready , chasing are how you stay cheetah doing hi getting shape
   you must be very fast . hunting is one of my favorite hobbies .
! do like or some i canning for hobby my . whittling i am to
   i also remodel homes when i am not out bow hunting .
placed when 6th that's in dash school i . was ! i in neat 100m high
   that's awesome . do you have a favorite season or time of year ?
is that i favorite not . do i eat . a since meat but do all i have exclusively
   what is your favorite meat to eat ?
i you any say . have would favorite ? rib to its have do foods prime
   i like chicken or macaroni and cheese .