8 ms·
GPU-Accelerated LLM on an Orange Pi
- m00x 3y agoDoes the Mali GPU have shared RAM with the CPU on this device? Is this common for ARM devices?
- kvetching 3y agoI've been thinking of this. It's just fascinating to me to have a small device that you can converse with and knows almost everything. Perfect for preppers / survivalists. Store it in a faraday cage along with a solar generator.
- jacquesm 3y ago> knows almost everything It really doesn't. It doesn't even know what it knows and what it doesn't know. Without ways to check up on whether what it told you is true or not you may well end up in more trouble than where you were before.
- omneity 3y agoHow about a local wikipedia dump, with precalculated embeddings? Then you can perform a similarity search first and feed the results to the LLM. It’s less likely to hallucinate this way.
- jacquesm 3y agoThat would make a lot more sense. That way at least you have a chance to check up on the output, lest your first meal of 'Hedysarum alpinum' ends up being your last.
- bravura 3y agoThe key aspect to this being a good solution is actually building a corpus representing as much possible reference knowledge needed in scenario. The idea that the answer is Wikipedia way underestimates the scope. The Wikipedia patch doesn’t make much sense to me. What percent of the important questions being asked in this doomsday scenario actually have their answer in Wikipedia? If 50% of the time you are left trusting raw LLaMa, then you don’t really have a decent solution. I do appreciate the sentiment tho that future or finetuned LLMS might fit on an RPi or whatever, and be good enough.
- hnuser123456 3y agoI think the theory is that an LLM can integrate the knowledge of Wikipedia and become something greater than the sum of its parts by applying reasoning that is explained in one article to situations in other topics where the reasoning might not be so well explained. Then you can ask naive questions in new scenarios where you might not have the background knowledge (or simply the mental energy) to figure out a right answer to a situation on your own but it powers through for you. AFAIK current LLMs are not this abstract. If one type of reasoning is more often applied in one scenario and another type of reasoning is applied to another, they don't have any context beyond the words and they know what topics humans usually jump to from other given topics.
- yu3zhou4 3y agoIt would be great to see such project implemented, I wonder how good would it perform
- jacquesm 3y agoYes, especially having fact checked output of LLMs would be a nice step in the right direction. Throwing out the hallucinated bits and keeping the good stuff would make LLMs a lot more applicable.
- eis 3y agoIsn't that a bit of a holy grail though? If your software can fact check the output of LLMs and prevent hallucinations then why not use that as the AI to get the answers in the first place?
- jacquesm 3y agoBecause you - hopefully - have a check against something that is on average of higher quality than the combined input of an LLM. I'm not sure if this can work or not but it would be nice to see a trial, you could probably do this by hand if you wanted to by breaking up the answer from an LLM into factoids and then to check each of those individually, and to assign a score to them based on the amount of supporting evidence for the factoid. I'd love that as a plug-in to a browser too.
- regularfry 3y agohttps://arxiv.org/pdf/2308.04430.pdf https://arxiv.org/pdf/2308.04430.pdf is interesting from that point of view. They've tackled it from the perspective of avoiding copyright content in training, but including it in inference but I think it ought to mean less hallucination because they also (claim to) solve the attribution problem.
- jacquesm 3y agoNice one, thank you. Added to my 'read later today' list, the abstract looks very interesting.
- chank 3y agothis concept already exists and is in practice at many companies that require knowledge driven results. https://arxiv.org/abs/2005.11401 https://arxiv.org/abs/2005.11401
- regularfry 3y agoThere was another paper out recently that adds to this: https://arxiv.org/pdf/2308.04430.pdf https://arxiv.org/pdf/2308.04430.pdf. Looks like a more flexible approach to document storage, and it outperforms retrieval in context. They trained up their own LLM, but from the text it seems like it might be possible to use any LLaMA-style LM without retraining. Not sure though, need to give it a proper look.
- deleted 3y ago[deleted]
- mdp2021 3y ago> a local wikipedia dump There exists (at least) a project to train and query an LLM on local documents: privateGPT - https://github.com/imartinez/privateGPT https://github.com/imartinez/privateGPT It should provide links to the the source with the relevant content, to check the exact text: > You'll need to wait 20-30 seconds (depending on your machine) while the LLM model consumes the prompt and prepares the answer. Once done, it will print the answer and the 4 sources it used as context from your documents You will have noticed, in that first sentence, that it may not be practical, especially on an Orange Pi.
- yieldcrv 3y agoYes like a person
- mdp2021 3y agoWhat is the current state of "correspondence between fed text and output text"? I.e. how much, when fed in the training e.g. that "Spain invested 6000$ in Columbus' first voyage", LLMs will repeat that notion exactly? This, without taking into account reasoning and consistence. And already this notion that I picked randomly is not without issues: dollars how computed? And, it is not difficult to state that Columbus reached the Caribbeans in 1492; more complex to "decide" the year of the siege of Troy out of the many dates proposed. But already at the simplified level of determined clear notions: if LLMs are told that "A is B", and in absence of inconsistency in the training corpus, what is the failure rate (i.e. then outputting something critically different)? > ways to check up Some LLMs work as search engines, outputting not just their tentative answer but linked references. A reasonably safe practice at this stage is to use LLMs that way: ask then use the output to check the reference.
- asdgioanionio 3y agoDepending on an LLM for survival is a good way to end up dead. English Wikipedia will fit on an SD card. It's more valuable and more practical.
- unforeseen9991 3y ago"I am confident those red berries you are describing are perfectly fine to eat"
- beepbooptheory 3y agoThe energy use alone would probably rule this out for survival, no?
- jdfedgon 3y agoNice achievement. How many users would realistically be able to use it at the same time when running on such a device? I am interested in its scalability.
- jacquesm 3y agoThat's a tricky question. You're going to have to multiplex the use of the device, but since these are mostly 'ping-pong' style uses you can use something called a 'utilization factor' to figure out what a reasonable upper bound is where you still get an answer to your query in acceptable time. The typical mechanism is an input queue with a single worker to use the device. The cut-off is when the queue becomes unacceptably long, in which case you would have to throw an error or be content with waiting (possibly much) longer for your answer. This is usually capped by some hard limit on the length of the queue (for instance: available memory) or the fact that the queue fills up faster than that it can empty even over a complete daily cycle. Once that happens you need more hardware.
- dekhn 3y agoActually many inference systems instead batch all requests within a time period and submit them as a single shot. It increases the average latency but handles more requests per unit time. (at least, this is my understanding how production serving of expensive models that support batching work)
- jacquesm 3y agoI've done a bunch of optimization for GPU code (in CUDA) and there are typically a few bottle necks that really matter: - memory bandwidth - interconnect bandwidth between the CPU and GPU - interconnect bandwidth between GPUs - thermals and power if you're doing a good job of optimizing the rest I don't see how a batching mechanism would improve on any of those, superficially it looks as though that would make matters worse rather than better. Can you explain where the advantage comes from?
- 3y ago
- pjmlp 3y agoBest part is that they are using TVM.
- tysam_and 3y agoThis was the part that intrigued me. After years of silent begging to PyTorch to support ROCm, suddenly models in general supporting so many different platforms feels overwhelming, and really good. I'm crediting llama.cpp of all things for being the boost to really up the ante on open source model compilation. Whatever it is, at least, many of these open source things feel like they just 'happen', as an eventuality, but in order for that to happen it takes a lot of work from a lot of people! Really happy to see the dream of this particular kind of democratization opening widely! :)
- jan_Sate 3y agoOrange Pi 5 has an NPU. I wonder if it'd be any faster than using GPU.
- deleted 3y ago[deleted]
- adrian_b 3y agoIt might have been more work to convert the model for the RK3588 NPU, even if Rockchip provides an SDK and an automated conversion tool that should help (the SDK includes a simulator for the NPU, so the converted model can be tried on a PC before being deployed on a board like Orange Pi): https://wiki.t-firefly.com/en/ROC-RK3588S-PC/usage_npu.html https://wiki.t-firefly.com/en/ROC-RK3588S-PC/usage_npu.html
- brucethemoose2 3y agoIts not supported by TVM yet, but there is support for Qualcomm Hexagon. You can kinda see some of the supported backends gated behind flags in the cmake file: https://github.com/mlc-ai/relax/blob/mlc/CMakeLists.txt https://github.com/mlc-ai/relax/blob/mlc/CMakeLists.txt
- duchenne 3y agoHow many tokens per second do you think we can get out of this 6TFlops NPU?
- brucethemoose2 3y agoFor prompt ingestion... I dunno. Unbatched token generation is basically RAM bandwidth limited, as the entire model has to be cycled through for each token. I bet theoretical performance is similar to the GPU, albeit with much lower power consumption.
- villgax 3y agoI'm already getting 1.5tok on Ubuntu running on Android via UserLand w/ Llama.cpp(v2-Q4). Don't really see acceleration. If anything I need to see my phone do something actually useful at let's say 7-10toks
- regularfry 3y agoHuman speech is in the 2-4 tokens per second range, I think that's about where my frustration limit is.
- brucethemoose2 3y agomlc should already be pretty fast on Vulkan
- sunshine-o 3y agoI'm surprised we haven't seen dedicated boxes to self host your uncensored & private LLM yet. A bit like you can self host your apps at home on a Umbrel box. I wonder if the NVIDIA Jetson serie would be the hardware that makes the most sense?
- kkielhofner 3y agoI've been bamboozled by the Jetson series over at least three generations on a variety of platforms (TX1, Nano, AGX, Orin Nano). They have their "special place" for certain applications but the software is a mess (old driver and CUDA versions, Jetpack is still based on Ubuntu 20.04), the ARM cores are (very) weak relative to ARM flagships, and the performance/price ratio makes no sense unless you really need the form factor and energy efficiency. Oh yeah and the SD card storage is typically frustratingly slow and often unreliable. A $500 Jetson Nano devkit with 8GB of shared RAM has roughly 10% of the performance of even ancient cards like the GTX 1070 (8GB VRAM alone) that you can throw in a random used x86_64 tower or whatever for $300 all-in. For the extra couple of hundred dollars difference you can get a more recent GPU with higher compute capability, extra storage, more system RAM, whatever. Significantly higher power usage and larger form factor but with power optimization, scaling, etc this approach makes very little difference in practice for occasional inference workloads for "typical home use". I have this configuration idling (with models loaded) at 20 watts, scaling up to around 100-150w for however long given inference loads take to execute, and then scaling back down.
- thehumanmeat 3y agoSee tinybox https://tinygrad.org/ https://tinygrad.org/
- yunohn 3y ago15,000$…
- JimtheCoder 3y agoOrganization run by Geohot and no actual product delivered yet...
- raphaelj 3y agoAny idea how the GPU compares to the Nvidia's Jetson series?
- adrian_b 3y agoIt is difficult to find information about the performance of the ARM GPUs that can be compared with that of NVIDIA/AMD/Intel. However it seems that the Mali-G610 MC4 is in about the same range as the cheaper models of the old Jetson Xavier. The newer Jetson Orin models have much faster Ampere GPUs with between 1024 and 2048 FP32 ALUs. Nevertheless, the various Jetson Orin models have a price between 4 times and 13 times higher than a SBC with RK3588 and 16 GB DRAM (especially all the Orin models with more than 8 GB DRAM are very expensive) and the ratio between their prices is much greater than the ratio between their performances. Any small computer with AMD Phoenix offers a much better GPU performance per dollar than any NVIDIA Orin. The use of NVIDIA Orin is justified only when one needs a device that is qualified for an automotive environment.
- raphaelj 3y agoThanks for the answer. > Any small computer with AMD Phoenix offers a much better GPU performance per dollar than any NVIDIA Orin. > The use of NVIDIA Orin is justified only when one needs a device that is qualified for an automotive environment. Nvidia Orin will use significantly less energy though.
- adrian_b 3y ago> Nvidia Orin will use significantly less energy though. Not really. A Ryzen 7 7840U has a GPU with 768 FP32 ALUs @ 2.7 GHz and a NPU that can do 10 TOPS and it has a default TDP of 28 W. The top Jetson AGX Orin models consume up to 60 W or 75 W, but they are so expensive that it does not make sense to compare them with a computer with 7840U and 32 GB of LPDDR5x-7500 that costs 3 times less. A comparison that makes more sense is with a Jetson Orin NX 16GB (still significantly more expensive), which has a GPU with 1024 FP32 ALUs @ 0.918 GHz and it has a default TDP of 25 W. For graphics tasks, Jetson Orin NX would be several times slower than an AMD Phoenix, due to its low GPU clock frequency and much slower CPU cores. The same is true for any programs executed on the CPU cores. On the other hand, for AI inference, Jetson Orin has very fast tensor cores, so it can be many times faster than an AMD GPU or an ARM GPU, i.e. Jetson Orin NX 16 GB is claimed to be able to do 100 TOPS, so if this is the main intended application it can be worthwhile. Nevertheless, the usefulness of the Jetson Orin models for AI inference is diminished by the fact that their price increases very steeply when more memory is desired.
- alchemist1e9 3y agoIs it possible a pool of these running smaller sized models could somehow be cheaply combined into a MOE approach (as supposedly GPT-4 is) so create something cheap but higher quality?
- packetlost 3y agoI had to make a minor modification to the code to get the Rust compiler happy, just add a `.as_slice()` when the compilation fails. I'll submit a PR if it's not fixed already.
- junrushao1994 3y agoAh please help us by submitting a PR! I noticed the rust build failed last night but didn’t get a chance to look into it
- binarybana 3y agoAll PR's greatly appreciated! Is this on the Rust TVM bindings?
- billconan 3y agodoes mlc work for vision models? for example, the doc mentions --max-seq-len MAX_ALLOWED_SEQUENCE_LENGTH as a command line option. This seems to imply that it only accepts language models? Also, it doesn't seem to say anything about the input model's format? pytorch weights? onnx?
- gsuuon 3y agoYup, here's their web stable diffusion repo: https://github.com/mlc-ai/web-stable-diffusion https://github.com/mlc-ai/web-stable-diffusion The input is a model (weights + runtime lib) compiled via the mlc-llm project: https://mlc.ai/mlc-llm/docs/compilation/compile_models.html https://mlc.ai/mlc-llm/docs/compilation/compile_models.html