fix: teleported operators precision#200
Merged
Forpee merged 2 commits intofeat/sigmoidfrom Mar 16, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the numerical accuracy of neural-teleport “divided” activation operators by constructing activation LUTs as op(x * τ) and reciprocating the teleportation division during execution so the effective input is closer to the original value.
Changes:
- Update neural-teleport signed activation LUT materialization to evaluate activations at
(index * τ). - Thread
tauintoTanhTable/SigmoidTable/ErfTableconstruction on the proof side. - Update tracer implementations of
tanh/sigmoid/erfto multiply the teleported quotient back byτbefore evaluating the activation, and un-ignore related precision tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| jolt-atlas-core/src/onnx_proof/ops/tanh.rs | Passes tau into tanh LUT construction for proofs/verification. |
| jolt-atlas-core/src/onnx_proof/ops/sigmoid.rs | Passes tau into sigmoid LUT construction for proofs/verification. |
| jolt-atlas-core/src/onnx_proof/ops/erf.rs | Passes tau into erf LUT construction for proofs/verification. |
| jolt-atlas-core/src/onnx_proof/neural_teleport/utils.rs | Changes LUT materialization semantics to use (index * tau); extends LUT structs to store tau. |
| atlas-onnx-tracer/src/tensor/mod.rs | Adds scalar Tensor * scalar multiplication support used by teleport reciprocation. |
| atlas-onnx-tracer/src/ops/tanh.rs | Reciprocates teleportation (non-fused path) by multiplying by tau; re-enables precision test. |
| atlas-onnx-tracer/src/ops/sigmoid.rs | Reciprocates teleportation by multiplying by tau; re-enables precision test. |
| atlas-onnx-tracer/src/ops/erf.rs | Reciprocates teleportation by multiplying by tau; re-enables precision test. |
Comments suppressed due to low confidence (1)
atlas-onnx-tracer/src/ops/tanh.rs:22
- With
feature = "fused-ops"enabled, this implementation still computes tanh on the divided value (x/τ) via the LUT lookup, while the non-fused path now reciprocates teleportation (tanh(floor(x/τ)*τ)). This creates behavior/accuracy divergence between feature flags and undermines the PR’s stated precision fix; consider applying the same* τreciprocation before the LUT lookup (or regenerating the LUT to match the new semantics).
let input = tensor::ops::nonlinearities::const_div(inputs[0], self.tau as f64);
#[cfg(feature = "fused-ops")]
{
let scale_i = self.scale.0 as i64;
let lut = generate_tanh_lut(scale_i);
input
.par_enum_map(|_, a_i| {
Ok::<_, TensorError>(tanh_lut_lookup(a_i, scale_i as i32, &lut))
})
.unwrap()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
82
to
87
| #[derive(Debug, Clone, Copy, Default)] | ||
| pub struct $table { | ||
| log_table_size: usize, | ||
| tau: i32, | ||
| } | ||
|
|
Comment on lines
+1437
to
+1439
| /// let result = x.mul(2).unwrap(); | ||
| /// let expected = Tensor::<i32>::new(Some(&[4, 2, 4, 2, 2, 2]), &[2, 3]).unwrap(); /// assert_eq!(result, expected); | ||
| /// ``` |
Forpee
pushed a commit
that referenced
this pull request
Mar 17, 2026
* feat: Sigmoid operator * feat: add Qwen example file * fix: teleported operators precision (#200) * fix: teleported operators precision * chore: assert comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improves precision of teleported op by improving the way the corresponding lookup table is constructed.
Context
The main idea of teleported operators is to first reduce the domain of the input.
For divided operators, we are doing that by dividing the input by a constant τ.
We then lookup the divided input into a preconstructed table
LUT.Previous flow
Previously, the LUT was constructed as follow:
LUT[x] = intended_op(x).The issue was that, when taking into account the previous division, this lead us roughly to
f(x) = LUT[x/τ] = intended_op(x/τ), whereintended_op(x/τ) != intended_op(x).Proposed solution
We now "reciprocate" the teleportation, by computing the LUT the following way:
LUT[x] = intended_op(x * τ), allowing us to computef(x) = LUT[x/τ] = intended_op( (x/τ)*τ ), where(x/τ)*τroughly equalsτ, with an errore<τ.--
Closes #101