Thomas Coratger
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Memory Models & Lookup Arguments in leanVM ## Memory in the leanVM The primary goal of the leanVM is to prove the aggregation and merging of many hash-based signatures (XMSS). This requires a VM that can execute logic involving loops, function calls, and data access. The leanVM design opts for a **Read-Only Memory** model. * **Advantage**: It's simpler and cheaper to prove. The Prover can't overwrite memory, which simplifies the constraints. * **Challenge**: How do we efficiently prove that the Prover's memory operations are valid? A memory trace is considered valid if it satisfies two core properties: 1. **Read-Only Property**: The same memory address must always return the same value. An access $(a, v)$ is inconsistent if another access $(a, v')$ exists where $v \neq v'$. 2. **Continuity Property** (for some use cases): The set of all accessed memory addresses forms a complete, contiguous range. Enforcing these properties directly on a raw, unsorted memory trace is difficult. The key insight is to prove that the memory trace is a **permutation** of a sorted, valid memory layout. This transforms the problem of verifying memory consistency into a **multiset check**. ## Technique 1: The Permutation Check (Grand Product Argument) A multiset check verifies that two multisets (sets that allow repeated elements) are equal. In our context, we want to prove: > *The multiset of address-value pairs $(a, v)$ used in the execution is a permutation of a sorted and valid set of pairs $(a', v')$.* ### The Core Idea: Polynomial Equivalence We can represent each multiset as a polynomial whose roots are the elements of the multiset. If the two multisets are equal, their corresponding polynomials will be identical. Given two multisets $\{x_i\}$ and $\{y_i\}$, we check the following polynomial identity by evaluating it at a random challenge $\alpha$: $$\prod_{i} (\alpha - x_i) \stackrel{?}{=} \prod_{i} (\alpha - y_i)$$ This check is made practical in a STARK using a **running product column**. We introduce an auxiliary column `p` in our AIR table that enforces this check across all rows. * **Initialization (Boundary Constraint)**: `p[0] = 1`. * **Update Rule (Transition Constraint)**: $$ p[i+1] = p[i] \cdot \frac{\alpha - x_i}{\alpha - y_i} $$ * **Final Check (Boundary Constraint)**: `p[last] = 1`. If the final value of the running product is 1, it means all terms in the numerator have been canceled out by terms in the denominator, proving the two multisets are identical. This powerful technique is often called a **Grand Product Argument**. ### Open Questions for Discussion * The Grand Product argument works well but can be rigid. What are its main limitations, especially when dealing with repeated operations or values with varying frequencies? * How does the degree of the transition constraint impact prover performance, and what happens to it here? ## Technique 2: LogUp - Handling Multiplicities The Grand Product argument breaks down when we need to handle **multiplicities** efficiently. For example, a range check table might contain the value `5` only once, but the execution trace might use it 100 times. We need a way to check that `5` appears in the table while accounting for its 100 uses. The multiset check with multiplicities is: $$\prod_{i} (\alpha - x_i) = \prod_{j} (\alpha - t_j)^{m_j}$$ where $m_j$ is the number of times table element $t_j$ is used. This is not a polynomial equation because the multiplicity $m_j$ is in the exponent. ### The LogUp: Products to Sums **LogUp** elegantly solves this by applying a formal logarithmic derivative, which transforms products into sums: $$\frac{d}{d\alpha} \log \left( \prod (\alpha - x_i) \right) = \sum \frac{1}{\alpha - x_i}$$ The multiset check with multiplicities becomes a polynomial-friendly equation: $$\sum_{i} \frac{1}{\alpha - x_i} \stackrel{?}{=} \sum_{j} \frac{m_j}{\alpha - t_j}$$ This is implemented with a **running sum** column `s` instead of a running product column. * **Initialization**: `s[0] = 0`. * **Update Rule**: $s[i+1] = s[i] + \frac{m_{i+1}}{\alpha - t_{i+1}} - \frac{1}{\alpha - x_{i+1}}$. * **Final Check**: `s[last] = 0`. ### The Trade-off While super nice, LogUp has a significant drawback: **higher-degree constraints**. To eliminate the fractions in the transition constraint, we multiply by all denominators, causing the degrees of the polynomials involved to add up. This increases prover complexity and can impact performance. ### Open Questions for Discussion * When is the complexity of LogUp justified over a simpler Grand Product? What are the key design trade-offs? * Are there techniques to mitigate the degree explosion in LogUp constraints? * Is there any benefit to add LogUp+GKR? It seems Starkware and Miden folks abandoned this idea after testing it. ## Technique 3: LogUp* - Optimizing Indexed Lookups The leanVM, like many modern zk-VMs, needs to perform indexed lookups. For example, to decode an instruction, it looks up flags and offsets from a small, fixed bytecode table. * **The Table $T$**: A small table of size $m$ (e.g., the VM's instruction set). * **The Index Column $I$**: A large column of size $n$ in the execution trace, specifying which instruction is executed at each cycle. * **The Looked-Up Values $I*T$**: The resulting values, where $(I*T)[i] = T[I[i]]$. The challenge is that $I*T$ is a large vector ($n$ elements) of potentially large field elements. Committing to $I*T$ directly is very expensive for the Prover. ### Pushforward/Pullback **LogUp*** avoids committing to $I*T$ entirely by using pushforward/pullback. * **Pullback $I*T$**: "Pulls" values *from* the table $T$ according to indices in $I$. This creates the large vector we want to avoid. * **Pushforward $I_*A$**: "Pushes" and aggregates values *from* a vector $A$ *to* the table $T$'s structure. This creates a small vector of size $m$. $$ (I_*A)[j] = \sum_{i \text{ s.t. } I[i]=j} A[i] $$ The core duality lemma states: $\langle I_* A, B \rangle = \langle A, I^* B \rangle$. ### The LogUp* Protocol To prove a claim about an evaluation of $I*T$ at a random point $r$, e.g., $(I*T)(r) = e$, the protocol is: 1. **Commit**: The Prover commits to the small vectors $I$ and $T$, and the small pushforward vector $I_*eq_r$, where $eq_r$ is a special evaluation polynomial (the Lagrange kernel). Importantly, the Prover never commits to the large $I*T$ vector. 2. **Prove**: The Prover uses the duality lemma to transform the claim: $$ e = (I^*T)(r) = \langle I^*T, eq_r \rangle = \langle T, I_*eq_r \rangle $$ This final claim, $\langle T, I_*eq_r \rangle = e$, is an inner product between two small, committed vectors. It can be verified efficiently with a sumcheck protocol. 3. **Validate**: The Prover must also prove that the $I_*eq_r$ vector was computed correctly. This is done with a specialized LogUp-style check on the pushforward. This trades one large commitment for one small commitment and a sumcheck, resulting in a massive performance gain for the Prover. The leanVM uses logup* to handle instruction decoding by looking up flags and offsets from its bytecode, significantly reducing commitment costs. ### Open Questions for Discussion * LogUp* seems ideal for small tables. What defines "small"? What is the break-even point where this technique becomes more efficient than others? * The protocol involves a sumcheck. How does the cost of this sumcheck compare to the savings from avoiding the commitment to $I*T$? * A classical LogUp is much more simple, is LogUp* worth it in practice (we should have feedback on this since we already have benchmarks with LogUp* but not sure we tested the simplest LogUp solution for now)? ## Broader Implementation Questions Let's zoom out and consider the bigger picture. * **Packing Polynomials**: The leanVM design mentions "Jagged PCS" and "Simple Packing" to avoid committing to many separate AIR columns. How do these techniques relate to lookups? Are they complementary or competing? * **Unified Primitives**: Can we design a single, generic lookup/multiset check primitive that can be configured for Grand Product, LogUp, or LogUp* based on the use case? What would the API for such a primitive look like? * How can we best integrate these advanced lookup arguments into a modular proof system like Plonky3, ensuring both performance and developer-friendliness?

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully