# Confusion about Mitiq folding for zero noise extrapolation

I'm reading the mitiq zero noise extrapolation documentation and I just can't make sense of how the scale_factor for folding work.

"The minimum scale factor is one (which corresponds to folding no gates). A scale factor of three corresponds to folding all gates locally. Scale factors beyond three begin to fold gates more than once."

I made a quick qiskit example for convenience:

import qiskit as q
from mitiq.zne.scaling import fold_gates_from_left

n_qubits = 4
circ = QuantumCircuit(n_qubits)

circ.h(0)
for qubit in range(n_qubits - 1):
circ.cx(qubit, qubit + 1)
circ.measure_all()
print(circ) folded = fold_gates_from_left(circ, scale_factor=2.)
print("Folded circuit:", folded, sep="\n") If the input circuit has d_in gates, after applying unitary folding, one gets a circuit of d_out >= d_in gates. The scale_factor (approximately) determines how much you want to scale d_out with respect to d_in. In other words, a subset of gates are folded such that d_out is approximately equal to scale_factor * d_in.
d_in = 4

and indeed d_out is equal to scale_factor * d_in.