A practical introduction to active automata learning Bernhard - - PowerPoint PPT Presentation

a practical introduction to active automata learning
SMART_READER_LITE
LIVE PREVIEW

A practical introduction to active automata learning Bernhard - - PowerPoint PPT Presentation

A practical introduction to active automata learning Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund SFM2011 Maik Merten, learning technology 1 Overview Motivation Introduction to active automata learning Practical aspects in


slide-1
SLIDE 1

Maik Merten, learning technology 1

A practical introduction to active automata learning

SFM2011

Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

slide-2
SLIDE 2

Overview

  • Motivation
  • Introduction to active automata learning
  • Practical aspects in active automata

learning

  • Conclusions
slide-3
SLIDE 3

learner connector try to use

X

inform about new service and device interrogate interrogate learn look for known models some service CONNECT environment

Connect Scenario

slide-4
SLIDE 4

Learning in CONNECT

Develop techniques for learning … models of … behavior of networked peers and middleware through exploratory interaction…

WP4 Learning Enabler

Rich & abstract models:

  • Data parameters & state

variables

  • Pre- and post-conditions
  • Non-functional properties

Interface descriptions Semantic information on

  • Data domains
  • Data dependencies
  • Effects

Metrics of interest Counterexamples through monitoring

slide-5
SLIDE 5

Overview

  • Motivation
  • Introduction to active automata learning
  • Practical aspects in active automata

learning

  • Conclusions
slide-6
SLIDE 6

Mealy machines

 Mealy machine M=(S,, ,,)

 S finite set of states   finite input-alphabet   finite output-alphabet  : (S x ) → S transition-function  : (S x ) →  output-function

  • Words * for (sS, a, w*)

 :(S x *) → S, (s,)=s, (s,aw) =((s,a),w)  : (S x *) → *, (s,)=, (s,aw) = (s,a).((s,a),w)

slide-7
SLIDE 7

Passive learning or learning with traces

 tape-record communication  Create observation tree  Construct automaton without contradiction

slide-8
SLIDE 8

a/0 a/1 b/1 a/0 b/0 a/0 b/1 a/0 b/0 b/1 b/0 a/0 a/0 b/1 a/1 b/0 b/1 a/0 a/0 b/0 b/0 a/0

Passive learning or learning with traces

slide-9
SLIDE 9

a/0 a/1 b/1 a/0 b/0 a/0 b/1 a/0 b/0 b/1 b/0 a/0 "equivalent" states (no contradiction) a/0 b/1 a/1 b/0 b/1 a/0 a/0 b/0 b/0 a/0

Passive learning or learning with traces

slide-10
SLIDE 10

a/0 a/1 b/1 a/0 b/0 a/0 b/1 a/0 b/0 b/1 b/0 a/0

Passive learning or learning with traces

slide-11
SLIDE 11

a/0 a/1 b/1 a/0 b/0 a/0 b/1 a/0 b/0 b/1 b/0 a/0 a/0 a/1 b/1 b/0 b/0 a/0

Passive learning or learning with traces

slide-12
SLIDE 12

Observations

 The relation "not in conflict" is very weak:

 Reflexive, symmetric, but not transitive!  `Not in conflict´ clusters typically overlap  The relation contain various eqivalence relations  Computing the best choice of equivalence is:  Expensive for criteria like state minimality  Impossible in terms of adequacy for the problem.

slide-13
SLIDE 13

Active automata learning

Idea 1: Ask where infomation is incomplete!

  • This requires an active testing mechanism:

 Membership Queries: Check the reaction of the

system to input sequences.

  • Checking all inputs at all positions makes `not in

conflict´ an equivalence relation.

slide-14
SLIDE 14

Angluin's algorithm

  • Consequence:
  • The underlying tree is homogeneous in the sense

that all nodes treat the same set of inputs.

  • As the not in conflict relation is now an equivalence

relation, the corresponding clustering is unique

  • Problem:
  • The clustered graph may be non-deterministic in

general

slide-15
SLIDE 15

Angluin's algorithm

Idea 2: Enforce consistency!

  • Refine the ‚not in conflict‘ relation
  • Also consider whether the target of the transitions
  • f each cluster are unique for each input
  • I.e.: consider the largest congruence wrt. The Transition

relation inside the not in conflict relation).

This yields determinism!

slide-16
SLIDE 16

Angluin's algorithm

Consequence:

  • Clustering yields an (input) deterministic graph /model)
  • The projective quotient model of a consistent and

