Download Narrative generation

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Intelligent Narrative Generation:
Creativity, Engagement, and Cognition
Mark Riedl
[email protected]
@mark_riedl
Tell me a story
2
Storytelling
• Storytelling is pervasive part of the
human experience
– Books, movies, computer games,
training scenarios, education,
every-day communication, etc.
• Narrative Intelligence: narrative is a fundamental means by
which we organize, understand, and explain the world
• Instill computational systems with the ability to craft and tell
stories in order to be better entertainers, educators, trainers,
communicators, and generally more capable of relating to
humans
3
Why study story generation?
• Stories are everywhere
• Humans make up stories
all the time, but computers
do not
• Cognitive science
• Computational creativity
© Popular Mechanics, 1931
• Practical creativity
4
There is a woman named Jasmine. There is a king named Jafar.
This is a story about how King Jafar becomes married to Jasmine.
There is a magic genie. This is also a story about how the genie dies.
There is a magic lamp. There is a dragon. The dragon has the
magic lamp. The genie is confined within the magic lamp.
King Jafar is not married. Jasmine is very beautiful. King Jafar
sees Jasmine and instantly falls in love with her. King Jafar wants to
marry Jasmine. There is a brave knight named Aladdin. Aladdin is
loyal to the death to King Jafar. King Jafar orders Aladdin to get the
magic lamp for him. Aladdin wants King Jafar to have the magic
lamp. Aladdin travels from the castle to the mountains. Aladdin
slays the dragon. The dragon is dead. Aladdin takes the magic
lamp from the dead body of the dragon. Aladdin travels from the
mountains to the castle. Aladdin hands the magic lamp to King
Jafar. The genie is in the magic lamp. King Jafar rubs the magic
lamp and summons the genie out of it. The genie is not confined
within the magic lamp. King Jafar controls the genie with the magic
lamp. King Jafar uses the magic lamp to command the genie to
make Jasmine love him. The genie wants Jasmine to be in love with
King Jafar. The genie casts a spell on Jasmine making her fall in love© Popular Mechanics, 1931
with King Jafar. Jasmine is madly in love with King Jafar. Jasmine
wants to marry King Jafar. The genie has a frightening appearance.
The genie appears threatening to Aladdin. Aladdin wants the genie
to die. Aladdin slays the genie. King Jafar and Jasmine wed in an
extravagant ceremony.
The genie is dead. King Jafar and Jasmine are married. The end.
Story
Generation
Interactive
Narrative
Narrative
Intelligence
Automated story generation
• Automatic creation of meaningful fictional sequences is hard
– Complexity, subtlety, nuance, mimesis
– Focus on plot
It’s hard if you want to
show computational
creativity
• Two nearly-universal properties of story
– Causal progression
• Perception that the main events of the story make up causal chains that
terminate in the outcome
– Character believability
• Perception that characters act in a manner that does not distract from one’s
suspension of disbelief
• Characters are perceived to be intentional agents
7
Computer as author
• Creative writing is a problemsolving activity
• Author goals vs. character goals
• Plan out the events that should
occur in the narrative
8
Narratives as plans
Wolf
is aliv
e
live
is a
Wo
lf
– Action, temporality, causality
Initial State
Wolf
is ali
ve
• Partial-order plan is a good
representation of plot
Wol
f is
alive
Wol
f
kno
ws
G
r ann
y
Red
ws
kno
Red Tell Wolf About Granny
lf
Wo
Wolf Eats Red
Wo
lf
Wolf Eats Granny
...
• Planning: find a sound and
coherent sequence of actions
that transforms the initial state
into one in which the goal
situation holds
kno
ws R
ed
Red Greets Wolf
...
Outcome
Planning stories
• But, is planning a good model of story creation?
• Conventional Planning
– Single or multiple agents
– Goal state is agents’ desired world
state
– Agents intend to enact the plan
• Narrative Planning
– Multiple characters
– Goal state describes outcome of the
story
– Outcome is not necessarily intended
by any characters
• Augment planning algorithm to reason
about author goals and character goals
10
Fabulist
• Conventional causal dependency planning
– Provides logical causal progression
Joe intends has(Villain, $$$)
...
Give (Joe, $$$, Villain)
Coerce (Villain, Joe)
Rob-Bank (Joe, Bank)
has (Villain, $$$)
has (Joe, $$$)
Outcome
...
Kidnap (Villain, Joe’s-family)
• Reasoning about character intentions
– Use a cognitive model to determine whether characters appear
intentional and revise the plan otherwise
– Insert actions that explain character goals
11
Riedl & Young. Journal of Artificial Intelligence Research, 39, 2010.
Falls-in-Love (King, Jasmine, Castle)
Order (King, Aladdin, has(King, Lamp))
Travel (Aladdin, Castle, Mountain)
at (Aladdin, Mountain)
Slay (Aladdin, Dragon, Mountain)
at (Aladdin, Mountain)
at (Aladdin, Mountain)
~alive (Dragon)
Pillage (Aladdin, Lamp, Dragon, Mountain)
has (Aladdin, Lamp)
Travel (Aladdin, Mountain, Castle)
at (Aladdin, Castle)
at (Aladdin, Castle)
Give (Aladdin, Lamp, King, Castle)
has (King, Lamp)
at (Aladdin, Castle)
Summon (King, Genie, Lamp, Castle)
at (Genie, Castle)
at (Genie, Castle)
controls (King, Genie)
Appear-Threatening (Genie, Aladdin, Castle)
Command (King, Genie, loves(Jasmine, King))
at (Genie, Castle)
loves (King, Jasmine)
Love-Spell (Genie, Jasmine, Castle)
loves (Jasmine, King)
Marry (King, Jasmine, Castle)
Slay (Aladdin, Genie, Castle)
Falls-in-Love (King, Jasmine, Castle)
Talk about knowledge:
There is a woman named Jasmine. There is a king named Jafar.
library of actions, characters,
This is a story about how King
Jafar
becomes
married
to Jasmine.
Order
(King,
Aladdin, has(King,
Lamp))
world state propositions
There is a magic genie. This is also a story about how the genie dies.
There is a magic lamp. There is a Travel
dragon.
The dragon has the
(Aladdin, Castle, Mountain)
magic lamp. The genie is confined within the magic lamp.
at (Aladdin, Mountain)
King Jafar is not married. Jasmine is very beautiful.
King Jafar
at (Aladdin, Mountain)
(Aladdin, Dragon, Mountain)
sees Jasmine and instantlySlay
falls
in love with her. King Jafar wants to
at (Aladdin, Mountain)
~alive (Dragon)
marry Jasmine. There is a brave
knight named Aladdin. Aladdin is
Pillage
(Aladdin,
Lamp,
Dragon,
Mountain) to get the
loyal to the death to King Jafar.
King
Jafar
orders
Aladdin
magic lamp for him. Aladdin wants King Jafar to have the magic
lamp. Aladdin travels from the
castleLamp)
to the mountains.
Aladdin
has (Aladdin,
Travel (Aladdin,
Mountain, Castle)
slays the dragon. The dragon is dead. Aladdin takes
the magic
at (Aladdin, Castle)
lamp from the dead body of the dragon. Aladdin travels from the
at (Aladdin, Castle)
Give (Aladdin, Lamp, King, Castle)
mountains to the castle. Aladdin hands the magic lamp to King
(King, Lamp)
Jafar. The genie is in the magichaslamp.
King Jafar rubs the magic
at (Aladdin, Castle)
lamp and summons the genieSummon
out of(King,
it. Genie,
The genie
is not confined
Lamp, Castle)
within the magic lamp. King Jafar controls the genie with atthe
magic
(Genie, Castle)
lamp. King Jafar uses the magic
lamp
to command the genie to
at (Genie,
Castle)
Appear-Threatening (Genie, Aladdin, Castle)
controls (King, Genie)
make Jasmine love him. The
genie wants Jasmine to be in love with
King Jafar. The genie castsCommand
a spell(King,
on Jasmine
making her fall in love
Genie, loves(Jasmine, King))
with King Jafar. Jasmine is madly in love with King Jafar. Jasmine
wants toloves
marry
King Jafar. The genie has a frightening appearance. at (Genie, Castle)
(King, Jasmine)
The genie appears threateningLove-Spell
to Aladdin.
Aladdin
(Genie, Jasmine,
Castle)wants the genie
to die. Aladdin slays the genie. King Jafar and Jasmine wed in an
loves (Jasmine, King)
Slay (Aladdin, Genie, Castle)
extravagant ceremony.
The genie is dead. King Jafar and Jasmine are married. The end.
Marry (King, Jasmine, Castle)
The “goodness” question
• Does the story generator know that it is creating something
good?
• How can a computational system generate a suspenseful story?
Falls-in-Love (King, Jasmine, Castle)
Order (King, Aladdin, has(King, Lamp))
Travel (Aladdin, Castle, Mountain)
at (Aladdin, Mountain)
Observe
event
at (Aladdin, Mountain)
Slay (Aladdin, Dragon, Mountain)
at (Aladdin, Mountain)
~alive (Dragon)
Compute
affect
Problemsolve
Pillage (Aladdin, Lamp, Dragon, Mountain)
has (Aladdin, Lamp)
Travel (Aladdin, Mountain, Castle)
at (Aladdin, Castle)
at (Aladdin, Castle)
Give (Aladdin, Lamp, King, Castle)
has (King, Lamp)
Part of
script?
at (Aladdin, Castle)
Y
Track
script
Forecast
w/script
Summon (King, Genie, Lamp, Castle)
at (Genie, Castle)
at (Genie, Castle)
controls (King, Genie)
Appear-Threatening (Genie, Aladdin, Castle)
Command (King, Genie, loves(Jasmine, King))
N
Forecast w/
simulation & rules
Y
Goal
violation
?
N
at (Genie, Castle)
loves (King, Jasmine)
Love-Spell (Genie, Jasmine, Castle)
loves (Jasmine, King)
Slay (Aladdin, Genie, Castle)
Marry (King, Jasmine, Castle)
New author goal
14
O’Neill & Riedl. Proc. ACII 2011 Conference.
Story
Generation
Interactive
Narrative
Narrative
Intelligence
Interactive narrative
A form of digital entertainment in which the player
influences a dramatic storyline through actions
Interactive narrative
• Narrative branches in response to player actions
1
4
• Combinatorics of authoring
5
7
• Drama manager:
9
– Monitors the virtual world
– Intervenes to drive the story
in a particular direction
58
15
20
32
31
80
22
81
82
110
96
55
57
76
75
98
78
73
91
95
101
106
109
100 102
103
111
60
104
23
34
46
59
24
38
33
47
65
86
64
37
87
114
67
85
83
48
40
116
49
51
63
70
68
99
90
69
55
76
28
27
26
50
21
19
16
14
45
62
10
13
43
77
• Surrogate for the human
author/storyteller
8
39
42
52
54
29
72
92
97
Page #
112
113
107
Riedl, Bulitko. AI Magazine, 34(1), 2013.
17
Automated story director
• Generative drama manager: uses a story generator to construct
alternative branches
• Start with an exemplar narrative (generated or hand-authored)
• Monitor player actions:
– Constituent: part of the narrative plan
– Consistent: do not affect narrative execution
– Exceptions: derail the narrative plan
• How to detect exceptions?
• How to respond to exceptions?
18
Riedl, Stern, Dini & Alderman. ITSSA, 3, 2008.
Initial State
Wolf is alive
Wolf is alive
Wolf is alive
Red has cake
Red Greets Wolf
Player kills
Wolf
Wolf knows Red
Wolf is alive
Red Tell Wolf About Granny
Wolf knows Red
Wolf knows Granny
Wolf Eats Granny
Wolf Eats Red
Granny eaten
Red eaten
Player Kills Wolf
Wolf not alive
Wolf not alive
Granny Escapes from Wolf
Granny not eaten
Red Escapes from Wolf
Red not eaten
Red Gives Granny Cake
Granny has cake
Outcome
Player takes
cake
Initial State
Intermediate State
5: Red Greet Wolf
11: Fairy Resurrect Wolf
Wolf not alive
4: Red Tell Wolf Granny
6: Wolf Eat Red
6: Wolf Eat Red
9: Player Kill Wolf
3: Wolf Eat Granny
10: Red Escape Wolf
9: Player Kill Wolf
10: Red Escape Wolf
3: Wolf Eat Granny
8: Granny Escape Wolf
7: Red Give Granny Cake
Red not has cake
18: Red Tell Gr
17: Grendel Eat R
8: Granny Escape Wolf
7: Red Give Granny Cake
Outcome
13
16: Red Escape
19:
Outcome
Inte
Intermediate State
11: Fairy Resurrect Wolf
3: Wolf Eat Granny
16: R
15: Red
9: Player Kill Wolf
10: Red Escape Wolf
10
8: Granny Escape Wolf
7: Red Give Granny Cake
14: G
13: P
Automated story director
• Pre-compute branches
• Semi-autonomous virtual characters
21
When dungeon master,
learned the hard way
that if players don’t get
what they want, they
fight you.
Personalized drama management
• Problem: players don’t know how their actions will impact
unfolding narrative
• Need to account for individual preferences for how story
should unfold
• Can we learn a model of
player story preferences?
Leave your
home
• Can a drama manager guide a
player through his or her most
preferred story trajectory?
Enter
the movie
theatre
Chased by
zombies
Attacked by
vampires
Captured!
Escape
from theatre
22
Yu & Riedl. AAMAS 2012 Conference.
Player modeling
• Collaborative filtering: observe many players and find statistical
similarities with which to recommend next plot point
• Sequential recommendation: recommendation of plot point is
dependent on history of plot points experienced so far
• Convert branching story graph into a prefix tree and
recommend next prefix node
A A1 1
11
22
33
2 2
B B1, 1,
44
C C 1, 1,
2, 2,
6 6
66
55
2, 2,
6, 6,
5 5
E E1, 1,
(a)
(a)
D D1, 1,
2, 2,
3 3
2, 2,
3, 3,
4 4 G G 1, 1,
2, 2,
3, 3,
5 5
F F1, 1,
(b)
(b)
23
T
In. our
In our
simple
simple
spell-casting
spell-casting
action
action
role-playing
role-playing
game
game
bed
cribed
in the
in the
next
next
section),
section),
U is
U the
is the
player
player
(“user”),
(“user”),
I isI is
spell
ll type
type
(“item”)
(“item”)
andand
T isT the
is the
time
time
of the
of the
performance
performance
ording.
ng. CPCP
decomposition
decomposition
is aisgeneralization
a generalization
of singular
of singular
ueecomposition
decomposition
from
from
matrices
matrices
to tensors.
to tensors.
In CP
In CP
decomdecom•three-dimensional
Non-negative
factorization
over
ntion
thethe
three-dimensional
Zmatrix
tensor
Z tensor
is decomposed
is decomposed
into
into story prefixes
eighted
hted combination
combination
of three
of three
vector
vector
latent
latent
factors,
factors,
Prefix-based collaborative filtering
KX
K
X
Z⇡
Z ⇡ k wk wkhk hkqk qk
k=1k=1
reis the
is the
vector
vector
outer
outer
product,
product,k are
positive
positive
weights
weights
k are
he
factors,
factors,
wk ware
player
player
factors,
factors,
hk hare
spell
spell
type
type
fac-fack are
k are
nd
, and
qk are
qk are
time
time
factors.
factors.
K is
Kthe
is the
number
number
of components
of components
or
d for
each
each
factor
factor
as an
as an
approximation
approximation
of the
of the
truetrue
strucstruceeping
, keeping
thethe
set set
of the
of the
KK
most
most
important
important
components
components
nd
(Kolda
(Kolda
andand
Bader
Bader
2009).
2009).
TheThe
decomposition
decomposition
cancan
be be
mputed
ted by by
minimizing
minimizing
thethe
rootroot
mean
mean
squared
squared
error
error
be-been
thethe
factor
factor
inner
inner
product
product
above
above
andand
truetrue
datadata
values,
values,
atively
ely fitting
fitting
each
each
of the
of the
factors
factors
while
while
fixing
fixing
values
values
of of
other
er factors
factors
until
until
convergence.
convergence.
WeWe
employ
employ
thethe
N-way
N-way
xbox
(Andersson
(Andersson
andand
BroBro
2000)
2000)
to perform
to perform
thisthis
decomdecomn.
tion.
Predictions
Predictions
in this
in this
model
model
consist
consist
of taking
of taking
thethe
in- in-
24
Experimental results
• Non-sequential recommendation indistinguishable from random
• PCBF improves story experiences:
• Compared to other approaches (using synthetic players):
26
Player agency
• No player agency -- system picks the best trajectory on behalf
of the player
• Modify story graph: more than one option/action between
plot points
• Collaborative filtering to also predict
rank order of options
• Drama manager guides player by
selecting which options to present
to the player
A
1
3
4
2
B
C
33%
75%
66%
25%
27
Computer game generation
Challenge tailoring
Choose and order the challenges the player should experience
Challenge Contextualization
Provide motivating story context between challenges
Difficulty
Challenge tailoring
Zook & Riedl. Proc. AIIDE 2012 Conference.
Time
Challenge contextualization
Take water
bucket
Pour water
on witch
Witch
drops shoes
Pick up shoes
Show shoes
to king
King trusts you
Tell about
princess
Move to lair
Kill dragon
Free princess
Teleport princess
to palace
Marry princess
Li & Riedl. Proc. AIIDE 2010 Conference.
Hartsook, Zook, Das & Riedl. Proc. CIG 2010 Conference.
Story
Generation
Interactive
Narrative
Narrative
Intelligence
Open story generation
• Narrative intelligence is knowledge-intensive, resulting in
micro-worlds
• Can we overcome the knowledge engineering bottleneck?
• Can an intelligent system learn to tell stories about any
imaginable domain?
Sociocultural storytelling
• Humans rely on a lifetime of experiences from which to
explain stories, tell stories, or act in the real-world
• Computational systems can now live in a rich information
ecosphere, including the Web, other agents, and humans
• Possible approaches:
– Read natural language corpora & websites
– Mine commonsense knowledge bases
– Learn from humans
34
Crowdsourcing narrative intelligence
• A crowd of humans on the web ➞ a supercomputer
• Insight: humans learn from stories
• Use a crowd to simulate a lifetime of experiences by asking
people to tell stories about a specific type of situation
• Crowdsource a highly specialized corpus of narrative
examples and learn a generalized model of
sociocultural situations
Automatically generate stories and
interactive experiences without a priori
domain knowledge authoring
35
Scheherazade
• Just-in-time model learning
– Collect written stories via Amazon Mechanical Turk
– Learn model via semantic parsing, pattern mining, global optimization
– Barthes: human narratives implicitly encode causality
– Grice: maxims of quality and relevance (and quantity)
Collect
Stories!
Learn
Model!
Memory!
Create
Story!
36
Li, Lee-Urban, Appling & Riedl. Advances in Cognitive Systems, 2, 2012.
Sociocultural knowledge representation
• Model a situation as a script
– Representation of procedural knowledge
• Set of temporally ordered events
walk/go into restaurant
read menu
wait in line
choose menu
item
place order
take out wallet
pay for food
...
– Correlated with expertise
...
– Tells one what to do and when to do it
37
Learning to tell stories
1. Query the crowd
2. Identify the salient events
3. Determine event ordering
4. Mutually exclusive events
• Crowd control:
– Segment narrative
– Use one verb per sentence
– Avoid conditionals and compound
structures
– Avoid using pronouns
38
Learning to tell stories
1. Query the crowd
• Crowd control simplifies NLP
2. Identify the salient events
• Compute semantic similarity
between sentences
3. Determine event ordering
4. Mutually exclusive events
• Cluster sentences into events
Order food
* Precision ≈ 85%
Eat food
39
Learning to tell stories
1. Query the crowd
2. Identify the salient events
3. Determine event ordering
4. Mutually exclusive events
• Seek evidence for temporal
relations
• Binomial confidence testing
• Search for the most compact
graph that explains the stories
walk/go into restaurant
Story 1
Story 2
Story 3
Story 4
read menu
wait in line
choose menu
item
take out wallet
pay for food
place order
40
Learning to tell stories
1. Query the crowd
• Measure mutual information
between events
2. Identify the salient events
3. Determine event ordering
• Mutual information is high
and co-occurrence is low
4. Mutually exclusive events
• Generalization of “or” relations
choose
restaurant
drive to
restaurant
walk/go into restaurant
mutex
drive to drive-thru
41
choose
restaurant
Fast food
restaurant
drive to
restaurant
walk/go into restaurant
read menu
drive to drive-thru
wait in line
choose menu
item
take out wallet
place order
pay for food
drive to window
wait for food
get food
find table
sit down
eat food
clear
trash
leave
restaurant
drive
home
42
go to ticket
booth
arrive at theatre
choose movie
wait for ticket
buy tickets
go to concession stand
order popcorn / soda
show tickets
buy popcorn
Going on a date
to the movies
enter theatre
find seats
turn off
cellphone
eat popcorn
sit down
watch movie
use
bathroom
discard trash
talk about
movie
hold hands
kiss
leave movie
drive home
43
John covers
face
Bank robbery
John enters
bank
John sees
Sally
John waits
in line
John approaches
Sally
Sally is
scared
Sally greets
John
John hands
Sally a note
John pulls
out gun
Sally reads
note
John points
gun at Sally
Sally
screams
John shows
gun
John demands
money
John gives
Sally bag
The note demands
money
Sally opens
cash drawer
Sally collects
money
Sally give
John money
Sally puts
money in bag
Sally presses
alarm
Sally gives
John bag
John collects
money
John takes
bag
John opens
bank door
John leaves
bank
John gets in
car
Police
arrives
John drives
away
Police arrests
John
Sally calls
police
44
Narrative generation
• Script defines a space of linear sequences
– Search for most typical, least typical, specific events, surprising, etc.
• Evaluation shows generated stories comparable to humanauthored stories
Collect
Stories!
Learn
Model!
Memory!
Create
Story!
45
Interactive narrative generation
Li, Lee-Urban & Riedl. Proc. Intelligent Narrative Technologies 2012 Workshop.
The road ahead
• Starting with basics of plot causality and character believability
• Progressively layering complexity
• Computational aesthetics
• Data-driven tailoring
• Story generation in the
real world
47
Conclusions
• Story generation is a key capability that unlocks many
practical, real-world applications
– Create and manage user experiences in virtual worlds
– Games, interactive narratives, training simulations, narrative
learning environments, virtual characters
• Narrative intelligence is a step toward human-level intelligent
systems
• Creative, expressive computational
systems
48
Acknowledgements
• Boyang Li
• Sauvik Das
• Brian O’Neill
• Rania Hodhod
• Alexander Zook
• Mohini Thakkar
• Hong Yu
• Sanjeet Hajarnis
• Ken Hartsook
• George Johnston
• Michael Drinkwater
• Charles Isbell
• Steve Lee-Urban
• R. Michael Young
Thanks! Questions?
[email protected]
@mark_riedl
49