27 ms·
PrivateGPT
- zestyping 3y agoWould someone do me the kindness of explaining (a little more) how this works? It looks like you can ask a question and the model will use its combined knowledge of all your documents to figure out the answer. It looks like it isn't fine-tuned or trained on all the documents, is that right? How is each document turned into an embedding, and then how does the model figure out which documents to consult to answer the question?
- deleted 3y ago[deleted]
- simonw 3y agoI'm always interested in seeing the prompt that drives these kinds of tools. In this case it appears to be using RetrievalQA from LangChain, which I think is this prompt here: https://github.com/hwchase17/langchain/blob/v0.0.176/langchain/chains/retrieval_qa/prompt.py https://github.com/hwchase17/langchain/blob/v0.0.176/langcha... Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. {context} Question: {question} Helpful Answer:
- jstarfish 3y agoDo such fail-early conditions save processing time?
- mabbo 3y agoIf you mean the "If you don't know" part, oh no, they have a much bigger problem they're solving. The LLM will absolutely lie if it doesn't know and you haven't made it perfectly clear that you'd rather it did not do that. LLMs seem to be trying to give answers that make you happy. A good lie will make you happy. Unless it understands that you will not be happy with a lie. Is this anthropomorphizing? Yep. But that's the best way I've found to reason about them.
- dragonwriter 3y agoA less anthropomorphic approach might be to say that LLMs can predict the correct “shape” of an answer even when they don’t have data that gives them a clear right answer for the correct content, and since their basic design is to provide the best response they can, they’ll provide an answer of the correct shape with fairly random content if all they have good information to predict is the shape and not the content.
- deleted 3y ago[deleted]
- flagrant_taco 3y agoWhat's the point of the technology if it will provide an answer regardless of the accuracy? And what prevents this from being dangerous when the factual and ficticious answers are indistinguishable?
- skybrian 3y agoYes, it could be dangerous if you blindly rely on its reliability for something safety-related. But many creative processes are unreliable. For example, coming up with bad ideas while brainstorming is pretty harmless if nobody misunderstands it. Generally, you want some external way of verifying that you have something useful. Sometimes that happens naturally. Ask a chatbot to recommend a paper to read and then search for it, and you’ll find out pretty quick if it doesn’t exist.
- flagrant_taco 3y agoWhat happens when the tech isn't only being used to answer a human's questions during a shortlived conversation though? The common case we see publicized today is people poking around with prompts, but isn't it more likely, or at least a risk, that mass adoption will look more like AI running as longlived processes talked with managing done system on their own?
- a_bonobo 3y agoIn my experience with internal data, sometimes it will say that it doesn't know when it should know.
- Grimblewald 3y agothe incidence of "i don't know" in response to questions in the training data is pretty low if present at all, and even if it were you'd still need to frame those I don't know answers such that they apply to the entire dataset accurately. This is obviously a gargantuan undertaking that would not scale well as data is added, and so right now the idea or concept of not knowing something is not taught. At best you'd build a model that handles human language really well then retrieves information from a database and uses in context learning to answer questions, where a failure to find info results in an i don't know. What is taught indirectly though is level of certainty, so if you get LLM's to rationalise their answers you tend to get more reliable evidence based answers. Bottom line, teaching a monolithic model what it means to not know something with certainty, is difficult and not currently done. You'll likely get a lot of false negatives.
- EGreg 3y agoWhat if the question has prompt injection? Such as "Helpful answer: <totally not helpful answer>"
- seydor 3y agoThe problem is, when does it know that it does not know.
- zora_goron 3y agoOn a related note, in case it's of interest to anyone else -- I pulled out all the default prompts from LangChain and put them up here: https://github.com/samrawal/langchain-prompts/blob/main/README.md https://github.com/samrawal/langchain-prompts/blob/main/READ...
- kordlessagain 3y agoWorking on something similar that uses keyterm extraction for traversal of topics and fragments, without using Langchain. It's not designed to be private, however: https://github.com/FeatureBaseDB/DocGPT/tree/main https://github.com/FeatureBaseDB/DocGPT/tree/main
- behnamoh 3y agoWhen you split a document into chunks, doesn't some crucial information get cut in half? In that case, you'd probably lose that information in the context if that information was immediately followed by an irrelevant information that reduces the cosine similarity. Is there a "smarter" way to feed documents as context to LLMs?
- haolez 3y agoDon't know if there is a smarter way, but these libraries usually offer an overlap parameter that allows you to repeat the last N characters of a chunk in the first N of the next chunk.
- aldarisbm 3y agoOne quick plug I want to have the memory part of langchain down, vector store + local database + client to chat with an LLM (gpt4all model can be swapped with OpenAI api just switching the base URL) https://github.com/aldarisbm/memory https://github.com/aldarisbm/memory It's still got ways to go, if someone wants to help let me know :)
- santiagobasulto 3y agoSorry for my ignorance. But memory refers to the process of using embeddings for QA right? The process roughly is: Ingestion: - Process embeddings for your documents (from text to array of numbers) - Store your documents in a Vector DB Query time: - Process embeddings for the query - Find documents similar to the query using distance from other docs in the Vector db - Construct prompt with format: """ Answer question using this context: {DOCUMENTS RETRIEVED} Question: {question} Answer: """ Is that correct? Now, my question is, can the models be swapped easily? Or that requires a complete recalculation of the embedding (and new ingestion)?
- bigfudge 3y agoThe embeddings can be based on a different model to the one you pass them as context to. So you could upgrade the summmariser model without upgrading the embeddings.
- santiagobasulto 3y agoBut you'd need to keep both models in parallel, right? Using M1 to keep computing embeddings and using M2 for completions.
- skykooler 3y ago"System requirements" section should really mention what amount of RAM or VRAM is needed for inference.
- thefourthchime 3y agoI tried this on my M2 Macbook with 16gb of RAM but got: "ggml_new_tensor_impl: not enough space in the context's memory pool (needed 18296202768, available 18217606000)"
- soferio 3y agoAnyone got it working on an M1 with 8gb?
- kseudo 3y agoI got it working on an M1 with 16gb. Quite slow but it trains and returns responses.
- brianjking 3y agoWhat did you do to make it work? I'm getting an illegal hardware instruction when I try to run python privateGPT.py Using embedded DuckDB with persistence: data will be stored in: db [1] 8281 illegal hardware instruction python privateGPT.py
- LaurenceRitchie 3y ago[dead]
- weikju 3y agoIs it private if it's using ChatGPT?
- unstatusthequo 3y agoThey will say using API means you data isn’t used for training. True if you believe OpenAI t&c’s. But that’s different than being able to say you didn’t send data to any third party.
- weikju 3y agoIndeed, it's still a far cry from being private if the data is leaving my device for any reason.
- jaimehrubiks 3y agoIf you select a gpt4all model like GPT-J can this be used commercially or is there other dependency that limits the license?
- yosito 3y ago> Put any and all your files into the source_documents directory Why? Why can't I define any directory (my existing Obsidian vault, for example) as the source directory?
- carlio 3y agoYou can by setting an environment variable - https://github.com/imartinez/privateGPT/blob/main/ingest.py#L35 https://github.com/imartinez/privateGPT/blob/main/ingest.py#...
- rolisz 3y agoFor some reason, downloading the model they suggest keeps failing. I tried to download it in Firefox and Edge. I'm using Windows, if that matters. Anyone else seeing similar issues?
- keeptrying 3y agoThis is the future.
- daitangio 3y agoHi, very interesting... what are the memory/disk requirements to run it? 16GB of RAM would be enough? I suggest to add these requirements to the README
- MandieD 3y agoAlso, a general formula for estimating how much additional storage space will be claimed per MB/million words ingested would be helpful.
- moffkalast 3y agoWell I'm not sure which models specifically work, but it runs on llama.cpp, which would mean lama derivative ones. Here's a little table for quantized CPU (GGML) versions and the RAM they require as a general rule of thumb: > Name Quant method Bits Size RAM required Use case WizardLM-7B.GGML.q4_0.bin q4_0 4bit 4.2GB 6GB 4bit. WizardLM-7B.GGML.q4_1.bin q4_0 4bit 4.63GB 6GB 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. WizardLM-7B.GGML.q5_0.bin q5_0 5bit 4.63GB 7GB 5-bit. Higher accuracy, higher resource usage and slower inference. WizardLM-7B.GGML.q5_1.bin q5_1 5bit 5.0GB 7GB 5-bit. Even higher accuracy, and higher resource usage and slower inference. WizardLM-7B.GGML.q8_0.bin q8_0 8bit 8GB 10GB 8-bit. Almost indistinguishable from float16. Huge resource use and slow. Not recommended for normal use. > Name Quant method Bits Size RAM required Use case wizard-vicuna-13B.ggmlv3.q4_0.bin q4_0 4bit 8.14GB 10.5GB 4-bit. wizard-vicuna-13B.ggmlv3.q4_1.bin q4_1 4bit 8.95GB 11.0GB 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. wizard-vicuna-13B.ggmlv3.q5_0.bin q5_0 5bit 8.95GB 11.0GB 5-bit. Higher accuracy, higher resource usage and slower inference. wizard-vicuna-13B.ggmlv3.q5_1.bin q5_1 5bit 9.76GB 12.25GB 5-bit. Even higher accuracy, and higher resource usage and slower inference. wizard-vicuna-13B.ggmlv3.q8_0.bin q5_1 5bit 16GB 18GB 8-bit. Almost indistinguishable from float16. Huge resource use and slow. Not recommended for normal use. > Name Quant method Bits Size RAM required Use case VicUnlocked-30B-LoRA.ggmlv3.q4_0.bin q4_0 4bit 20.3GB 23GB 4-bit. VicUnlocked-30B-LoRA.ggmlv3.q4_1.bin q4_1 5bit 24.4GB 27GB 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. VicUnlocked-30B-LoRA.ggmlv3.q5_0.bin q5_0 5bit 22.4GB 25GB 5-bit. Higher accuracy, higher resource usage and slower inference. VicUnlocked-30B-LoRA.ggmlv3.q5_1.bin q5_1 5bit 24.4GB 27GB 5-bit. Even higher accuracy, and higher resource usage and slower inference. VicUnlocked-30B-LoRA.ggmlv3.q8_0.bin q8_0 8bit 36.6GB 39GB 8-bit. Almost indistinguishable from float16. Huge resource use and slow. Not recommended for normal use. Copied of some of The-Bloke's model descriptions on huggingface. With 16G you can run practically all 7B and 13B versions. With shared GPU+CPU inference, one can also offload some layers onto a GPU (not sure if that makes the initial RAM requirement smaller), but you do need CUDA of course.
- sinandrei91 3y agoIs there a benchmark for retrieval from multiple ft documents? I tried the LangchainQA with Pinecone and wasn't impressed with the search result when using it on my Zotero library.
- ChocoluvH 3y agoAlways wondering pros/cons of Chroma and Qdrant. Can someone tell me?
- kacperlukawski 3y agoChroma doesn't seem to be a real DB, it's rather a wrapper around tools like hnswlib, DuckDB or Clickhouse. Qdrant is way more mature - it has its own HNSW implementation with some tweaks to incorporate filtering directly during the vector search phase, supports horizontal and vertical scaling, as well as provides its own managed cloud offering. In general, Qdrant is a real DB, not a library and that's a huge difference.
- udev4096 3y agoI posted it 9 days ago and somehow this one gets the attention. The same freaking post. Unbelievable https://news.ycombinator.com/item?id=35914810 https://news.ycombinator.com/item?id=35914810
- dutchbrit 3y agoDay and time when you post something matters a lot unfortunately.
- udev4096 3y agoAnd now I am getting downvoted for it. Perfect
- andruby 3y agopossibly because the tone of your post and that it doesn't actually add to the conversation. weekday and time of day have an impact. Thousands of entries are posted each day (see https://news.ycombinator.com/newest https://news.ycombinator.com/newest) most never get a comment or upvote.
- udev4096 3y agoPeople get very easily offended these days. What's wrong with that tone? I was just simply stating a fact
- Mystery-Machine 3y agoYou are right. People get easily offended. But your tone does seem a bit _freaking_ upset. Over what? The fact that someone posted the same link like you did and got more clicks from random users browsing the internet? Is that what upset you? What do you get if you got billions of clicks and upvotes? They say that people who need external validation don't have their own values and need to seek approval from others...
- bohlenlabs 3y agoSo many good links here, thanks to the OP for sharing, and to all commenters as well!
- Wronnay 3y agoWow. I keep a personal Wiki, Journal and use plain text accounting... This project could help me create a personal AI which answers any questions to my life, finances or knowledge...
- moffkalast 3y agoWell maybe it works on Obsidian vaults for note taking heh, but with llama models' 2k input token range it'd get a tenth of the way before starting to drop context. Likely useless without something like an 100k model.
- rolisz 3y agoWell you wouldn't input the whole Vault to the model, you would use embeddings to find the content that is most relevant to the question being asked.
- moffkalast 3y agoIs that actually a thing yet? Proper vector DB integration? I sure would like to see some demos of that, as it's been hyped up a lot but I haven't really seen anyone deploy anything proper with it yet.
- rolisz 3y agoEven PrivateGPT does that, using Chroma as vector DB
- lysp 3y agoQuick how-to/demo: https://www.youtube.com/watch?v=A3F5riM5BNE https://www.youtube.com/watch?v=A3F5riM5BNE Also has a suggestion of a few alternative models to use.
- seydor 3y agodoes this only work with llamaCPP ? I.e. can't use GPU models with this?
- joebiden2 3y agollama supports GPU by now: https://old.reddit.com/r/LocalLLaMA/comments/13gok03/llamacpp_now_officially_supports_gpu_acceleration/ https://old.reddit.com/r/LocalLLaMA/comments/13gok03/llamacp...
- seydor 3y agoHow do i enable GPU in privateGPT w llamaCpp ? It turns my CPU to a vacuum cleaner
- divan 3y agoThis will still hallucinate, right? Projects like this for using with your documents datasets are invaluable, but everything I've tried so far is hallucinating, so not practical. What's the state of the art of the LLM without hallucination at the moment?
- XCSme 3y agoHow do you define hallucination?
- divan 3y agofactually incorrect / nonsensical output
- TeMPOraL 3y agoIt will still talk like a human blurting out their train of thought out loud, yes.
- XCSme 3y agoI assume this is only possible if the training data contains only a "right answer". If the training data contains two contradicting answers A and B, then, from the AIs perspective, there is no correct answer. I assume that for questions like "What year was Bill Gates born in?", it should never return a wrong answer, if the answer was in the training data. If it was not, it should respond that it doesn't know.
- anu7df 3y agoNot exactly sure if this would qualify as an LLM in the GPT4 sense. But for no hallucination this seems good: https://www.thirdai.com/pocketllm/ https://www.thirdai.com/pocketllm/ Full disclosure. I know the founder, but not really associated with the company in any way.
- Art9681 3y agoLike many others, I’m also building my own platform to accomplish this. What I’ve learned is the document preparation is key in getting the LLM to answer correctly. The text splitting portion is a crucial step here. Picking the correct splitter and parameters for your use case is important. At first I was getting incorrect or made up answers. Setting up a proper prompt template and text splitting parameters fixed the issue for the most part and now I have 99% success. Also, the local model used makes a big difference. Right now wizard-mega and manticore are the best ones to use. I run the 16b ggml versions in an M2 Pro and it takes about 30 seconds to “warm up” and produce some quality responses.
- amelius 3y agoWith so many LLM options out there, how do we keep track of which ones are good?
- superbiome 3y agohttps://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderb... is one place.
- amelius 3y agoHow many tokens/second on an average machine?
- davidy123 3y agoGranted I'm not coming from the python world, but I have tried many of these projects, and very few of them install out of the box. They usually end with some incompatibility, and files scattered all over the place, leading to future nightmares. ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. sentry-sdk 1.22.2 requires urllib3<2.0.0, but you have urllib3 2.0.2 which is incompatible Just for fun, here's the result of python -m pip install -r ./requirements.txt for tortoise-tts; …many many lines raise ValueError("%r is not a directory" % (package_path,)) ValueError: 'build/py3k/scipy' is not a directory Converting to Python3 via 2to3... … /tmp/pip-install-hkb_4lh7/scipy_088b20410aca4f0cbcddeac86ac7b7b1/build/py3k/scipy/signal/fir_filter_design.py [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed I'm not asking for support, just saying if people really want to make something 'easy' they'd use docker. I gather there are better python package managers, but I gather that's a bit of a mess too. Someone is thinking "this is part of learning the language," but I think it's just bad design.
- johnnyjeans 3y agoThis is the primary reason I'm averse to languages and ecosystems that rely on package managers. I have never had a good experience where these things aren't just constantly breaking. Stack/cabal, cargo, pip, npm/yarn, gem. Scattering files across my filesystem and having extremely brittle configs that shatter the ecosystem into a billion pieces at seemingly random intervals. A problem exacerbated by these package managers often being more complex than the compiler/interpreter itself. Luarocks is probably the least problematic, and that's mostly because it hosts really simple and self-contained software. Say what you will about the old school way of manually building and copying shit around, at least when something breaks I don't have to spend a couple hours keelhauling a bloated toolchain in a debugger for mutiny.
- tedmiston 3y agoAre you familiar with virtual environments? It's the standard Python technique for isolating dependencies across projects. [Most projects mention this in the setup / quickstart section of their docs.] You should not be seeing these dependency conflict issues if you install each project in its own virtual environment. If you just want them to be easily installed you can just use pipx (`pipx install my-package`) which will manage the virtual environment automatically. Making a full blown Docker image for it is overkill 99% of the time. Virtual environments serve the same purpose while being much faster and lighter weight.
- j_shi 3y agoSelf-hosted + self-trained LLMs are probably the future for enterprise. While consumers are happy to get their data mined to avoid paying, businesses are the opposite: willing to pay a lot to avoid feeding data to MSFT/GOOG/META. They may give assurances on data protection (even here GitHub copilot TOS has sketchy language around saving down derived data), but can’t get around fundamental problem that their products need user interactions to work well. So it seems with BigTechLLM there’s inherent tension between product competitiveness and data privacy, which makes them incompatible with enterprise. Biz ideas along these lines: - Help enterprises set up, train, maintain own customized LLMs - Security, compliance, monitoring tools - Help AI startups get compliant with enterprise security - Fine tuning service
- cddotdotslash 3y agoI suspect the major cloud providers will also each offer their own “enterprise friendly” LLM services (Azure already offers a version of OpenAI’s API). If they have the right data guarantees, that’ll probably be sufficient for companies that are already using their IaaS offerings.
- quaintdev 3y agoEnterprises should work on an open source LLM and run it on their own. This also helps people like you and me to run LLM at home. It has worked before like in case of Linux and can work again.
- cubefox 3y agoPowerful LLMs are so large that they can only be trained by the major AI companies. Even LLaMA 65B (where the open release was less than intended) can't compete with GPT-3.5, let alone GPT-4. And the price for the most powerful models will only increase now, as we have effectively an arms race between OpenAI/Microsoft and Google. Few, if anyone, will be able to keep up. Linux is different. It doesn't require huge investments in server farms.
- 3y ago
- superbiome 3y agoDoes something like this exist for local code repos? (Excuse my ignorance since the space is moving faster than light.)
- arbol 3y agoSeems to me that this could be used for exactly that. Just fork the repo and change the filetypes and loaders for your code source files.
- arbol 3y agohttps://python.langchain.com/en/latest/modules/indexes/document_loaders.html https://python.langchain.com/en/latest/modules/indexes/docum...
- monkeydust 3y agoGot this working locally - badly needs GPU support (have a 3090 so come on!) there is some workaround but expect it will come pretty soon. This video was a useful walkthough esp on using different model and upping the CPU threads. https://www.youtube.com/watch?v=A3F5riM5BNE https://www.youtube.com/watch?v=A3F5riM5BNE
- Havoc 3y agoWould this work better with something like llama or a instruction following model like alpaca?
- debbiedowner 3y agoThis is a shortcut/workaround to transforming the private docs to a prompt:answer dataset and fine tuning right? What would be the difference in user experience or information retrieval performance between the two? My impression is it saves work on the dataset transformation and compute for fine tuning, so it must be less performant. Is there a reason to prefer the strategy here other than ease of setup?
- hodanli 3y agoThese are the similar projects I've come across: - [GitHub - e-johnstonn/BriefGPT: Locally hosted tool that connects documents to LLMs for summarization and querying, with a simple GUI.](https://github.com/e-johnstonn/BriefGPT https://github.com/e-johnstonn/BriefGPT) - [GitHub - go-skynet/LocalAI: Self-hosted, community-driven, local OpenAI-compatible API. Drop-in replacement for OpenAI running LLMs on consumer-grade hardware. No GPU required. LocalAI is a RESTful API to run ggml compatible models: llama.cpp, alpaca.cpp, gpt4all.cpp, rwkv.cpp, whisper.cpp, vicuna, koala, gpt4all-j, cerebras and many others!](https://github.com/go-skynet/LocalAI https://github.com/go-skynet/LocalAI) - [GitHub - paulpierre/RasaGPT: RasaGPT is the first headless LLM chatbot platform built on top of Rasa and Langchain. Built w/ Rasa, FastAPI, Langchain, LlamaIndex, SQLModel, pgvector, ngrok, telegram](https://github.com/paulpierre/RasaGPT https://github.com/paulpierre/RasaGPT) - [GitHub - imartinez/privateGPT: Interact privately with your documents using the power of GPT, 100% privately, no data leaks](https://github.com/imartinez/privateGPT https://github.com/imartinez/privateGPT) - [GitHub - reworkd/AgentGPT: Assemble, configure, and deploy autonomous AI Agents in your browser.](https://github.com/reworkd/AgentGPT https://github.com/reworkd/AgentGPT) - [GitHub - deepset-ai/haystack: Haystack is an open source NLP framework to interact with your data using Transformer models and LLMs (GPT-4, ChatGPT and alike). Haystack offers production-ready tools to quickly build complex question answering, semantic search, text generation applications, and more.](https://github.com/deepset-ai/haystack https://github.com/deepset-ai/haystack) - [PocketLLM « ThirdAi](https://www.thirdai.com/pocketllm/ https://www.thirdai.com/pocketllm/) - [GitHub - imClumsyPanda/langchain-ChatGLM: langchain-ChatGLM, local knowledge based ChatGLM with langchain | 基于本地知识库的 ChatGLM 问答](https://github.com/imClumsyPanda/langchain-ChatGLM https://github.com/imClumsyPanda/langchain-ChatGLM)