homogeneous abstraction) This simplifies the situation a lot: Termination Lemma 1 Given some execution tree, realizing the two ideas via Membership Queries provides a closed, consistent , and deterministic Hypothesis Model (Quality? Termination?)

slide-17
SLIDE 17

Angluin's algorithm

Idea 3: Introduce qualitative termination!

 Equivalence Queries: Check for equivalence with

the target system, and produce a distinguishing test in case of failure.

  • Conceptually a nice idea that leads to a very

elegant correctness proof.

  • Practically typically not implementable.
slide-18
SLIDE 18

Active automata learning

Learner MQ-Oracle EQ-Oracle Σ={a,b} a  L? no ? no, bb  L!

a a a a b b b b a a,b b

slide-19
SLIDE 19

(queries) should word w be included in L(A)? (conjectures) here is an A – is L(A) = U? yes / no yes! no: word w should (not) be in L(A) the oracle L* learner

slide-20
SLIDE 20

Angluin's alg. for Mealy machines

a b ε S a b

 Initialize

Distinguishing Set D with alphabet of inputs

state cover set

  • ne transition

extensions SA distingushing set

D

slide-21
SLIDE 21

a b ε a b Unknown system:

1 1 1 1

Angluin's alg. for Mealy machines

slide-22
SLIDE 22

a b ε a 1 1 b 1 1

 Unclosure:

Rows in lower part that are not in upper part

Angluin's alg. for Mealy machines

slide-23
SLIDE 23

a b ε a 1 1 b 1 1 aa 1 1 ab 1 1

 Unclosure:

Rows in lower part that are not in upper part

Angluin's alg. for Mealy machines

slide-24
SLIDE 24

a b ε a 1 1 b 1 1 aa 1 1 ab 1 1

 Conjecture:  Unique rows in S become

states

 Rows in S and SA

become transitions

Angluin's alg. for Mealy machines

slide-25
SLIDE 25

 Counterexample:

bbb / 010

a b ε a 1 1 b 1 1 aa 1 1 ab 1 1

Angluin's alg. for Mealy machines

slide-26
SLIDE 26

a b ε a 1 1 b 1 1 bb aa 1 1 ab 1 1 ba … … … bbb

Angluin's alg. for Mealy machines

 Counterexample:

bbb / 010

 Insert all prefixes of the

counterexample to upper part

 Extend SA accordingly

slide-27
SLIDE 27

a b ε a 1 1 b 1 1 bb aa 1 1 ab 1 1 ba … … … bbb

 Inconsistency:  Equal rows in upper

part have ‚different extensions‘

00 00 00

Angluin's alg. for Mealy machines

slide-28
SLIDE 28

a b ε a 1 1 b 1 1 bb aa 1 1 ab 1 1 ba … … … bbb

 Inconsistency:  Equal rows in upper

part have ‚different extensions‘

 b and bbb differ, e.g.,

for suffix b => ε and bb will differ for suffix bb

Angluin's alg. for Mealy machines

slide-29
SLIDE 29

 Inconsistencies lead

to new columns

Angluin's alg. for Mealy machines

a b bb ε 1 a 1 1 1 b 1 1 bb aa 1 1 1 ab 1 1 1 ba 1 … … … 1 bbb …

New Conjecture

slide-30
SLIDE 30

Target System Learned System

Angluin's alg. for Mealy machines

slide-31
SLIDE 31

Summarized Observations (1)

 Systematic completition of the observation table  New states arise as targets of transitions or from

counter examples of the equivalence queries. Technically: prefixes are added to S

 Closure procedure extends SA  Consistency is enforced by enlarging the

Distinguishing Set D

slide-32
SLIDE 32

Angluin's algorithm

Hypothesis models or conjectures:

  • Closed and consistent models (projective

quotients) of the so far expanded

  • homogeously extended, and
  • consistent

execution tree.

slide-33
SLIDE 33

Summarized Observations (2)

Invariance Lemma:

 All hypothesis models are

 totally defined: each input is considered at each state,  input deterministic: there is only one transition per input at

each state,

 transition covered: each transition lies on a path of the original

system,

 state minimal: two different states in a hypothesis model

always have a separating future – á la Nerode).

slide-34
SLIDE 34

Myhill–Nerode

Nerode relation:

For language L define relation RL (for u,u‘  Σ*)

u RL u‘ ↔ for all v  Σ*: (uv  L ↔ uv  L)

Myhill-Nerode Theorem:

Minimal number of states of an accepting deterministic automaton equals the number of equivalence classes of RL

