Lookups #117
Replies: 4 comments
-
OlaVMOlaVM uses both inner table lookups and cross table lookups: Inner Table Lookup (2 constraints)A subset argument technology between columns I and T, proving that cells in column I all appear in column T at least once. Algorithm A quick and dirty summary of the image - given 2 columns I and T, we want to prove that all cells in column I appear in column T at least once. To achieve this, we need to implement and use a permutation argument. source: page 137 of the OlaVM whitepaper V2 Code The relevant code is found in In the implementation of that function you can see that the constraints are being enforced in a pub(crate) fn eval_lookups<F: Field, P: PackedField<Scalar = F>, const COLS: usize>(
vars: StarkEvaluationVars<F, P, COLS>,
yield_constr: &mut ConstraintConsumer<P>,
col_permuted_input: usize,
col_permuted_table: usize,
) {
// Other code above this line
yield_constr.constraint(diff_input_prev * diff_input_table);
// This is actually constraining the first row, as per the spec, since
// `diff_input_table` is a diff of the next row's values. In the context of
// `constraint_last_row`, the next row is the first row.
yield_constr.constraint_last_row(diff_input_table);
} Cross Table LookupMix of subset argument and permutation argument (This is basically a multiset check from what I can tell)
Algorithm source: page 138 of OlaVM whitepaper V2 Code The The usage of these cross table lookups can be found when constructing an |
Beta Was this translation helpful? Give feedback.
-
MidenMiden uses lookup arguments in the form of multiset checks, for 2 purposes (Multiset Checks - Polygon Wiki).
Compared to Ola, the main difference seems to be that multiset equality check is implemented as a single running product column (which is not actually single, later on it is explained that each running product column needs to be represented by 2 columns for ~100-bit security) (This info is found in the link above) The first is achieved through virtual tables, while the second is achieved through a communication bus. Currently, there are 2 buses implemented (chiplets bus, range checker bus) Essentially both seem like optimization techniques. Virtual tables trade off storing entire tables for storing extra rows + doing some computation to prove data consistency of this 'fake' table. The communication bus connects two sections of a trace, and operates on the Request/Response paradigm (eg. the stack can 'request' a 'response' from the Bitwise chiplet for a bitwise operation) ConstraintsThe constraints for the communication bus can be found here. Code The |
Beta Was this translation helpful? Give feedback.
-
TritonAs a disclaimer, TritonVM is using a different hash function (Tip5) instead of Poseidon. So I'm not entirely sure if this would be useful for our purposes. They rely on Lookup Tables as well as Cascade Tables - this construction seems unique for the usage of the Tip5 hash. I'd have to read the Tip5 paper in detail to understand it but it seems like TLDR of the paper is that they did some benchmarking and found Tip5 to be much faster than Poseidon/Rescue-prime. Benchmarks are available in the paper. It's based on Marvellous design strategy (eg. Rescue-Prime) in contrast to Hades desgin strategy (eg. Poseidon). One thing we could learn from them is their code quality, which is very nice imo: However, their constraints seem to be auto-generated by something called the constraint-evaluation-generator, Out of curiosity there's also an example program found in a separate repository in triton-vm-scaffold. |
Beta Was this translation helpful? Give feedback.
-
Risc0There isn't much to gather from their code since part of it seems like it's closed source. We can look at their |
Beta Was this translation helpful? Give feedback.
-
This will serve as a discussion for all lookup-related research on existing implementations.
To make use of our traces, we need to use lookups to reason about relationships and prove computation between them.
I'll write a new comment for each existing implementation so that we may reply and discuss under the relevant comment for each VM.
Each section will include a section on the algorithm and the actual code for reference.
Beta Was this translation helpful? Give feedback.
All reactions