Purak Jain retweeted
today i learned something very interesting at ICLR, a term called order of evidence.
During RAG, we send the top retrieved documents as evidences and prompting them to LLMs. Normally prompting is based on cosine similarity: top match always being prompted first.
However, different LLMs might have difference "preference" on the order of evidence:
1. ChatGPT prefers top evidence, which is good.
2. GPT4 has no preference on evidence order, which means the similarity score is not being considered, you only need to decide top-K, and all evidences will be equally treated.
3. Surprisingly, Llama2 and PaLM prefers last order evidence, so you need to reverse the rank list then prompt to the LLM :)
arxiv.org/pdf/2305.13300
Purak Jain retweeted
Summarizing meeting notes and action items is compounding. AI can augment these skills and reduce overhead. Today, I’m open-sourcing a simple app my team has built (with help from Q) to summarize our discussions and track deliverables: allthingsdistributed.com/202… #Bedrock #AmazonQ
Purak Jain retweeted
A long-suspected theory: LSTMs are superior to Transformers but we didn't know how to scale them as well — so Transformers pulled ahead because they were easier to scale.
Enter xLSTM... very interesting work.
Key diagrams below
I am so excited that xLSTM is out. LSTM is close to my heart - for more than 30 years now. With xLSTM we close the gap to existing state-of-the-art LLMs. With NXAI we have started to build our own European LLMs. I am very proud of my team. arxiv.org/abs/2405.04517
Purak Jain retweeted
github.com/google-research/t…
Yes. Yes!!!! Everyone read this material three times!
Purak Jain retweeted
gave a talk at last week's Stanford MLSys seminar about evaluating LLM pipeline output quality, especially for custom tasks at scale: youtube.com/watch?v=eGVDKegR…
if your lab is interested in data management x LLMs x HCI, i would love to give this talk & get your feedback! 🙏
Purak Jain retweeted
Replying to @ns123abc @ID_AA_Carmack
i think there were actually like 30 delivered but here there are arc.net/folder/D0472A20-9C20…
Purak Jain retweeted
since I'm deeply immersed in evals right now (and the process of building them) I got a kick out of this paper from @sh_reya @jdzamfi @bjo3rn @adityagp @IanArawjo
it addresses the challenge of time-efficiently coming up with evals that are aligned with practitioners
some thoughts:
Purak Jain retweeted
I've written up my study group lectures on implementing Transformers in PyTorch into a blog series:
Creating Transformers from Scratch:
- Part 1: The Attention Mechanism benjaminwarner.dev/2023/07/0…
- Part 2: The Rest of the Transformer benjaminwarner.dev/2023/07/2…
Purak Jain retweeted
hard launching a new HCI paper on LLM evals tomorrow 🚀 (tldr: coming up with custom evals you can trust is _really_ hard, and our paper shares a number of reasons for why)
Purak Jain retweeted
This video from @UmerHAdil is *the* best resource I've seen for learning OpenAI Triton -- and one of the best deep tech tutorials of any kind I've seen.
youtube.com/watch?v=DdTsX6DQ…
Purak Jain retweeted
I'm teaching spatial, stochastic simulation in my #DataAnalytics course.
To help my students make the leap from spatial estimation to spatial simulation I built out this #Python @matplotlib dashboard with my sequential Gaussian simulation codes on #GitHub @ github.com/GeostatsGuy/DataS… ∀.
Students learn by playing with #DataScience methods!
Purak Jain retweeted
LLM app development is rate-limited by quality evals. There's a paradox of LLM, prompt, etc choice. Recently put together a short guide on setting up custom evals.
Playlist (5 min vids):
youtube.com/playlist?list=PL…
Code:
github.com/langchain-ai/lang…
teapawt.net/LangChainAI/status/177…
LangSmith Evaluations
With the rapid pace of AI, developers are often faced with a paradox of choice: how to choose the right prompt, how to trade-off LLM quality vs cost?
Evaluations can accelerate development with structured process for making these decisions.
But, we've heard that it is challenging to get started. So, we are launching a series of short videos focused on explaining how to perform evaluations using LangSmith.
1. Why Evals Matter
Lays out 4 general considerations for evaluation: (1) dataset, (2) evaluator, (3) task, (4) how to apply eval to improve your product (e.g., unit tests, A/B tests, etc).
📽️:
youtu.be/vygFgCNR7WA
📓:
docs.smith.langchain.com/eva…
2. Evaluation Primitives
Introduces the primary components of LangSmith evaluation, including tracing (along with metadata, feedback, tags), datasets, and evaluators.
📽️:
youtu.be/OuFUy45RsHU
📓:
docs.smith.langchain.com/tra…
3. Dataset Creation: Manual curation
Users often want to build custom eval sets (e.g., of QA pairs for RAG, or prompt-expected response pairs). This shows how to create, edit, and version your own evaluation dataset using the LangSmith SDK.
📽️:
youtu.be/N9hjO-Uy1Vo
📓:
docs.smith.langchain.com/eva…
4. Dataset Creation: From Logs
Users often want to capture user logs as good and / or challenging examples to re-test their application on. This shows how to create datasets directly from logs (e.g., user interactions with your app that are captured in LangSmith).
📽️:
youtu.be/hPqhQJPIVI8
📓:
docs.smith.langchain.com/eva…
5. Evaluators: Pre-built
Users often want to quickly get started with eval; for this you can use many of LangSmith's pre-built evaluators (e.g., that use LLM-as-a-judge) for tasks such as RAG (question answering), evaluating LLM output based upon user-supplied criteria, etc.
📽️:
youtu.be/y5GvqOi4bJQ
📓:
docs.smith.langchain.com/eva…
6. Evaluators: Custom
Users often want to define custom evals that are domain specific to a particular app. This shows how to define your own custom evaluation logic in LangSmith.
📽️:
youtu.be/w31v_kFvcNw
📓:
docs.smith.langchain.com/eva…
7. Eval comparisons
Once a user has run a few different experiments, it is common to compare results (both using metrics and with manual inspection of the examples that show the most difference). This shows how to compare results of multiple experiments in the LangSmith UI, using review of traces to inspect run outputs or the grader decisions.
📽️:
youtu.be/kl5U_efgK_8
📓:
docs.smith.langchain.com/use…
Notebook used in videos:
github.com/langchain-ai/lang…
Purak Jain retweeted
Prototyping is easy. Shipping high-quality systems is hard.
One of the most helpful papers for AI practitioners is @sh_reya et al. “Operationalizing ML: an interview study.”
Lots of learnings from many teams are distilled into a single paper
arxiv.org/abs/2209.09125
Purak Jain retweeted
RAG From Scratch
Here's a set of short (5-10 min videos) and notebooks explaining > a dozen of my favorite RAG papers. Took a stab at implementing each idea myself (all code open source) and grouped according to the diagram.
Repo:
github.com/langchain-ai/rag-…
Video playlist:
youtube.com/playlist?list=PL…
Some highlights:
Is RAG Really Dead?
How RAG might change with long context LLMs.
Video:
youtube.com/watch?v=SsHUNfhF…
Adaptive-RAG
Dynamically route queries based on complexity to different RAG approaches. Implemented in LangGraph w/ @cohere cmd-R.
Video:
youtu.be/04ighIjMcAI
Code:
github.com/langchain-ai/lang…
Paper (@SoyeongJeong97 et al):
arxiv.org/abs/2403.14403
Corrective-RAG
Self-correct retrieval errors in-the-loop unit tests for doc relevance and fallback to web-search. I implemented in LangGraph w/ @MistralAI-7b + @ollama for running locally.
Video:
youtube.com/watch?v=E2shqsYw…
Code:
github.com/langchain-ai/lang…
Paper (@Jiachen_Gu et al):
arxiv.org/pdf/2401.15884.pdf
Self-RAG
Self-correct RAG errors with in-the-loop unit tests for doc relevance, answer hallucinations, and answer quality. Implemented in LangGraph w/ @MistralAI-7b + @ollama for running locally.
Code:
github.com/langchain-ai/lang…
Code (local):
github.com/langchain-ai/lang…
Paper (@AkariAsai et al):
arxiv.org/abs/2310.11511.pdf
Query Routing
Various approaches for directing questions to the correct datasource (e.g., logical, semantic, etc).
Video:
youtu.be/pfpIndq7Fi8
Code:
github.com/langchain-ai/rag-…
Query Structuring
Use an LLM to convert from natural language-to-<DSL> where DSL is a domain specific language required to interact with a given database (SQL, Cypher, etc).
Video:
youtu.be/kl6NwWYxvbM
Code:
github.com/langchain-ai/rag-…
Blog:
blog.langchain.dev/query-con…
2/ Deep dive on graphDBs (c/o @neo4j): blog.langchain.dev/enhancing…
3/ Query structuring docs: python.langchain.com/docs/us…
4/ Self-query retriever docs: python.langchain.com/docs/mo…
Multi-Representation Indexing
Use an LLM to produce document summaries ("propositions") that are optimized for retrieval. Embed these summaries for similarity search, but return full documents to the LLM for generation.
Video:
youtu.be/gTCU9I6QqCE
Code:
github.com/langchain-ai/rag-…
Paper (@tomchen0 et al):
arxiv.org/pdf/2312.06648.pdf
RAPTOR
Cluster docs in the corpus and summarize similar ones recursively. Index them all together, resulting in lower-level docs and summaries that can be retrieved to answer questions that span detailed-to-higher level.
Video:
youtu.be/z_6EeA2LDSw
Code:
github.com/langchain-ai/lang…
Paper (@parthsarthi03 et al):
arxiv.org/pdf/2401.18059.pdf
ColBERT
Improve embedding granularity w/ a contextually influenced embedding for each token in the document and query.
Video:
youtu.be/cN6S0Ehm7_8
Code:
github.com/langchain-ai/rag-…
Paper (@lateinteraction & @matei_zaharia):
arxiv.org/abs/2004.12832
Multi-Query
Re-write the user question from multiple perspectives, retrieve documents for each re-written question, return the unique documents for all queries.
Video:
youtube.com/watch?v=JChPi0CR…
Code:
github.com/langchain-ai/rag-…
Paper:
arxiv.org/pdf/2305.14283.pdf
RAG-Fusion
Re-write the user question from multiple perspectives, retrieve documents for each re-written question, and combine the ranks of multiple search result lists to produce a single, unified ranking w/ Reciprocal Rank Fusion (RRF).
Video:
youtube.com/watch?v=77qELPbN…
Code:
github.com/langchain-ai/rag-…
Repo (@Raudaschl):
github.com/Raudaschl/rag-fus…
Decomposition
Decompose a question into a set of sub-problems / questions, which can either be solved sequentially (use the answer from first + retrieval to answer the second) or in parallel (consolidate each answer into final answer). Various works such as Least-to-Most prompting (@denny_zhou et al) and IR-CoT present ideas that be utilized.
Video:
youtube.com/watch?v=h0OPWlEO…
Code:
github.com/langchain-ai/rag-…
Papers:
arxiv.org/pdf/2205.10625.pdf arxiv.org/pdf/2212.10509.pdf
Step-back prompting
First prompt the LLM to ask a generic step-back question about higher-level concepts or principles, and retrieve relevant facts about them. Use this grounding to help answer the user question.
Video:
youtube.com/watch?v=xn1jEjRy…
Code:
github.com/langchain-ai/rag-…
Paper (@denny_zhou + colleges):
arxiv.org/pdf/2310.06117.pdf
HyDE
LLM to convert questions into hypothetical documents that answer the question. Use the embedded hypothetical documents to retrieve real documents with the premise that doc-doc similarity search can produce more relevant matches.
Video:
youtube.com/watch?v=SaDzIVkY…
Code:
github.com/langchain-ai/rag-…
Paper:
arxiv.org/abs/2212.10496
Purak Jain retweeted
The most dangerous modern diseases aren't:
Depression. Obesity. ADHD.
This one disease is the worst. And it causes the three above.
Here it is (and how to protect yourself):
Readers added context they thought people might want to know
This thread heavily pulls on pseudoscience with the intention of selling users supplements with little pharmacological effect.
It relies on the teachings of Andrew Huberman, many of which have been examined and generally concluded to be misleading or even harmful.
slate.com/technology/202…
mcgill.ca/oss/article/cr…
kstarr.com/huberman-bro-s…
Purak Jain retweeted
Andrej Karpathy talking about -
- rarity of talents in distributed computing with GPUs.
- the opportunities in computer architecture because von Neumann architecture may not be optimal
- progress in precision
- sparsity in neural networks
Purak Jain retweeted
github.com/hrishioa/lumentis
leave this here
Purak Jain retweeted
One of the most imaginative LLM papers I've read in a while: use evolution to merge models from HuggingFace to unlock new capabilities, such as Japanese understanding. It's a form of sophisticated model surgery that requires much smaller compute than traditional LLM training. By none other than @hardmaru, who proposed many inspiring "meta techniques" like HyperNet and weight-agnostic NN.
There're only 2 methods that scale indefinitely with compute: learning & search (@RichardSSutton, the Bitter Lesson). The foundation model community is focusing almost exclusively on learning, but has not put much emphasis on search. I believe the latter has immense potential both in training (evolutionary algorithms) and inference (AlphaGo-style search) phases.
Links in comment.


