slide-35
SLIDE 35

Summarized Observations (4)

This (Nerode‘s theorem) directly yields:

 Corollary: Hypothesis automata have at most as

many states as the smallest deterministic equivalent automaton.

  • We will denote the number of states by n.
slide-36
SLIDE 36
  • Lemma: The number of states of the hypothesis

model increases in response to a counterexample.

  • Theorem: Angluin´s algorithm terminates after at

most n equivalence queries with the smallest deterministic system representing the behaviour

  • f the system to be learned.

Summarized Observations (4)

slide-37
SLIDE 37

Equivalence Queries At most |Q| Membership Queries At most O(m |Q| |ΣA| ) per EQ (m = length of max. counter example)

  • Max. size of table = O(m |Q|2 |ΣA|).

Theorem (Complexity for const. Time MQs and EQs). O( m |Q|2 |ΣA| ). For m in O(|Q|) the complexity result reads: O(|Q|3 |ΣA|)

Complexity of Angluin

slide-38
SLIDE 38

Remaining Problems

 High Computational Complexity  Even worse: equivalence queries in general

undecidable. In essence:

 Active automata learning always remains at the level

  • f hypotheses:

 neither correct nor complete

slide-39
SLIDE 39

39

Further Developments

slide-40
SLIDE 40

Conceptual Improvements 1

a b bb ε a 1 1 b 1 1 bb aa 1 1 ab 1 1 ba … … … bbb

All prefixes of counterexample …

  • ne erssential suffix
slide-41
SLIDE 41

Reduced observation table

Rivest and Shapire: Analyze counterexample separately (not in the table)

  • Only add one ‚essential‘ suffix (i.e., witness), as

column label to the table

Consequence: Guaranteed Consistency! BUT: Hypothesis Automata are no longer guaranteed to be minimal!

(cf. Pnueli / Mahler‘s criticism)

slide-42
SLIDE 42

Reduced observation table (contd.)

Saves membership queries! (by saving rows in the

  • bservation table)

Essential suffix

slide-43
SLIDE 43

Equivalence Queries At most |Q| Membership Queries for guaranteed progress after Eqs At most O( log2(m) + |ΣA| |Q|) per EQ (m = length of max. counter example)

  • Max. size of table = O(|Q|2 |ΣA|).

Theorem (Complexity for const. Time MQs and EQs). O( |Q|2 |ΣA| + |Q| log2(m) ). For m in O(|Q|) the complexity result reads: O(|Q|2 |ΣA|)

Complexity (reduced observation table)

slide-44
SLIDE 44

Conceptual Improvements 2

a b bb ε a 1 1 b 1 1 bb aa 1 1 ab 1 1 ba … … … bbb

All rows are filled completely, even if unnecessary

slide-45
SLIDE 45

Discrimination tree

Angluin: Add suffix globally to all rows

  • leads to unclosedness
  • resolved by new elements

in S Kearns & Vazirani: Add suffix only locally

  • Suffix only added to one ‚essential‘

sub-table.

  • Prefix known from counterexample

‘Sink’ words into table through discrimination tree

non uniform suffix classifying output

slide-46
SLIDE 46

Discimination tree (contd.)

Saves membership queries! (by saving entries in the

  • bservation table)

More equivalence queries! (using suffixes globally may be a good heuristic sometimes)

Worst case complexity unchanged

Kearns & Vazirani + discrimination tree

slide-47
SLIDE 47
  • Lemma. Each counterexample leads to at least one new

state.

  • Lemma. The hypothesis automata are guaranteed to have

fewer states than the minimal deterministic finite automaton for the considered language.

Theorem (for perfect equivalence oracle)

The algorithm terminates with the smallest determinsitc automaton for the considered language / set of traces.

Correctness pattern (maintained)

slide-48
SLIDE 48

Overview

  • Motivation
  • Introduction to active automata learning
  • Practical aspects in active automata

learning

  • Conclusions
slide-49
SLIDE 49

49

Practical results II

The ZULU competition

slide-50
SLIDE 50

The ZULU challenge

  • Competition in active learning (2010)
  • No equivalence queries allowed, limited

amount of membership queries

  • Randomly generated automata
  • Test-based evaluation
  • http://labh-curien.univ-st-etienne.fr/zulu/
slide-51
SLIDE 51

Evolving hypothesis

slide-52
SLIDE 52

Continuous equivalence queries

slide-53
SLIDE 53

ZULU competition results

