---
title: "Comment by Deekshith Reddy on \"Speculative Decoding: From Theory to Implementation\" | Hashnode"
description: "Great article! Found a small bug, adjusted_probs = torch.clamp( target_probs - torch.softmax(all_logits[position], dim=0), min=0.0 ) it should be target_probs -"
url: "https://hashnode.com/posts/speculative-decoding/690b1ada1921d85b235d9b58/comment/6911704248e22e4d40ea1455"
---

[Discussion](https://hashnode.com/posts/speculative-decoding/690b1ada1921d85b235d9b58)

Comment [Speculative Decoding: From Theory to Implementation](https://hashnode.com/posts/speculative-decoding/690b1ada1921d85b235d9b58)

[Deekshith Reddy](https://hashnode.com/@birdman)

[Nov 10, 2025](https://hashnode.com/posts/speculative-decoding/690b1ada1921d85b235d9b58/comment/6911704248e22e4d40ea1455)

Great article! Found a small bug, adjusted\_probs = torch.clamp( target\_probs - torch.softmax(all\_logits\[position\], dim=0), min=0.0 ) it should be target\_probs - draft\_probs You're essentially doing target\_probs - target\_probs, which means we're sampling from your else case, which means we're sampling from the target\_probs but also in the rejected overlap space with draft model. If we do it correctly, we will be sampling from p'(t) which will be in the target\_space not overlapping with draft model's space.
