8 ms·
Show HN: Llama 3.1 70B on a single RTX 3090 via NVMe-to-GPU bypassing the CPU
Hi everyone, I'm kinda involved in some retrogaming and with some experiments I ran into the following question: "It would be possible to run transformer models bypassing the cpu/ram, connecting the gpu to the nvme?"
This is the result of that question itself and some weekend vibecoding (it has the linked library repository in the readme as well), it seems to work, even on consumer gpus, it should work better on professional ones tho
- randomtoast 7mo ago0.2 tok/s is fine for experimentation, but it is not interactive in any meaningful sense. For many use cases, a well-quantized 8B or 13B that stays resident will simply deliver a better latency-quality tradeoff
- tyfon 7mo agoI didn't really understand the performance table until I saw the top ones were 8B models. But 5 seconds / token is quite slow yeah. I guess this is for low ram machines? I'm pretty sure my 5950x with 128 gb ram can run this faster on the CPU with some layers / prefill on the 3060 gpu I have. I also see that they claim the process is compute bound at 2 seconds/token, but that doesn't seem correct with a 3090?
- tgrowazay 7mo agoLLM speed is roughly <memory_bandwidth> / <model_size> tok/s. DDR4 tops out about 27Gbs DDR5 can do around 40Gbs So for 70B model at 8 bit quant, you will get around 0.3-0.5 tokens per second using RAM alone.
- vlovich123 7mo agoFaster than the 0.2tok/s this approach manages
- someguy2026 7mo agoDRAM speeds is one thing, but you should also account for the data rate of the PCIe bus (and/or VRAM speed). But yes, holding it "lukewarm" in DRAM rather than on NVMe storage is obviously faster.
- tgrowazay 7mo agoYes. In general systems usually have PCIE version with bandwidth better than RAM of that system. For example a system with DDR4 (27Gbs) usually has at least PCIE4 (32Gbs at 16x). But you can bottleneck that by building a DDR5 (40Gbs) system with PCIE4 card.
- zozbot234 7mo agoShould be active param size, not model size.
- tgrowazay 7mo agoYes, you’re right. LLama 3.1 however is not MoE, so all params are active. For MoE it is tricky, because for each token you only use a subset of params (an “expert”) but you don’t know which one, so you have to keep them all in memory or wait until it loads from slower storage, potentially different for each token.
- uf00lme 7mo agoChannels matter a lot, quad channel ddr4 is going to beat ddr5 in dual channel most of the time.
- wtallis 7mo agoFour channels of DDR4-3200 vs two channels of DDR5-6400 (four subchannels) should come out pretty close. I don't see any reason why the DDR4 configuration would be consistently faster; you might have more bank groups on DDR4, but I'm not sure that would outweigh other factors like the topology and bandwidth of the interconnects between the memory controller and the CPU cores.
- xaskasdf 7mo agoyeah, actually, I'm bottlenecked af since my mobo got pcie3 only :(
- Wuzado 7mo agoI can imagine a couple scenarios in which a high-quality, large model would be much preferred over lower latency models, primarily when you need the quality.
- xaskasdf 7mo agoyeah, actually I wanted to see if this was possible at all. I managed to get around 3000 tokens/s on a ps2 with classic transformers, since the emotion engine is capable of 32 bit addresses, but it has like 32gb of ram. So I ran into the question of why was that fast and I couldn't get that speed even with small models, and the deal is that the instructions went right of the memory to the gpu and that's the main difference that does when a regular computer does inference: it has to request the instructions to the cpu every time. As I mentioned too, on professional cards you can avoid these problems naturally, since they got instructions precisely for this, but sadly I don't have 30k bucks to spare on a gpu :(
- derstander 7mo ago*32MB of RAM (plus 4MB of video RAM and a little sound and IOP memory).
- anoncow 7mo ago3000 tokens per sec on 32 mb Ram?
- fc417fc802 7mo agofast != practical You can get lots of tokens per second on the CPU if the entire network fits in L1 cache. Unfortunately the sub 64 kiB model segment isn't looking so hot. But actually ... 3000? Did GP misplace one or two zeros there?
- xaskasdf 7mo agoI wondered the same, but the rendering seems right, the output was almost instant. I'll recheck the token counter; anyway as you say, fast isn't practical. Actually I had to develop my own tiny model https://huggingface.co/xaskasdf/brandon-tiny-10m-instruct https://huggingface.co/xaskasdf/brandon-tiny-10m-instruct to fit something "usable", and it's basically a liar or disinformation machine haha
- eleventyseven 7mo ago
- fluoridation 7mo agoThat's slower than just running it off CPU+GPU. I can easily hit 1.5 tokens/s on a 7950X+3090 and a 20480-token context.
- throwaway2027 7mo agoDidn't DirectX add an API for loading assets directly to GPU memory? Would that work?
- someguy2026 7mo agoMy impression is that that is limited to assets and really needs to fit into the DirectX framework. From what I can tell, the gpu-nvme-direct is mostly similar to https://github.com/enfiskutensykkel/ssd-gpu-dma https://github.com/enfiskutensykkel/ssd-gpu-dma and https://github.com/ZaidQureshi/bam https://github.com/ZaidQureshi/bam
- xaskasdf 7mo agoActually this idea was fueled by those since I went to check if there was anything near to what I wanted to achieve, pretty useful tho
- jonassm 7mo agonvmlib/ssd-gpu-dma and BaM (based on the same code base) are pretty cool as they allow you to initiate disk reads/writes directly from a CUDA kernel (so not only reading/writing directly to GPU memory but also allowing the GPU to initiate IO on its own). Sometimes called GPU-initiated I/O or accelerator-initiated I/O.
- jauntywundrkind 7mo agoCould be neat to see what giving the 8b like 6gb ram instead of 10gb. Something in-between, where you still need NVMe, but not like the 3x ratio of the 70b model on 23GB. Nice work. PCI-P2P (GPU-Direct (tm)) is such great stuff. Cool to see!
- rl3 7mo agoNice. I've been looking at doing something similar, more on the order of running a 1T model with less than half the available VRAM. One workup indicated it was theoretically possible to modify a piece of SGLang's routing layer to support JIT predict-ahead expert swaps from Gen5 NVMe storage straight into GPU memory. I'm hoping that proves true. The setup relies on NVIDIA Dynamo, so NIXL primitives are available to support that. Curious if anyone's tried this already.
- xaskasdf 7mo agoThat would be nice to see. Actually I was thinking about getting another 3090 and a mobo upgrade since I'm bottlenecked by pcie3 to tryna run glm 4.7 or 5 at q4_k_m, it should be possible.
- Wuzado 7mo agoI wonder - could this be used for multi-tier MoE? Eg. active + most used in VRAM, often used in RAM and less used in NVMe?
- rao-v 7mo agoYeah I’ve often wondered why folks aren’t training two tier MoEs for VRAM + RAM. We already have designs for shared experts so it cannot be hard to implement a router that allocated 10x or 100x as often to “core” experts vs the “nice to have” experts. I suppose balancing during training is tricky but some sort of custom loss on the router layers should work. I’ve also wondered why the routers aren’t training to be serially consistent so you can predict layers to swap into VRAM a few layers ahead to maximize available bandwidth.
- hedgehog 7mo agoI don't have links handy but there is active research in this area.
- rao-v 7mo agoI'd love any keywords to search for to find active research on this topic!
- hedgehog 7mo agoMost of the work I'm aware of starts from the perspective of optimizing inference but the implication that pushing the lessons upstream gets mentioned here and there. Not All Models Suit Expert Offloading: On Local Routing Consistency of Mixture-of-Expert Models (https://arxiv.org/abs/2505.16056 https://arxiv.org/abs/2505.16056) Breaking the MoE LLM Trilemma: Dynamic Expert Clustering with Structured Compression (https://arxiv.org/abs/2510.02345 https://arxiv.org/abs/2510.02345)
- svnt 7mo agoMaybe I am misunderstanding something but: 1) This is basically the intention of several recent MoE models: keep particular generally useful experts hot in VRAM. 2) Unless you can swap layers in faster than you consume them there is no point to predicting layers (what does this even really mean? did you mean predicting experts?). It seems at the moment the best you can do is keep experts and layers more likely to be used for a given query in VRAM and offload the rest, but this is work-dependent.
- exabrial 7mo agoI feel like we need an entirely new type of silicon for LLMs. Something completely focused on bandwidth and storage probably at the sacrifice of raw computation power.
- deleted 7mo ago[deleted]
- garethsprice 7mo agoSomething like this? (Llama 3.1-8B etched into custom silicon delivering 16,000 tok/s, doesn't use much PCIe bandwidth): - https://taalas.com/the-path-to-ubiquitous-ai/ https://taalas.com/the-path-to-ubiquitous-ai/ - https://chatjimmy.ai/ https://chatjimmy.ai/
- exabrial 7mo agoWowsa that’s amazing! Exactly what I was imagining. To do that with 2500 watts is incredible.
- jacquesm 7mo agoThis is an interesting area for experiments. I suspect that in the longer term model optimization (knowing which bits you can leave out without affecting the functioning of the model) will become the dominant area of research just like it did with compression algorithms because effectively a model is a lossy compression scheme. And that's good because that increases democratization of AI away from the silos that are being created.
- serendip-ml 7mo agoThe compression analogy is interesting. Another way of looking at it could be fine-tuning as "knowing what to leave out" - a 3B model for example tuned for a narrow task doesn't need the capacity that makes 70B good at many things.
- 01100011 7mo agoYeah, GPUdirect should allow you to dma straight to a storage device. I wonder... what if the m.2 storage was actually DRAM? You probably don't need persistence for spilling a model off the GPU. How would it fare vs just adding more host memory? The m.2 ram would be less flexible, but would keep the system ram free for the CPU.
- javchz 7mo agoYeah a ramdisk would probably work wonders. It's a shame Intel optane didn't became a standard, those type of workflows would be amazing for it.
- TechSquidTV 7mo agoAhhh damn it. Intel! Come back!
- deleted 7mo ago[deleted]
- xaskasdf 7mo agoYa know, here on the local market there are a bunch of optanes hanging around, I'll try to manage one to check if there's any improvement
- ElectricalUnion 7mo ago
- umairnadeem123 7mo ago[dead]
- esquire_900 7mo agoCost wise it does not seem very effective. .5 token / sec (the optimized one) is 3600 tokens an hour, which costs about 200-300 watts for an active 3090+system. Running 3600 tokens on open router @.4$ for llama 3.1 (3.3 costs less), is about $0,00144. That money buys you about 2-3 watts (in the Netherlands). Great achievement for privacy inference nonetheless.
- Aerroon 7mo agoSomething to consider is that input tokens have a cost too. They are typically processed much faster than output tokens. If you have long conversations then input tokens will end up being a significant part of the cost. It probably won't matter much here though.
- teo_zero 7mo agoI think we use different units. In my system there are 3600 seconds per hour, and watts measure power.
- IsTom 7mo agoOP probably means watt-hours.
- dotancohen 7mo agoAnd 0.5 tokens/s should work out to 1800 tokens at the end of the hour. Not 3600 as stated.
- thatwasunusual 7mo ago> Cost wise it does not seem very effective. Why is this so damn important? Isn't it more important to end up with the best result? I (in Norway) use a homelab with Ollama to generate a report every morning. It's slow, but it runs between 5-6 am, energy prices are at a low, and it doesn't matter if it takes 5 or 50 minutes.
- turingsroot 7mo ago[flagged]
- Aurornis 7mo ago> No cuBLAS means they wrote their own GEMM kernels, which is a massive undertaking Not to diminish the impressiveness of this overall project, but it says right up front that these were vibe coded and the Opus 4.6 co-author lines are right in the commit messages. Those pieces were adapted from existing work via LLM, which is exactly the right use in a proof of concept project like this.
- snovv_crash 7mo agoPlease don't use LLMs to post on HN...
- civicsquid 7mo agoReally cool. I'm wondering: what background did you need to be able to think of the question that resulted in this project? I know you said you're involved in some retrogaming and were experimenting, but as someone who works in a world where hardware is pretty heavily abstracted away, even if I got into retrogaming I don't know that I'd consider that there may be a systems improvement lying around. Beyond the creative aspect, it feels like there is some systems and hardware background that helped put the idea together (and I'd be interested to go learn about of that systems/hardware knowledge myself).
- rustyhancock 7mo agoI wonder too, DMA plays a huge role in most older gaming consoles when the CPUs were far more sluggish. Perhaps that's what made them think to try. Perhaps the current batch of smart memory cards which on the PS2 I believe have quite complex DMA capabilities to stream from the SD card game data.
- charcircuit 7mo agoWhy not the PS5? That's when games started streaming assets straight from the NVME SSD to the GPU. In this case the assets are weights.
- xaskasdf 7mo agoActually I'm thinking about buyin an AMD BC-250 that's bassically a ps5 with pcie factor format; and it's linux capable by default, maybe next month
- rustyhancock 7mo agoJust because he mentioned retro gaming. Otherwise DMA is everywhere. In the PS5 case since it uses unified memory it's not quite the same as say an GBA streamed from a flash cart to video RAM.
- xaskasdf 7mo agoThis was the experiment itself https://github.com/xaskasdf/ps2-llm https://github.com/xaskasdf/ps2-llm The idea was basically to run a llm on a ps2, then I ran into some problems as the 32mb ram cap with 4mb vram cap; so I had to figure out a way to stream layers on the forward pass. Given that ps2 manages to give instructions directly to the vram that's capable of 32bit addresses, it gave an insane amount of tok/s, then I wondered if I could do the same on my puter
- Aurornis 7mo agoCool project. Can you provide more details about your DKMS patching process for consumer GPUs? This would be fun to try out, but I’d need some more details on that patch process first.
- Maxious 7mo agothe nvidia open source driver has been modded previously to unlock enterprise paywalled features like p2p gpu comms https://blog.chlc.cc/p/rtx4090-p2p-unlocked https://blog.chlc.cc/p/rtx4090-p2p-unlocked and vGPU splitting https://open-iov.org/index.php/VGPU_Unlock https://open-iov.org/index.php/VGPU_Unlock
- xaskasdf 7mo agoI updated the documentation to provide more info for the patching process, I added the patches themselves too and provided some risk info about the patches
- dhjjdjjjd 7mo ago[flagged]
- timzaman 7mo agoUmm sorry but the cpu can easily keep up shuttling around to/from your nvme. Especially ancient gen3 pcie. Not sure why ud do this.
- xaskasdf 7mo agoDid you even read anything? hahaha
- sylware 7mo agoIsn't that linux DMA buf?
- spwa4 7mo agoI've often wondered doing this with extreme compression. What if you did extreme compression + decompression on the GPU? Because you're leaving a lot of compute unused.
- xaskasdf 7mo agoI did it, but with different quantization compressions, It ran into quality issues, I will try to rerun with the same quants if that fixes the issue, but the most that looks unused, its being used by rotating layers that are being swapped by the cpu from the ram itself, that manages to keep layers warm, ready to use while inferencing and discarding already used ones
- nathan_compton 7mo agoI'm not sure, but I suspect that LLM weights don't compress all that well. The intuition here is that training an LLM is compression of the training data into the weights, so they are probably very information dense already. Can't squeeze them down much.
- spwa4 7mo agoI've found this to often be untrue when optimizing on the CPU. I wish someone would pay me to dive deep into this problem and the scheduling problem. I'd be amazed if I can't squeeze out a 50% speed increase on both problems.
- MarcLore 7mo ago[dead]
- xaskasdf 7mo agoI got an m3, I will test it on metal and check how it goes
- fabifabulous 7mo agoNVMEs are much, much slower than RAM. Especially unified/soldered RAM.
- lmeyerov 7mo agoBandwidth-wise, it's fun when you have a storage array instead of just 1 nvme. Then you can saturate the pcies, and go beyond what's cost effective on ram. Interesting to think of this as opening the door to 10-100T MoEs..
- placatedmayhem 7mo agoWasn't there a storage device some Years ago (decade plus) that was RAM strapped to a PCI-E card with the electronics to present the RAM as a storage device?
- 3abiton 7mo agoTo be fair, llama.cpp had this feature for over a year now. It just applies to GGUF.
- deleted 7mo ago[deleted]
- YetAnotherNick 7mo agoNo it is not. CPU and GPU overhead is close to 0 anyways if you are loading weights at 10GB/s.
- stuaxo 7mo agoInteresting. Can AMD GPUs do direct io like this?
- 7777777phil 7mo agoCool hack but 0.5 tok/s on 70B when a 7B does 30+ on the same card. NVIDIA's own research says 40-70% of agentic tasks could run on sub-10B models and the quality gap has closed fast.
- valianteffort 7mo ago[flagged]
- tclancy 7mo agoCan we not? Make a valiant effort to rephrase.
- davideom0414 7mo agoReally interesting experiment i should have done this before Do you have numbers on effective throughput vs PCIe theoretical bandwidth? I’m curious whether this is primarily latency-bound or bandwidth-bound in practice Can some tell me??
- xaskasdf 7mo agoActually is purely bandwidth-bound, the major bottleneck of the whole process, for me in this case, is the B450 mobo I got that's only capable of pcie3 and 1x8 in the pcie lanes for gpu instead of 1x16; so I'm capped until I get an X570 maybe. I should get around twice or triple the tok speed with that upgrade alone
- builderhq_io 7mo ago[flagged]
- ai_hack3r 7mo ago[dead]
- johnbarron 7mo ago[dead]