Kearns & Vazirani: High impact even here!

slide-54
SLIDE 54

Detailed results

slide-55
SLIDE 55

Asymtotic costs per state

ZULU Problem 49763507

slide-56
SLIDE 56

56

Practical results I

More Applications

slide-57
SLIDE 57

Practical challenges

Behavioral models

Test-driver

<presence type=… /> <iq type= “result“ /> Available OK

reset interfacing real systems:

  • alphabet generation
  • abstraction
  • data

equivalence queries membership queries

Interface description etc.

slide-58
SLIDE 58

58

Practical results I

Learning assumptions

slide-59
SLIDE 59

query c A true M2 Ai

  • racle for WA in assume-guarantee

reasoning

L*

query: string s

s M1 P

conjecture: Ai

Ai M1 P

false+crex c c A c A (simulate s on M1 || Perr) (model check) (model check) false+crex c true / false true P satisfied P violated true false

1. A M1 P

  • 2. true M2 A

true M1 || M2 P

slide-60
SLIDE 60

60

Practical results I

Learning the OCS

slide-61
SLIDE 61

User model: paper workflow

slide-62
SLIDE 62
slide-63
SLIDE 63

Hierarchy

slide-64
SLIDE 64

Event Condition Action

Submit Report

slide-65
SLIDE 65

Semantics of "phase expires"- edges (1)

slide-66
SLIDE 66

Semantics of "phase expires"- edges (2)

slide-67
SLIDE 67

Many participants

slide-68
SLIDE 68

DB

Putting it all together

Jboss

  • cs

Tomcat JEE JMS ECA Work- flows

slide-69
SLIDE 69

Regular extrapolation

slide-70
SLIDE 70

Optimized learning setup

slide-71
SLIDE 71

Learning algorithm

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • Observation Table
  • Mealy machine inference
  • Regular extrapolation

First Hypothesis

slide-72
SLIDE 72

Reusing system states

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

slide-73
SLIDE 73

Reuse tree on our example

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • 52 Membership Queries
  • Saved 12 Resets
slide-74
SLIDE 74

Exploitation: failure invariance

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • Domainknowledge
  • Failing actions due to missing

permissions

  • OCS is transaction secure

(roll back in case of error)

  • Partition output alphabet into

successful and failed execution

  • Reflexive edges indicate failure
  • utput
slide-75
SLIDE 75

Pumping: Unfolding edges

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • For 52 Membership Queries only 10

Resets necessary

  • 50 Symbols executed (of 148)

Queries 9 to 20 will be ‘pumped’, e.g.

  • UD UD or
  • DP SP

already known

slide-76
SLIDE 76

Exploitation: Invariant symbols

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • Downloading (reading) a document

(DD) does not change a system state

  • The state can be kept for reuse
  • Only 6 Resets and 35 Symbols need

to be executed Failure invariance + invariant input symbol DD. indicates allowed outputs.

slide-77
SLIDE 77

Statistics: Learning the OCS

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • a) No reuse
  • b) Only direct re-usage
  • c) Exploit input knowledge
  • d) Exploit output knowledge
  • e) Exploit input and output

knowledge

slide-78
SLIDE 78

Statistics: Learning the OCS

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

MQs = Resets + Reuses + Pumped

  • a) Only direct reusage
  • b) Exploit of failure outputs
  • c) Like b) but one input marked as invariant
  • d)-f) failure outputs and invariant for growing learn alphabets
slide-79
SLIDE 79

Statistics: Learning the OCS

Bernhard Steffen | EternalS' 2011 @ Budapest, HU

  • Reset times are growing
  • Observed runtime included execution
  • f input symbols

Accumulated reset time is highly optimistic!

slide-80
SLIDE 80

Simple User Process

SP: Submit Paper UD: Upload Document IS: Interrupt Submission IU: Interrupt Upload RS: Restart Submission RU: Restart Upload

slide-81
SLIDE 81

Learned automaton

slide-82
SLIDE 82

Verification

slide-83
SLIDE 83

Overview

  • Motivation
  • Introduction to active automata learning
  • Practical aspects in active automata

learning

  • Conclusions
slide-84
SLIDE 84

Conclusions

Active Automata Learning:

  • its practice has many facets:
  • Abstraction
  • Instrumentation
  • Reuse/Optimization
  • It establishes a new system perspective

Systems as evolving ‚beasts‘:

  • to be observed continuously
  • difficult to control:

Forget the ‚Why/How‘ focus on the ‚What‘ !

Bern hard Steff