
Head of Community/Graph ML at Lore. Previously @SPGlobal, @SpotifyEng, @Graphika_NYC. Cornell PhD. Graphs, ML, NLP, MLOps, experiments, culture, health.
Prosper, TX
Joined April 2011
- Tweets1.6K
- Following1.9K
- Followers499
- Likes3.5K
Pinned Tweet
My dissertation, "Integrating Graph and Language Data in Machine Learning Models: Applications for Computational Social Science," is online: proquest.com/openview/68222e… 🥳 TLDR, multimodal #ML can create more robust models to test new hypotheses one can't test with single data types.
Alex Ruch retweeted
Do you have a text dataset you need to process with an LLM but want to minimize cost? 🤷
Try BARGAIN (SIGMOD'26):
💰 It reduces costs by using cheaper LLMs (e.g,gpt5mini) on data records they are accurate
🎯 *statistically guarantees* output matches expensive LLM's (e.g,gpt5)
Alex Ruch retweeted
Our paper "Steering Semantic Data Processing with DocWrangler" will be receiving a Best Paper Honorable Mention in a couple of weeks at UIST 2025!
DocWrangler is a mixed-initiative IDE we built at Berkeley for semantic data processing, where users work with AI to analyze unstructured documents. It addresses the following challenge: even with LLMs, writing effective data pipelines requires constant back-and-forth between understanding your data and expressing what you want.
I will give the backstory in this thread, in hopes that folks will be motivated to read the paper :-)
Alex Ruch retweeted
𝗟𝗟𝗠 𝗢𝗯𝘀𝗲𝗿𝘃𝗮𝗯𝗶𝗹𝗶𝘁𝘆 is becoming the key foundation without which reliable Agentic systems can not be built. 𝗧𝗿𝗮𝗰𝗶𝗻𝗴 sits at the core of it, why is it important?
Tracing and instrumentation of software have been around for decades now. With AI systems resembling regular software even more, we are now moving the practice here as well (with a few key differences).
Let’s look into the process of tracing from a perspective of a naive RAG system.
𝘍𝘦𝘸 𝘥𝘦𝘧𝘪𝘯𝘪𝘵𝘪𝘰𝘯𝘴:
𝘼) A Controller in the GenAI system application is the central piece of software that orchestrates the end-to-end process. Think of apps using LangChain, LlamaIndex or Haystack.
𝘽) Trace is the end-to-end application flow from the entry point till the answer is produced, it is composed of smaller pieces called spans.
𝘾) Span is a smaller piece of the application flow that represents an atomic action like a function call or a database query. They can be sequential, or run in parallel.
ℹ️ As part of span we capture general metadata like start and end time, inputs and outputs of the span. On top of this metadata we track information specific to the GenAI system elements.
What might a trace look like for a naive RAG system?
𝟭. A query that has been submitted to the chat application.
𝟮. The query is embedded into a vector.
✅ Additional metadata like input token count is persisted with the span so that we can estimate the cost of the procedure.
𝟯. ANN lookup performed against the Vector DB to retrieve the most relevant context.
✅ Additional metadata about the query is persisted as part of the span together with the retrieved pieces of context and their relevance.
𝟰. A prompt is constructed from the system prompt and retrieved context.
𝟱. The prompt is passed to the LLM to construct the answer.
✅ Additional metadata about input and output token count is captured together with the span so that we can estimate the cost of the procedure.
𝘞𝘩𝘺 𝘪𝘴 𝘵𝘳𝘢𝘤𝘪𝘯𝘨 𝘰𝘧 𝘎𝘦𝘯𝘈𝘐 𝘴𝘺𝘴𝘵𝘦𝘮𝘴 𝘪𝘮𝘱𝘰𝘳𝘵𝘢𝘯𝘵?
- These applications are usually complex chains, errors can happen in different steps of your application. E.g. Embedding of query is taking longer than expected or you have reached API limits of LLM provider.
- Cost for calling LLM APIs will be variable depending on the length of inputs and produced outputs. You would usually trace this information and analyze it to help forecast expenses.
- GenAI systems are non-deterministic and will deteriorate over time. They need to be evaluated on span level rather than input/output of the entire system so that you can tune each piece separately.
- …
Are you tracing GenAI systems? Let me know in the comments 👇
#LLM #AI #LLMOps
Want to learn how to build Agents from scratch without using any LLM Orchestration tool? Make sure to check one of my latest articles: newsletter.swirlai.com/p/bui…
Alex Ruch retweeted
Our new @PNASNews paper:
1⃣shows that #coordinated communities are unstable in time 📈⏱️
2⃣reveals user #migration between political communities 🔴➡️🔵
3⃣explores dynamics of #influence in online debates 🗣️
📰 paper: pnas.org/doi/full/10.1073/pn…
@IITCNR @SoBigData @mbzuai @UniPadova
Alex Ruch retweeted
Nat. Hum. Behav.: Long ties across networks accelerate the spread of social contagions
nature.com/articles/s41562-0…
Alex Ruch retweeted
J. R. Soc. Interface: Individual-centralized seeding strategy for influence maximization in information-limited networks
royalsocietypublishing.org/d…
Alex Ruch retweeted
Nat. Hum. Behav.: Long ties accelerate noisy threshold-based contagions
nature.com/articles/s41562-0…
Alex Ruch retweeted
Nat. Ecol. Evol.: Interaction network structure explains species’ temporal persistence in empirical plant–pollinator communities
nature.com/articles/s41559-0…
Alex Ruch retweeted
I’m excited to share that I’m working on a new book about building applications with foundation models! AI Engineering builds upon Machine Learning Systems Design, but with a focus on large scale, ready made models.
The book covers:
- The new AI stack (e.g. how it differs from traditional ML engineering)
- Different approaches to evaluate open-ended systems
- Dataset engineering
- Prompt engineering, RAG, agents
- Finetuning
- Compute infrastructure, including how to mitigate latency and cost
AI Engineering is scheduled for late 2024. The first 3 chapters are available on the O'Reilly platform: learning.oreilly.com/library…
I’ve learned a lot during the research and writing process for this book. I hope you’ll find the learnings useful. Feedback is much appreciated!
Alex Ruch retweeted
Found some awesome date ideas off an app called sevenn.co/
Alex Ruch retweeted
Replying to @sevennsocial
@sevennsocial found a nice date night spot today just by using this app 🤞🏾. It’s getting increasingly hard to find new and exciting recommendations.
Alex Ruch retweeted
Graphs, structures that describe connections between objects, are everywhere — imagine the tools in a kitchen, parts of a bike, or a group of friends. Learn about our latest work that explores how to encode graphs in a format that an LLM can understand: → goo.gle/3TbowPr
Alex Ruch retweeted
New paper from my lab:
Network structure shapes the impact of diversity in collective learning
Thread explainer 🧵👇
Alex Ruch retweeted
Delighted to share that our paper "Personalized Audiobook Recommendations at Spotify Through Graph Neural Networks" has been accepted to #TheWebConf2024! We introduce 2T-HGNN, a scalable recommendation system powering personalized audiobook recommendations on Spotify.
Alex Ruch retweeted
Thanks, everyone, for all the support and positive words for my "Build a Large Language Model (from Scratch)" book!
The next chapter on *coding self-attention, multi-head attention, and causal self-attention from scratch* is on the way and will be in the MEAP in a few weeks!
For a sneak peek, you can find the code (along with short notes here): github.com/rasbt/LLMs-from-s….
One of the best ways to understand LLMs is to code one from scratch!
Last summer, I started working on a new book, "Build a Large Language Model (from Scratch)": manning.com/books/build-a-la…
I'm excited to share that the first chapters are now available via Manning's early access program if you are looking to read something over the holidays or pick up a new project in 2024!
In short, in this book, I'll guide you step by step through creating your own LLM, explaining each stage with clear text, diagrams, and examples.
This includes Implementing the data preparation, sampling, and tokenization pipeline:
1. Coding multi-head attention from the ground up
2. Building and pretraining a GPT-like model
3. Learning how to load pretrained weights
4. Finetuning the model for classification
5. Instruction-finetuning the model with direct preference optimization
PS: The code implementations are in PyTorch.
Don't hesitate to reach out if you have any questions!
Alex Ruch retweeted
New paper!
“Scalable network reconstruction in subquadratic time”
arxiv.org/abs/2401.01404
TL;DR: It's now possible to reconstruct huge networks from observational data using statistical inference.
Explainer thread: 1/N
Alex Ruch retweeted
Fostering a culture of experimentation in your engineering teams
Watch now bit.ly/3uiXA7u
Alex Ruch retweeted
⛪️Adding Structure-Aware Retrieval to GenAI Stack
A great post by Joshua Yu takes a look at improving retrieval performance by using the GenAI stack:
@Docker + @neo4j + @langchain + @Ollama_ai
This stack is (1) fully local, (2) uses advanced retrieval methods that encode relationships between different chunks of texts
A great weekend read: medium.com/@yu-joshua/adding…
Alex Ruch retweeted
⭐️RAG with multi-modal embeddings ⭐️
The launch of the GPT-4V API has sparked a surge in interest for multi-modal RAG applications.
Multi-modal embeddings will become central to these apps, mapping text and images into a common space for retrieval.
This week, @trychroma rolled out support for multi-modal embeddings:
docs.trychroma.com/multi-mod…
We worked w/ them to release a new cookbook for multi-modal RAG using Open Clip multi-modal embeddings.
This is a powerful approach when you want to jointly reason about retrieved text and images.
For example, we make GPT-4V an art critic capable of discussing important artworks or photography retrieved via user keywords from a vectorstore.
You can see the RAG trace with LangSmith, which now supports multi-modal:
smith.langchain.com/public/6…
Cookbook:
github.com/langchain-ai/lang…
Alex Ruch retweeted
🧑🏫RAG Overview
If you've been looking for a good overview of LangChain + RAG, then you're in luck!
@sophiamyang recently released a FANTASTIC presentation on exactly that. Covers both the basics as well as more advanced topics
Presentation: sophiamyang.github.io/slides…






























