10 ms·
Show HN: I've built a locally running Perplexity clone
The video demo runs a 7b Model on a normal gaming GPU. I think it already works quite well (accounting for the limited hardware power). :)
- frantic2821 3y agodon't stop working on this!!
- keyle 3y agoImpressive, I don't think I've seen a local model call upon specialised modules yet (although I can't keep up with everything going on). I too use local 7b open-hermes and it's really good.
- nilsherzig 3y agoThanks :). It's just a lot of prompting and string parsing. There are models like "Hermes-2-Pro-Mistral" (the one from the video) which are trained to work with function signatures and outputting structured text. But at the end it's just strings in > strings out, haha. But its fun (and sometimes frustrating) to use LLMs for flow control (conditions, loops...) inside your programs.
- madacol 3y agoHave you considered using grammar sampling?
- keyle 3y agoWow, I didn't know about "Hermes 2 Pro - Mistral 7B", cheers!
- nilsherzig 3y agoIt's my go to "structured text model" atm. Try "starling-ml-beta" (7b) for some very impressive chat capabilities. I honestly think that it outperforms GPT3 half the time.
- peter_l_downs 3y agoSorry to repeat the same question I just asked the other commenter in this thread, but could you link the model page and recommend a specific level of quantization for the models you've referenced? I'd love to play with these models and see what you're talking about.
- BOOSTERHIDROGEN 3y agoIt's from nous research https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B Q5 is minimum.
- peter_l_downs 3y agoThank you — from that page, at the bottom, I was able to find this link to what I think are the quantized versions https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF/tree/main https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-... If you have the time, could you explain what you mean by "Q5 is minimum"? Did you determine that by trying the different models and finding this one is best, or did someone else do that evaluation, or is that just generally accepted knowledge? Sorry, I find this whole ecosystem quite confusing still, but I'm very new and that's not your problem.
- BOOSTERHIDROGEN 3y agoIt's the best balance if you have limited compute performance.
- peter_l_downs 3y agoThank you
- d-z-m 3y agoTalking GGUF, Usually the higher you can afford to go wrt. quantization(e.g. Q5 is better than Q4, etc), the better. A Q6_K has minimal performance loss from the Q8, so in most cases if you can fit a Q6_K it's recommended to just use that. TheBloke's READMEs[0] usually have a good table summarizing each quantization level. If you're RAM constrained, you'll also have to make trade-offs about the context length. e.g. you could have 8 GB RAM and a Q5 quant with shorter context, vs Q3 with longer, etc. [0]:https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF
- davidcollantes 3y agoGot a link for that one? I have found a few with Hermes-2-Mistral in the name.
- deleted 3y ago[deleted]
- viksit 3y agocurious what hardware you use? and is any of this runnable on an m1 laptop?
- keyle 3y agoAbsolutely, 7B will run comfortably on 16GB of RAM and most consumer level hardware. Some of the 40B run on 32GB, but it depends on the model I found (GGUF, crossing fingers help). I ran this originally on a M1 with 32GB, I run this on an Air M2 with 16GB (and mac mini M2 32GB), no problem. I use llama.cpp with a SwiftUI interface (my own), all native, no scripts python/js/web. 7b is obviously less capable but the instant response makes it worth exploring. It's very useful as a Google search replacement that is instantly more valuable, for general questions, than dealing with the hellscape of blog spam ruling Google atm. Note, for my complex code queries at $dayjob where time is of the essence, I still use GPT4 plus, which is still unmatched imho, without running special hardware at least.
- regularfry 3y agoI've been occasionally using a 7b Q4 quant on llama.cpp on an 8GB M1. It's usable, if not amazing.
- nilsherzig 3y agoDepends on your m1 specs, but should definitely be able to run a 7b model (at least with some quantization).
- peter_l_downs 3y agoI'm just starting to get into downloading and testing models using llama.cpp and I'm curious which model you're actually using, since they seem to come in varying levels of quantization. Is this [0] the model page for the one you're using, or should I be looking somewhere else? What is the actual file name of the model you're using? [0] https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GG...
- windexh8er 3y agoHave you looked into tools like CrewAI [0]? [0] https://www.crewai.io/ https://www.crewai.io/
- nilsherzig 3y agoHappy to answer any questions and open for suggestions :) It's basically a LLMs with access to a search engine and the ability to query a vector db. The top n results from each search query (initialized by the LLM) will be scraped, split into little chunks and saved to the vector db. The LLM can then query this vector db to get the relevant chunks. This obviously isn't as comprehensive as having a 128k context LLM just summarize everything, but at least on local hardware it's a lot faster and way more resource friendly. The demo on GitHub runs on a normal consumer GPU (amd rx 6700xt) with 12gb vRAM.
- koeng 3y agoWhat is the search engine that it uses?
- nilsherzig 3y agosearxng, which is a locally running meta search engine combining a lot of different sources (including Google and co)
- mmahemoff 3y agoThis might be more of a searxng question, but doesn't it quickly run up against anti-bot measures? CAPTCHA challenges and Forbidden responses? I can see the manual has some support for dealing with CAPTCHA [1], but in practical terms, I would guess a tool like this can't be used extensively all day long. I'm wondering if there's a search API that would make the backend seamless for something like this. 1. https://docs.searxng.org/admin/answer-captcha.html https://docs.searxng.org/admin/answer-captcha.html
- visarga 3y agoAs a last resort we could have AI work on top of a real web browser and solving captchas as well. Should look like normal usage. I think these kinds of systems LLM + RAG + Web Agent will become widespread and the preferred method to interact with the web. We can escape all ads and dark UI patterns by delegating this task to AI agents. We could have it collect our feeds, filter, rank and summarize them to our preferences, not theirs. I think every web browser, operating system and mobile device will come equipped with its own LLM agent. The development of AI screen agents will probably get a big boost from training on millions of screen capture videos with commentary on YouTube. They will become a major point of competition on features. Not just browser, but also OS, device and even the chips inside are going to be tailored for AI agents running locally.
- fnetisma 3y agoThis is really neat! I have questions: “Needs tool usage” and “found the answer” blocks in your infra, how are these decisions made? Looking at the demo, it takes a little time to return results, from the search, vector storage and vector db retrieval, which step takes the most time?
- nilsherzig 3y agoThanks :) Die LLM makes these decisions on its own. If it writes a message which contains a tool call (Action: Web search Action Input: weight of a llama) the matching function will be executed and the response returned to the LLM. It's basically chatting with the tool. You can toggle the log viewer on the top right, to get more detail on what it's doing and what is taking time. Timing depends on multiple things: - the size of the top n articles (generating embeddings for them takes some time) - the amount of matching vector DB responses (reading them takes some time)
- dcreater 3y ago> Die LLM You mean the? The German is bleeding through haha
- bobby_the_whale 3y ago[dead]
- rzzzt 3y agoWolfenstein 3D did it first! And then The Simpsons as well.
- pants2 3y agoIt says it's a "locally running search engine" - but not sure how it finds the sites and pages to index in the first place?
- nilsherzig 3y agoYea I guess that's misleading, I should probably change that. I was referring to the LLM part as locally running. Indexing is still done by the big guys and queried using searxng
- nilsherzig 3y agoJust to clarify, it wasn't my intention to be misleading
- lavela 3y agoWhat would be your current recommendation on how to create a vector db from local files that would work with LLocalSearch?
- pcthrowaway 3y agoNow if someone can hook this into Plandex (also shared today - https://news.ycombinator.com/item?id=39918500 https://news.ycombinator.com/item?id=39918500) to make a tool that enables you to collaborate with AI without any of your code leaving your computer, that would be amazing!
- ldjkfkdsjnv 3y agoThe big secret about perplexity is they havent done much beyond using off the shelf models
- KuriousCat 3y agoHow did they secure funds in that case?
- basbuller 3y agoThat is probably exactly why they got funding. You can sell it as focus on adding new features and leveraging the best available tools before reinventing the wheel. They do train their own models now, but for about a year they just forwarded calls to models like gpt3.5T. You still have the option to use models not trained by perplexity.
- hackernewds 3y agowhich is why their engagement and model responses suck. the other competitors are far better C.ai and Pi comes to mind
- basbuller 3y agoWait, are you directly comparing Perplexity and C.ai or Pi? Perplexity is a search engine, Pi is a chatbot, and C.ai is roleplay? Their value propositions are very different
- KuriousCat 3y agoI still don't get it. What was the USP here? What is the allure in it for the investors?
- bobby_the_whale 3y ago[dead]
- 3y ago
- xydac 3y agoThis is cool, haven't run this yet but seems really promising. Am thinking how this can be a super useful to hook with internal corporate search engines and then get answers from that. Good to see more of these non API key products being built (connected to local llms)
- nilsherzig 3y agoI might try to hook this into our internal confluence, shouldn't be a problem
- XCSme 3y agoCan you integrate this type of search in Ollama?
- darby_eight 3y agoPerplexity seems to be a chatbot competitor.
- hackernewds 3y agowhat does this have to do with Perplexity? it should reference the underlying models used instead
- vishnumohandas 3y agoThe UX is comparable.
- smcleod 3y agoUI does show and let you select the underlying model
- firtoz 3y agoExcellent work! I plan to use it with existing LLMs tbh, but great to see it working locally also! Thank you so much for sharing. I love the architecture.
- hubraumhugo 3y agoExcellent work! Cool side projects like that will eventually help you get hired by a top startup or may even lead to building your own. I can only encourage other makers to post their projects on HN and put them out into the world.
- nilsherzig 3y agoYea it's also quite fulfilling to see people likening something you've put some work into :)
- ml-anon 3y agoDid you really make a perplexity clone if you didn’t spend more time promoting yourself on Twitter and LinkedIn than on the engineering?
- nilsherzig 3y agoAh damn I forgot about getting some VC money
- ProllyInfamous 3y agoThis demo will land you more important things than "just" VC money. Extremely impressive, cannot wait to actually implement this on my M2Pro (mac).
- arflikedog 3y agoA while back you commented on my personal project Airdraw which I really appreciated. This looks awesome and you're well on your way to another banger project - looking forward to toying around with this :)
- nilsherzig 3y agoUhh yes I was really impressed by your project :)
- gardenhedge 3y agoDid you just happened to see this post today and notice the username?
- arflikedog 3y agounironically yes, I used comments to hot fix a bunch of stuff when I first launched. It's a small world and I thought this was a cool moment
- noisy_boy 3y agoWould be good if the readme mentions minimum hardware specs to get a reasonably decent performance. E.g. I have a ThinkPad X1 extreme i7 with MaxQ graphics, any hopes of running this on it without completely ruining the performance?
- nilsherzig 3y agoYou could run the LLM using your CPU and normal (non video) ram. But that's a lot slower. There are people working on making it a lot faster tho. The bottleneck is the transfer speed between the ram Sticks and the CPU. Just taking a guess, but I wouldn't expect more than a couple tokens (more or less like syllables) per second. Which is probably to slow, since it has to read a couple thousand per search result. It's hard to provide minimum requirements, since there are so many edge cases.
- oysterpingu 3y agoAwesome project! As I newbie myself in everything LLM, where should I start looking to create a similar project than yours? Which resources/projects are good to know about? Thank you for sharing!
- nilsherzig 3y agoI think the easiest entry point would be the python langchain project? It has a lot more documentation and working examples than the golang one I've used :) If you could tell me more about your goals, I can probably provide a more narrow answer :)
- nilsherzig 3y agoUhh sorry guys, I was asleep and now the project has like 1k stars haha I will try my best to catch up with everyone <3
- nikolayasdf123 3y agocool to see Go here
- nilsherzig 3y agolangchain go (missed opportunity to call it golang-chain) is nice, but has literally no docs haha
- nilsherzig 3y agobtw ollama (the webserver around llamacpp) is also written in golang :)
- adr1an 3y agoThis is so cool! And the fact that you can use Ollama as 'llm backend' makes it sustainable. didn't see how to switch models in the demo, that might be worth to highlight in readme..
- adr1an 3y agoI have a 'feature request', can we manage which sites are being used by some categories in the frontend? For example, if I build a list of websites and out them under "coding", then I'd like to use those to answer my programming questions. Meanwhile, I'd like to add an "art" category for museum's homepages so that I can ask which year was XYZ painting from. And so on. The current implementation looks like the inter-operability with searing is more static... IDK if searxng has an API to switch those filters or if they can be managed already through 'profiles'.. that kind of thing..
- gorbypark 3y agoI if a quick poke through the source and it seems like there’s not much reason this couldn’t run on macOS? It seems that ollama is doing the inference and then there’s a go binary doing everything else? I might give it a go and see what happens!
- nilsherzig 3y agosure there are people in the issues how got it working on macos. docker networking was the only problem :)
- mritchie712 3y agoI have it running on my Mac right now, took < 2 minutes (had to manually download one of the ollama models)
- siborg 3y agoExciting project. Trying to install it but running into some issues with searxng. Anyone else?
- nilsherzig 3y agoplease tell me about the problem or open an issue :)
- wg0 3y agoIn five year's time - by 2030, I foresee that lots of inference would be happening on local machines with models being downloaded on demand. Think docker registry of AI models which is pretty much Hugging Face already there. This all would be due to optimisations within model inference code and techniques, hardware and packaging of software like the above. Don't see billion dollar valuations for lots of AI startups out there to materialise into anything.
- openquery 3y ago> I foresee that lots of inference would be happening on local machines with models being downloaded on demand Why? It's much more efficient to have centralized special purpose hardware to run enormous models and then ship the comparatively small result over the internet. By analogy, you don't have a search engine running on your phone right?
- vachina 3y agoA more appropriate analogy would be driving your own car vs. taking the bus.
- bufferoverflow 3y agoNo, a more appropriate analogy would be driving your own billion-dollar super-yacht vs driving your own car. Will not happen any time soon. Consumer hardware can't even run GPT-4 locally, and won't be able for a looong time. Each GPT-4 instance runs on 8 A100. The cost of such system is ~$81K. Not even in the ballpark of what most consumers can afford.
- Sammi 3y agoYou currently can't have a search engine running locally on your phone. Google search is possible the single largest c++ program every built. And nevermind the storage needs... But in a few years we might be able to have LLMs running on our phones that work just as well if not better. Of couse as you mention the LLMs running on large servers might still be much more powerfull, but the local ones might be powerfull enough.
- BrutalCoding 3y agoThat’s a great project you pulled off. From the time I starred it (10-12h ago I think), and upon re-checking this post, you gained 500+ stars lol. Visualized in a chart with star-history: https://star-history.com/#nilsherzig/LLocalSearch https://star-history.com/#nilsherzig/LLocalSearch
- nilsherzig 3y agohaha thanks for the chart link. i woke up with 1k more than it had yesterday, im kinda stressed out
- sroussey 3y agoAh, that’s a nice chart generator. Will have to use if I ever get any, lol.
- gardenhedge 3y agoCompletely locally running search engine.. that queries the Internet
- sebzim4500 3y agoWhenever I see these projects I always find reading the prompts fascinating. > Useful for searching through added files and websites. Search for keywords in the text not whole questions, avoid relative words like "yesterday" think about what could be in the text. > The input to this tool will be run against a vector db. The top results will be returned as json. Presumably each clarification is an attempt to fix a bug experienced by the developer, except the fix is in English not in Go.
- nilsherzig 3y agohaha yea pretty much, its amazing (and frustrating) how much of the programs "performance" depends on these prompts
- htrp 3y agoOur current state of the art also love your last commit >fix: copilot is stupid and i should not blindly trust it >https://github.com/nilsherzig/LLocalSearch/commit/9f45e24f152de6afa915e2f335b5940c77fdb117 https://github.com/nilsherzig/LLocalSearch/commit/9f45e24f15... Everything wrong with code gen in a nutshell
- nilsherzig 3y agoYea im kinda stressed out to get it working for everyone haha. I would have caught that under different conditions. I'm a big e2e tests guy haha
- bobby_the_whal 3y ago[flagged]
- andrewfromx 3y agosearXNGDomain := os.Getenv("SEARXNG_DOMAIN") I see this but what search engine lets you get results in json for free?
- andrewfromx 3y agoohh "https://duckduckgo.com/?q=andrew&format=json https://duckduckgo.com/?q=andrew&format=json" nice!
- nilsherzig 3y agoThose arent search results tho, that's just duckduckgo internal things like "similar queries"
- andrewfromx 3y agooh they must be hitting their own internal api with format=json but what is the datasource?
- andrewfromx 3y agohttps://news.ycombinator.com/item?id=39925003 https://news.ycombinator.com/item?id=39925003 ahhh https://github.com/searxng/searxng https://github.com/searxng/searxng
- sgt 3y agoSpeaking of LLM's... here's my "dear lazyweb" to HN: What would be the best self hosted option to build sort of a textual AI assistant into your app? Preferably something that I can train myself over time with domain knowledge.
- traverseda 3y agoFine tuning on your own knowledge probably isn't what you want to do, you probably want to do retrieval aided generation instead. Basically a search engine on some local documents, and you put the results of the search into your prompt. The search engine uses the same vector space as your language model as its index, so the results should be highly relevant to whatever the prompt is. I'd start with "librechat" and mistral, so far that's one of the best chat interfaces and has good support for self hosting. For the actual model runner, ollama seems to be the way to go. I believe it's built on "langchain", so you can switch to that when it makes sense to. When you've tested all your queries and setup with librechat, know that librechat is a wrapper around "langchain". I'd start by testing the workflow in librechat, and if librechat's API doesn't do what you want, well I've always found fastAPI pleasant to work with. --- Less for your use case, and more in-general. I've been assessing a lot of LLM interfaces lately, and the weird porn community has some really powerful and flexible interfaces. With sillytavern you can set up multiple agents, have one agent program, another agent critique, and a third asses it for security concerns. This kind of feedback can help catch a lot of LLM mistakes. You can also go back and edit the LLM's response, which can really help. If you go back and edit an LLM message to fix code or change variable names, it will tend to stick with those decisions. But those interfaces are still very much optimized for "Role playing". Recommend keeping an eye on https://www.reddit.com/r/LocalLLaMA/ https://www.reddit.com/r/LocalLLaMA/
- sgt 3y agoThanks - will check out librechat etc. It's interesting that fine tuning is no longer the thing to do. I am not clear on how one connects librechat to local data but am sure I will when I dive deeper into this.
- madeofpalk 3y ago> Q: is chrome on ios powered by safari > According to the sources provided, Chrome on iOS is not powered by Safari. Google's Chrome uses the Blink engine, while Safari uses the WebKit engine. I find it amusing how when people show off their LLM projects their examples are always of it failing, and providing a bad answer.
- nilsherzig 3y agoWell i don't indent to get money from people, so i guess showing real results isnt a "problem". Besides i think the following sentences arent wrong? Its just a 7b model give it some slack haha
- madeofpalk 3y agoNo, sure. I just think it's funny how it constantly happens, from opensource, free, or commercial projects. No one seems to be immune to 'telling on themselves'.
- aagha 3y agoAccording to Crunchbase [0], Perplexity has raised over $100M. You built this in your spare time? The following things jump out to me: - How much a hype cycle invites insane amounts of money - How trash the entire VC world is during a hype cycle - What an amazing thing ingenuity and passion are Great job! 0 - https://www.crunchbase.com/organization/perplexity-ai https://www.crunchbase.com/organization/perplexity-ai
- high_priest 3y agoWhy call it "Perplexity clone" when this is much more than what Perplexity offers? Btw. This is the first time I hear about Perplexity, which after 10 minutes of experimentation, looks like a worse clone of Phind.
- monkeydust 2y agoThis looks great, can I get a series of agents with clearly defined roles working together on a problem akin to Autogen?