Skip to content
You are reading the documentation of ALVIE 2026.09 (extended documentation). Current documentation: 2026.10. Other versions: development version, 2026.09 (as released)

Choosing Learner Settings

Advanced New

The learner settings decide how hard ALVIE looks for behavior that the model does not yet describe. Weak settings finish fast and can give an incomplete model. Strong settings give more confidence and take longer. This guide helps you to choose.

Read How ALVIE Works first. The commands run from alvie/code.

The --oracle option selects how ALVIE searches for a difference between the model and the system.

OracleHow it searchesGuaranteeCost
randomwalkFollows random paths that the specification allows. Stops after --step-limit steps.None.Low. You control it.
pacSamples many random paths. The number grows with each round.A probability bound from --epsilon and --delta.Medium to high.
exhaustiveTries every input sequence from the full alphabet, level by level.It checks every sequence up to its stop condition.Very high.

Use randomwalk to develop and test a specification. Use pac for a result that you report. Use exhaustive only for very small specifications.

The wrapper scripts (learn_one.sh, learn_all.sh) use pac with --epsilon 0.01 --delta 0.01.

The random-walk oracle starts at the initial state of the model. It chooses the next input at random from the inputs that the specification allows. It sends the input to the system and compares the output with the model. If the outputs differ, the oracle has found a difference.

Three options control it:

OptionDefaultMeaning
--step-limit500The number of steps for each equivalence query. A reset also counts as one step.
--reset-probability0.05The probability that the walk restarts from the initial state after each step.
--bad-probability0.20The probability that the next input ignores the specification. pac uses this option too.

A larger step limit means a longer search and a lower chance to miss a behavior. A higher reset probability gives shorter paths and tests more early behavior. A lower reset probability gives longer paths. Use a lower value when the behavior you need appears only after many steps.

If the oracle finds no difference within the step limit, the learner accepts the model. The oracle gives no probability for the error.

The PAC oracle (Probably Approximately Correct) samples random paths in rounds. Round r samples this many paths:

ceil( (1 / ε) × ( ln(1 / δ) + (r + 1) × ln 2 ) )

The first round samples these numbers of paths:

--epsilon and --deltaPaths in round 1Paths in round 2
0.01530600
0.001 (default)76018295
  • --epsilon is the error bound. A smaller value means that the model can disagree with the system on fewer paths.
  • --delta is the confidence bound. A smaller value means that the guarantee fails with a lower probability.
  • --round-limit limits the number of rounds. Without it, the oracle runs until a round finds no difference.

The guarantee is for one model. An ALVIE experiment uses four models, so the combined bounds are weaker. The paper gives (1 − δ)⁴ for the confidence and (1 − ε)⁴ for the accuracy.

--pac-bound has no effect on the oracle. It appears only in the --report output.

The exhaustive oracle tries every input from the complete alphabet. It does this level by level. It does not use the specification to reduce the search. A path ends when the system gives an illegal output.

The number of input sequences grows quickly with the length and the alphabet size. Use this oracle only for a small alphabet, for example in a test of a new action.

The table below shows real runs of the Getting Started example (secret 0, commit bf89c0b) on one workstation. Five runs shared the machine, so the times are rough. The complete model has 6 states and 5 transitions.

SettingsSUL stepsTimeResult
randomwalk --step-limit 2014133 s5 states. Incomplete.
randomwalk --step-limit 10014631 s5 states. Incomplete.
randomwalk --step-limit 50022834 s6 states. Complete.
pac --epsilon 0.01 --delta 0.0127840 s6 states. Complete.
pac (default 0.001)111983 s6 states. Complete.

The two short random walks accepted a model that had merged two states. ALVIE did not report an error. This is the main risk of a weak oracle.

To run the comparison yourself, use a loop from alvie/code. Each run takes about 20 to 40 seconds:

Terminal window
cd alvie/code
for limit in 20 100 500; do
_build/default/bin/learn.exe \
--att-spec ../../spec-lib/example/attacker.atdl \
--encl-spec ../../spec-lib/example/enclave.etdl \
--oracle randomwalk --step-limit $limit \
--secret 0 \
--commit bf89c0b \
--res /tmp/rw-$limit.dot \
--tmpdir /tmp/alvie-rw-$limit \
--sancus "$PWD/../../sancus-core-gap" \
--report
done
wc -l /tmp/rw-*.dot
cd ../..

The runs with limits 20 and 100 write 20 lines, and the run with limit 500 writes 21 lines. The --report option prints one line of statistics for each run.

Part of the time in each run is fixed. ALVIE needs 20 to 25 seconds to prepare the simulator before it asks the first query.

  1. Develop with the fast specifications. The directory spec-lib/fast/ has faster attacker specifications. They use one timer value instead of four, so the learner has fewer cases to explore. The enclave specification is the same. Use randomwalk with them, and start with --step-limit 500.
  2. Test that the model is stable. Learn the model again with a larger step limit. If the model does not change, you have more confidence in it. If it changes, the first limit was too low.
  3. Report with PAC. Use --oracle pac --epsilon 0.01 --delta 0.01 for the final run. Use the complete specifications for a result that you publish.
  4. State your settings. Write the oracle, the limits, and the specification names next to every result.

The complete specifications can need many hours for each model. Start the run on a machine that you can leave running.

learn.exe starts its random generator with a fixed seed. If you run the same command twice, you get the same search and the same model. To try a different search, change a limit (for example --step-limit). Do not run the same command again and expect a different result.

Add --report to print one line of statistics on the error output. The fields, in order, are:

oracle, pac-bound, epsilon, delta, step-limit, reset-probability,
resets, steps, dry-steps, output-queries, equivalence-queries,
average-path-length, path-length-variance, time-in-milliseconds

Example (the randomwalk --step-limit 500 run above):

randomwalk, 1, 0.001000, 0.001000, 500, 0.050000, 324, 228, 1011, 184, 6, 3.962687, 4.409055, 6242
  • steps is the number of inputs that ran on the simulator.
  • dry-steps is the number of inputs that ALVIE answered from data it already had.
  • equivalence-queries is the number of rounds of model checking.
  • The last field is the time that the learner took, without the simulator preparation.

The option --ignore-interrupts changes timer_enable. The action no longer enables the timer interrupt, so the timer cannot interrupt the enclave. Use it to learn the baseline models for a four-model comparison. Always give the baseline run the same oracle and limits as the main run. The Reading and Checking a Witness guide explains how the comparison uses them.