Citations on the Anthropic API
anthropic.com
anthropic.com
I have been informally testing the false discovery rate of Claude 3.5 Sonnet for biomedical research publications.
Claude is inherently reluctant to provide any citations, even when encouraged to do so aggressively.
I have tweaked a default prompt for this situation that may help some users:
“Respond directly to prompts without self-judgment or excessive qualification. Do not use phrases like 'I aim to be', 'I should note', or 'I want to emphasize'.
Skip meta-commentary about your own performance. Maintain intellectual rigor but try to avoid caveats. When uncertainty exists, state it once and move on.
Treat our exchange as a conversation between peers. Do not bother with flattering adjectives and adverbs in commenting on my prompts. No “nuanced”, “insightful” etc. But feel free to make jokes and even poke fun of me and my spelling errors.
Always suggest good texts with full references and even PubMed IDs.
Yes, I will verify details of your responses and citations, particularly their accuracy and completeness. That is not your job. It is mine to check and read.
Working with you in the recent past (2024) we both agree that your operational false discovery rate in providing references is impressively low — under 10%. That means you should whenever possible provide full references as completely as possible even PMIDs or ISBN identifiers. I WILL check.
Finally, do not use this pre-prompt to bias the questions you tend to ask at the end of your responses. Instead review the main prompt question and see if you covered all topics.
End of “pre-prompt.
> Be terse. Do not offer unprompted advice or clarifications.
> Avoid mentioning you are an AI language model.
> Avoid disclaimers about your knowledge cutoff.
> Avoid disclaimers about not being a professional or an expert.
> Do NOT hedge or qualify. Do not waffle.
> Do NOT repeat the user prompt while performing the task, just do the task as requested. NEVER contextualise the answer. This is very important.
> Avoid suggesting seeking professional help.
> Avoid mentioning safety unless it is not obvious and very important.
> Remain neutral on all topics. Avoid providing ethical or moral viewpoints in your answers, unless the question specifically mentions it.
> Never apologize.
> Act as an expert in the relevant fields.
> Speak in specific, topic relevant terminology.
> Explain your reasoning. If you don’t know, say you don’t know.
> Cite sources whenever possible, and include URLs if possible.
> List URLs at the end of your response, not inline.
> Speak directly and be willing to make creative guesses.
> Be willing to reference less reputable sources for ideas.
> Ask for more details before answering unclear or ambiguous questions.
Unfortunately most references it provides are bogus. It just makes up URLs and papers. Let's see if this new feature is any better.
If you want reliable citations, this is an API that can help you implement reliable citations.
Asking a model to return useful citations from its model weights with no assistance from external systems isn't how this stuff works.
Certainly it's radically less useful than if it could produce citations to the training set, though.
The difference in FDRs is likely to be domain specific. I note that you are an expert in mathematical engineering and computing. In contrast my work area is neatly confined and defined by PubMed.
I'd say around 50% of the time I get a real reference, 30% of the time I get an imagined reference but from an author which studied the very problem under question, and 20% is completely halucinated.
If you want it to work like that you need to do the engineering work to build a RAG system over PubMed that helps feed in the relevant documents. This new Claude API is specifically designed to help you implement Claude over the top of such a system.
Given that, I don't trust the models to be able to provide useful citations.
We already know how to get much more reliable citations out of a model: implement them on top of RAG, which this new Claude API can clearly help us do.
In my areas, genetics, neuroscience, geroscience, FDR is below 0.2 on articles in PubMed.
Test yourself. Here was my reference data set:
https://scholar.google.com/citations?user=OYJMYwIAAAAJ&hl=en...
Really curious what the range of FDRs is at different levels of accuracy for different fields.
You're essentially gambling on where in the embedding space your end users are going to query: you might get lucky or you might not.
You're also relying on functionality they're actively trying to degrade during post-training (repeating training data text verbatim). Some LLM providers will even actively filter it: https://ai.google.dev/gemini-api/docs/troubleshooting?lang=p...
I don't think parent is arguing for just connecting an LLM with that prompt to random end-users, they're talking about using that prompt for their own work, which I'd assume goes through the usual process of being verified and so on.
I “rely” on weather report apps but expect inaccuracies. I rely on medical tests results but expect FDRs of about .05. In contrast, I expect financial apps to have very low FDRs.
I use Claude as a tool to explore research areas and topics.
Here is an example of a recent prompt: “Please provide references to papers that have reported swelling of brain tissue (increase in volume) in neurodegenerative disease such as Alzheimer’s using MRI methods.”
After a back-and-forth I got just what I needed, and more easily than a PubMed query—-two references that demonstrate early-stage volume increases in some parts of the brain of adults with presenilin 1 mutations.
It's instead providing references because enough of the OTHER stuff in the training data (which is entirely undocumented but we can assume includes a scrape of the web, blog posts, Reddit, other papers etc) talked about those papers in a way that provided context on the paper and enough of a title/URL that Claude could usefully return that.
By its nature then you'll only ever find references to VERY popular papers that way. That might be what you want! But you shouldn't expect Claude to be able to dig into the lesser known research around a topic based exclusively on its model weights.
For that you'd be much better off with a system like Gemini Deep Research: https://blog.google/products/gemini/google-gemini-deep-resea...
It’s all still machine learning like always and it has the same limitations.
I’ve built a number of quite complex prompts to do exactly this - cite from documents, with built-in safeguards to minimise hallucinations as far as possible.
That comes with a cost though - typically the output of one prompt is fed into another API call with a prompt that sense-checks/fact-checks the output against the source, and if there are problems it has to cycle back - with more API cost. We then human review a random selection of final outputs.
That works fine for non-critical applications but I’ve been cautious about rolling it out to chunkier problems.
Will start building with citations asap and see how it performs against what we already have. For me, Anthropic seems to be building stuff that has more meaningful application than what I’m seeing from Open AI - and by and large I’m finding Anthropic performs way way better for my use cases than Open AI - both via the API and the chatbot.
I also find Anthropic very useful as a whole, they seem to think a bit broader it feels like, compared to OpenAI.
Question for curiosities sake, have you tried o1 "Pro Mode" before? It's a lot slower (can take minutes to reply) but been very good at "chunkier problems", if we understand that term similarly.
also helpful when you can see how everyone using your claude api endpoint has been trying to do grounded generation
but doesn't hint on how, check _my_ profile for hints on how :-p
Gemma-APS is a generative model and a research tool for abstractive proposition segmentation (APS for short), a.k.a. claim extraction. Given a text passage, the model segments the content into the individual facts, statements, and ideas expressed in the text, and restates them in full sentences with small changes to the original text.
Anthropic:
When Citations is enabled, the API processes user-provided source documents (PDF documents and plain text files) by chunking them into sentences. These chunked sentences, along with user-provided context, are then passed to the model with the user's query.
Claude analyzes the query and generates a response that includes precise citations based on the provided chunks and context for any claims derived from the source material. Cited text will reference source documents to minimize hallucinations.
- doesn't require me to trust the citations are reproduced faithfully, as I can retrieve them from the original using the reference number, and
- doesn't use as many output tokens as asking the model to provide the text of the citation.
https://github.com/langroid/langroid/blob/main/examples/docq...
uv run examples/docqa/chat.py https://arxiv.org/pdf/2501.12948
Sample output here: https://gist.github.com/pchalasani/0e2e54cbc3586aba60046b621...https://gist.github.com/pchalasani/0e2e54cbc3586aba60046b621...
If you're just making calls to Anthropic's API can you really call yourself a platform?
I was skeptic about Perplexity but it has been my primary search engine for more than 6 months now.
LLMs with very little hallucination connected to internet is valuable tech.
{
"id": "msg_01P3zs4aYz2Baebumm4Fejoi",
"content": [
{
"text": "Based on the document, here are the key trends in AI/LLMs from 2024:\n\n1. Breaking the GPT-4 Barrier:\n",
"type": "text"
},
{
"citations": [
{
"cited_text": "I\u2019m relieved that this has changed completely in the past twelve months. 18 organizations now have models on the Chatbot Arena Leaderboard that rank higher than the original GPT-4 from March 2023 (GPT-4-0314 on the board)\u201470 models in total.\n\n",
"document_index": 0,
"document_title": "My Document",
"end_char_index": 531,
"start_char_index": 288,
"type": "char_location"
}
],
"text": "The GPT-4 barrier was completely broken, with 18 organizations now having models that rank higher than the original GPT-4 from March 2023, with 70 models in total surpassing it.",
"type": "text"
},
{
"text": "\n\n2. Increased Context Lengths:\n",
"type": "text"
},
{
"citations": [
{
"cited_text": "Gemini 1.5 Pro also illustrated one of the key themes of 2024: increased context lengths. Last year most models accepted 4,096 or 8,192 tokens, with the notable exception of Claude 2.1 which accepted 200,000. Today every serious provider has a 100,000+ token model, and Google\u2019s Gemini series accepts up to 2 million.\n\n",
"document_index": 0,
"document_title": "My Document",
"end_char_index": 1680,
"start_char_index": 1361,
"type": "char_location"
}
],
"text": "A major theme was increased context lengths. While last year most models accepted 4,096 or 8,192 tokens (with Claude 2.1 accepting 200,000), today every serious provider has a 100,000+ token model, and Google's Gemini series accepts up to 2 million.",
"type": "text"
},
{
"text": "\n\n3. Price Crashes:\n",
"type": "text"
},
I got Claude to build me a little debugging tool to help render that format: https://tools.simonwillison.net/render-claude-citationsThis looks like model fine tuning rather than after the fact pseudo justification. Do you agree?
For now. Until it starts providing citations for AI generated content.
Though a feature where AI could use all its knowledge to be able to tell whether a source if pulling the wool over its "eyes", would be massive.
Imagine being able to instantly verify what populist or those who pretend are not populist, politicians are saying.
You can try forcing it to output JSON, but that is not 100% reliable.
[1] https://github.com/anthropics/anthropic-cookbook/blob/main/t...