LoRA Forward Pass

~12 mincode completion

Implement lora_forward(W0, A, B, alpha, x) returning as an array of shape .

Where this shows up

~12 min

8 employers weight this skill

4 frontier labs, 3 AI product companies, 1 enterprise vendor. Top match scores 81.

Python
import numpy as np


def lora_forward(W0, A, B, alpha, x):
    """
    Output of a LoRA-adapted linear layer.

    Args:
        W0:    frozen weight, shape (d, k)
        A:     down-projection, shape (r, k)
        B:     up-projection, shape (d, r)
        alpha: LoRA scaling constant
        x:     input vector, shape (k,)

    Returns:
        array of shape (d,): W0 x + (alpha / r) B A x
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.