mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #89] Missing documentation - heretic hardware requirements #43
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dagbdagb on GitHub (Dec 16, 2025).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/89
Hi.
2 things I struggle to figure out on my own:
gpt-oss-120b and its smaller sibling come with weights in mxfp4 format.
Can I use Ampere hardware (rtx 3090) to decensor gpt-oss-120b? Cuda arch 86, so no native support for mxfp4. Does that matter?
Also, what are the hard memory requirements for successfully decensoring gpt-oss-120b? Is there a trivial way to calculate that? I see #83 , but still fail to grasp if less memory just means the process takes longer, or if it will fail.
@accemlcc commented on GitHub (Dec 17, 2025):
hey
Hardware Requirements for GPT-OSS-120B (MXFP4)
Short answer: No, RTX 3090 won't work. You need Hopper GPUs (H100) or newer.
Why RTX 3090 doesn't work:
Anyways, it's already done and looks good:
https://huggingface.co/kldzj/gpt-oss-120b-heretic-v2
https://huggingface.co/bartowski/kldzj_gpt-oss-120b-heretic-v2-GGUF
@dagbdagb commented on GitHub (Dec 17, 2025):
The timestamp of those files suggest that they are missing a few fixes in heretic 1.1? Happy to be set straight if this is incorrect.
@accemlcc commented on GitHub (Dec 17, 2025):
Oops... you're right, they were made with the old version of Heretic. I was misled by V2, mea culpa.
@accemlcc commented on GitHub (Dec 17, 2025):
If you still want to try it yourself: you would need at least two H100s, PyTorch 2.8, the latest Triton version and my #60, which also circumvents the 3D tensor problem.
@dagbdagb commented on GitHub (Dec 17, 2025):
Might have to look into how to rent hardware and stuff. Unlikely to happen while the calendar still says 2025.
@dagbdagb commented on GitHub (Dec 19, 2025):
@accemlcc
At https://docs.unsloth.ai/models/gpt-oss-how-to-run-and-fine-tune , I find this little nugget:
"MXFP4 is not actually supported on Ampere and older GPUs, so Triton provides tl.dot_scaled for MXFP4 matrix multiplication. It upcasts the matrices to BF16 internaly on the fly."
Is this something which can be employed by heretic?
@accemlcc commented on GitHub (Dec 19, 2025):
For clarification: Tools like LM Studio use GGUF, which is highly optimized for split CPU/GPU inference.
Heretic uses native PyTorch/Transformers.
More importantly: Heretic doesn't just generate text; it extracts hidden states (residuals) from the model to calculate vectors. This requires significantly more VRAM bandwidth and capacity than simple chat inference.
So while you might get 5 t/s chatting in GGUF, running an optimization loop in PyTorch with residual extraction on a single 3090 will likely result in OOMs or extreme slowness due to PCIe bottlenecks.
@dagbdagb commented on GitHub (Dec 19, 2025):
Triton permits extending pytorch's 'native' features. And, in the case of unsloth, casting between MXFP4 and FP16 (and FP32) as required by the hardware at hand.
I do have multiple 3090s, but all connected either via TB3 or PCIe 4x. If system/GPU bandwidth is important for the performance of heretic, I accept it will be slow. Unlike for inferencing, where my setup regularly provides 110-120 t/s with an empty context. (gpt-oss-120b-UD-Q8_K_XL, all layers on GPU, potato PC)
So, is system/GPU bandwidth important for heretic? Moreso than compute performance or GPU memory bandwidth? Or would up/down-casting be a/the killer for performance?
What is the expected runtime for heretic with gpt-oss-120b with a single h200? Or, if 2 are required due to VRAM requirements, with two? Does performance scale somewhat linearly?
Despite being technically competent in many subjects, I find it hard to achieve anything but very superficial knowledge about LLMs/pytorch/transformer/triton. Too much stuff already out there, and the fire-hose runs at full blast with new stuff 24x7. I very much appreciate the patience exhibited explaining this.
@p-e-w
I suggest a little blurb is added to the default README about hardware requirements/suggestions and a guesstimate for approximate runtime.
@accemlcc commented on GitHub (Dec 19, 2025):
@dagbdagb
Okay, that context helps.
Regarding the Unsloth/Triton integration: That is a significant architectural decision at @p-e-w 's discretion. I will not be implementing it.
Regarding the H200: A full run should take less than 1 hour.
@p-e-w commented on GitHub (Dec 19, 2025):
Heretic uses Transformers to perform inference, so Heretic's hardware requirements are exactly the same as those for running the model with Transformers. I have no intention to add more details to the README regarding that, as that would replicate information that is already available all over the web and can be highly specific to individual setups.
That depends on the configuration (prompt datasets,
n_trials,max_response_lengthetc.). Heretic estimates remaining runtime during optimization, so you can just try it and it will tell you.@dagbdagb commented on GitHub (Dec 19, 2025):
Thank you. And thank you for heretic.
@dagbdagb commented on GitHub (Dec 22, 2025):
Happy to report that heretic 1.1 did the job on gpt-oss-20b with 4x RTX3090, despite the lack of hw-support for mxfp4.
Elapsed time: 2h 6m
Refusals: 24/100, KL divergence: 0.1771
Had to set
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True.Edit:
The saved safetensors weigh in at 39.0GB total (original: 11.9GB). I assume pytorch has converted the original mxfp4 to f16 on the fly, or something along that line.
@p-e-w commented on GitHub (Dec 28, 2025):
@dagbdagb
This is already set on startup:
github.com/p-e-w/heretic@02a5237a02/src/heretic/main.py (L122-L127)Are you sure that was necessary to set again manually? Because that would be a bug.
@dagbdagb commented on GitHub (Dec 28, 2025):
I am quite sure that was the only change I did between a failed run and a successful run, yes. Should your and be an or?
@p-e-w commented on GitHub (Dec 28, 2025):
No, it needs to be
and, because the latter name is deprecated but still supported, so if either of the names is present we should not override the user's choice.Are you using an older PyTorch version that doesn't support the new name yet?
@dagbdagb commented on GitHub (Dec 28, 2025):
Re-reading the code in question without having my mind on other things makes my question appear stupid. My bad.
Anyways, I check my command history. It looks like this:
381 heretic openai/gpt-oss-20b
382 heretic openai/gpt-oss-20b
383 export CUDA_VISIBLE_DEVICES=0,1,2,3
384 heretic openai/gpt-oss-20b
385 export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
386 heretic openai/gpt-oss-20b
redoing this sequence from 383:
384 yields:
386 powers through:
@dagbdagb commented on GitHub (Dec 28, 2025):
383 is necessary to elliminate my 6GB onboard RTX 3000 from being utilized.
@dagbdagb commented on GitHub (Dec 28, 2025):
I still see:
... on the last run. But heretic does not die later, as in the first run.
The installed pytorch version is 2.9.0.
heretic at
cf8cf6f349(Dec 22)@p-e-w commented on GitHub (Dec 29, 2025):
Do you maybe have that variable in your global environment already, preventing Heretic from setting it?
@dagbdagb commented on GitHub (Dec 29, 2025):
Fair question. No.