惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
I
Intezer
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Stack Overflow Blog
Stack Overflow Blog
Hacker News: Ask HN
Hacker News: Ask HN
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
T
Tor Project blog
C
Cybersecurity and Infrastructure Security Agency CISA
云风的 BLOG
云风的 BLOG
博客园_首页
V2EX - 技术
V2EX - 技术
T
Threat Research - Cisco Blogs
腾讯CDC
宝玉的分享
宝玉的分享
博客园 - 叶小钗
罗磊的独立博客
S
Securelist
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
Scott Helme
Scott Helme
博客园 - 司徒正美
W
WeLiveSecurity
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
NISL@THU
NISL@THU
N
News and Events Feed by Topic
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
大猫的无限游戏
大猫的无限游戏
K
Kaspersky official blog
IT之家
IT之家

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
No More Hallucinated Citations: A Domain-Specific RAG System with Ollama, ChromaDB and AI Agents
sep83 · 2026-05-11 · via DEV Community

TL;DR: I built a full-stack knowledge pipeline around a corpus of 2,514 academic PDFs focused on urban art. The system combines ChromaDB vector search, Ollama-powered semantic analysis, a FastAPI REST layer, and six AI agents (slash commands in Claude Code) that orchestrate research workflows end-to-end. The result: zero hallucinated citations, dense evidence-backed documents, and a workflow that scales to any specialized domain.


The Problem: LLMs Hallucinate Academic Citations

If you've ever used an LLM to help write a research proposal or academic paper, you've probably hit this wall: the model confidently produces author names, journal titles, and publication years — none of which exist.

The standard advice is "don't use AI for citations." But that advice ignores a better question: what if you gave the model an authoritative, queryable corpus instead of relying on its training data?

That's exactly what this system does.


The Stack at a Glance

PDFs (2,514 docs, 4 languages)
        │
        ▼
  [Ingestion Pipeline]
   pdfplumber → chunking → metadata extraction
        │
        ▼
  [Dual Storage]
   MariaDB (corpus.db) ──── ChromaDB (59,030 chunks)
   metadata + citations      vector embeddings
        │
        ▼
  [Analysis Layer]
   Ollama (self-hosted LLM) — semantic relevance scoring,
   research_hint generation, debate mapping
        │
        ▼
  [REST API — FastAPI]
   /search · /consulta · /fragmentos · /autores
   /debate · /translate · /recientes · /document/{id}
        │
        ▼
  [AI Agent Layer — Claude Code slash commands]
   /mapeador · /evidencia · /auditor · /propuesta · /articulo · /vigilante

Enter fullscreen mode Exit fullscreen mode

Everything runs locally. No data leaves the machine. The corpus, embeddings, LLM inference, and API are all self-hosted.


Part 1 — The Corpus

Ingestion

The corpus started with a focused collection of academic PDFs on urban art and graffiti: peer-reviewed articles, book chapters, conference proceedings, and policy documents spanning English, Spanish, Portuguese, and French.

Each document goes through a pipeline:

# Simplified ingestion flow
doc = extract_text_pdfplumber(pdf_path)
chunks = split_into_paragraphs(doc, max_tokens=512, overlap=64)

for chunk in chunks:
    metadata = extract_metadata(chunk)  # author, year, DOI, language
    embedding = embed(chunk.text)       # via Ollama nomic-embed-text
    chromadb.add(chunk.text, embedding, metadata)
    mariadb.insert(chunk, metadata)     # full text + APA citation

Enter fullscreen mode Exit fullscreen mode

The chunking strategy matters enormously here. Fixed-size token splitting loses paragraph context. Instead, I split on paragraph boundaries with a 64-token overlap between chunks, which preserves semantic coherence while keeping retrieval granular.

What Gets Stored

Each chunk in MariaDB carries:

Field Description
paragraph Full text of the chunk
page Page number in the original PDF
citation_apa Pre-formatted APA 7 citation
citation_mla Pre-formatted MLA citation
doc_id Unique document identifier
relevancia Ollama-assigned relevance score (1–5)
research_hint ≤240-char synthesis of the chunk's contribution
categoria_tematica Thematic category (e.g., graffiti_core, tecnologia)
anio Publication year
idioma Language code

The relevancia field is generated once at ingestion time by asking Ollama to score each chunk's relevance to the corpus domain. This pre-computation means searches can filter by quality without running LLM inference at query time.

Current State

Total documents:    2,514
Chunks in ChromaDB: 59,030
RAG coverage:       99.8%
Languages:          EN (62.3%), ES (14.3%), PT (12.7%), FR (2.7%), others

Enter fullscreen mode Exit fullscreen mode


Part 2 — The Retrieval Layer

Hybrid Search

A common mistake in RAG systems is relying solely on cosine similarity. Semantic similarity isn't the same as relevance — a chunk can be about the right topic but still be a weak citation (methodologically unsound, pre-2010, tangential argument).

The system uses a hybrid relevance_score that combines three signals:

relevance_score = (
    0.5 × cosine_similarity(query_embedding, chunk_embedding)
  + 0.3 × ollama_relevancia          # pre-computed quality score
  + 0.2 × recency_weight(year)       # normalized publication year
)

Enter fullscreen mode Exit fullscreen mode

This produces meaningfully different rankings from pure vector search — and in practice surfaces much better citations for academic use.

The API Endpoints

The FastAPI layer exposes the corpus as a set of purpose-built endpoints:

# Semantic search — fast, no LLM at query time
GET /search?q=urban+heritage+documentation&top_k=20&style=apa

# Full RAG — slower, synthesizes an answer with citations
POST /consulta
{
  "pregunta": "What methods exist for documenting ephemeral urban art?",
  "top_k": 10,
  "anio_desde": 2015,
  "idioma": "en"
}

# Verbatim fragments for direct quotation
GET /fragmentos?concepto=ephemeral+art+preservation&top_k=8

# Author and debate mapping
GET /autores?tema=digital+documentation+street+art
GET /debate?tema=vandalism+vs+heritage

# Export for bibliography sections
GET /search/export?q=graffiti+cultural+heritage&format=bib&top_k=100

# Translation of non-native-language chunks
POST /translate
{"paragraph": "...", "target_lang": "es"}

Enter fullscreen mode Exit fullscreen mode

Each endpoint returns structured data including paragraph, page, citation_apa, relevance_score, research_hint, and doc_id. The doc_id is critical — it makes every citation traceable back to a specific PDF page.

Example Response from /fragmentos

{
  "results": [
    {
      "paragraph": "Street art occupies a paradoxical position in urban space: simultaneously celebrated as cultural expression and prosecuted as criminal damage, its ephemerality is not accidental but constitutive of its meaning...",
      "page": 47,
      "citation_apa": "Brighenti, A. M. (2010). At the wall: Graffiti writers, urban territoriality, and the public domain. Space and Culture, 13(3), 315–332. https://doi.org/10.1177/1206331210365283",
      "relevance_score": 0.91,
      "research_hint": "Argues ephemerality is constitutive of street art's meaning, not a deficiency — critical for patrimony arguments.",
      "doc_id": "brighenti_2010_wall"
    }
  ]
}

Enter fullscreen mode Exit fullscreen mode

Notice the research_hint — this is Ollama's pre-computed synthesis of why the chunk matters, not just what it says. It's what makes the agent layer possible.


Part 3 — The Agent Layer

The real productivity multiplier isn't the API — it's the agents built on top of it.

Six Claude Code slash commands orchestrate the research workflow. Each agent is a Markdown file in .claude/commands/ that instructs Claude Code to call the corpus API in a specific sequence and produce structured output files.

The Agent Map

/vigilante   — session start: check deadlines, detect new corpus documents
/mapeador    — map the corpus for a topic (calls /autores + /debate + /search ×2 + /consulta ×2)
/evidencia   — build an evidence table for a specific section
/propuesta   — full proposal generator (orchestrates mapeador + evidencia + redaction)
/articulo    — full IMRAD academic article generator
/auditor     — audit any .md file, classifying claims as [✓ VERIFIED] / [⚠ WEAK] / [✗ PENDING]

Enter fullscreen mode Exit fullscreen mode

The /mapeador Agent — Eliminating 6 Manual API Calls

The most impactful agent. Before it existed, mapping the corpus for a new topic meant manually calling six endpoints, collecting outputs, and synthesizing them into a coherent picture. With /mapeador, one command does all of this:

/mapeador "ephemeral urban art documentation" B

Enter fullscreen mode Exit fullscreen mode

The agent:

  1. Calls GET /autores?tema=... — maps the key authors and schools of thought
  2. Calls GET /debate?tema=... — surfaces competing positions
  3. Calls GET /search?q=...&top_k=20 with two different query formulations
  4. Calls POST /consulta twice with methodologically distinct questions
  5. Synthesizes all results into mapa-corpus-<slug>.md

Output structure:

# Corpus Map — Ephemeral Urban Art Documentation

## Key Authors
- Brighenti (2010) — territoriality and ephemerality
- Iveson (2010) — public space and street art legitimacy
...

## Academic Debate
Position A: Documentation preserves — [corpus evidence]
Position B: Documentation alters meaning — [corpus evidence]
...

## Evidence Bank (top 20 sources)
| citation_apa | relevance_score | research_hint |
|---|---|---|
...

## State of the Art Synthesis
[Generated by Ollama via /consulta — 400-600 words, cited]

## Identified Gaps
- [PENDING — no corpus support]: ...

Enter fullscreen mode Exit fullscreen mode

This takes about 3 minutes and replaces what used to be 45–90 minutes of manual API work.

The /auditor Agent — Zero Hallucinations Guarantee

After any document is written, /auditor runs through every substantive claim and classifies it:

/auditor propuestas/minciencias/2026-grafpin/propuesta.md

Enter fullscreen mode Exit fullscreen mode

Output example:

## Audit — 2026-05-10

| Claim | Endpoint Checked | Status | Note |
|---|---|---|---|
| "Street art is recognized as intangible cultural heritage in 12 countries" | /search?q=intangible cultural heritage street art | [✗ PENDING] | No corpus support for "12 countries" |
| "Brighenti (2010) argues ephemerality is constitutive..." | /fragmentos?concepto=ephemeral constitutive meaning | [✓ VERIFIED] | relevance_score: 0.91, page 47 |
| "Computer vision achieves 87% accuracy in graffiti style detection" | /search?q=computer vision graffiti accuracy | [⚠ WEAK] | One source, pre-2018 |

Enter fullscreen mode Exit fullscreen mode

Rule: if more than 40% of claims are [✗ PENDING], the document doesn't ship. This single constraint eliminates hallucination from the research output.


Part 4 — Multi-Query RAG Strategy

One underrated technique in this system: always formulate 3–4 query variants before calling /consulta.

The same concept produces very different corpus results depending on phrasing:

queries = [
    "ephemeral art documentation methods",           # EN — technical angle
    "documentación arte urbano efímero patrimonio",  # ES — heritage angle
    "street art preservation digital archive",       # EN — infrastructure angle
    "graffiti documentation urban memory loss"       # EN — urgency angle
]

Enter fullscreen mode Exit fullscreen mode

Each formulation retrieves a different subset of the corpus. The agent layer handles this automatically — /mapeador uses two /search calls and two /consulta calls with different formulations, then merges the evidence.

The practical impact: query coverage increases from ~65% (single query) to ~92% (four-query merge) for complex topics.


Part 5 — Why This Applies to Any Domain

The urban art corpus is just one instantiation. The architecture generalizes completely:

Component What to change for a new domain
PDF corpus Replace with domain PDFs
Thematic categories Redefine categoria_tematica for your taxonomy
Ollama relevance prompt Update to score relevance to the new domain
Agent prompts Update the research questions in each slash command
API filters Add domain-specific facets (e.g., species, jurisdiction, drug_class)

I've seen this pattern applied to:

  • Legal research: case law corpora with jurisdiction and year filters
  • Medical literature: clinical trial PDFs with PICO-structure extraction
  • Policy analysis: government documents with agency and date filters

The key insight is that domain specificity is a feature, not a limitation. A general-purpose RAG system optimized for everything is often not great at any one thing. A corpus built around a specific domain, with relevance scoring tuned to that domain, produces dramatically better retrieval.


Challenges and Lessons Learned

1. Chunk size is a first-class design decision

Too small (< 200 tokens): loses context, retrieval precision drops.
Too large (> 700 tokens): embeds multiple ideas, relevance scores become noisy.
The sweet spot for academic text: 400–512 tokens with paragraph boundary alignment.

2. Pre-compute expensive operations at ingestion time

Running Ollama at query time for every search would make the system unusable. Pre-computing relevancia and research_hint at ingestion means query-time latency stays under 200ms for /search and under 8 seconds for the full /consulta RAG pipeline.

3. The citation must be traceable to a page

citation_apa without page and doc_id is not an academic citation — it's a claim. Storing both means every output of the system can be verified by opening the original PDF.

4. Agents need failure modes, not just success paths

When the corpus doesn't support a claim, the agents mark it [PENDING] rather than hallucinating support. This requires explicit prompting: "if you cannot find corpus evidence, write [PENDING — verify corpus] and do not fabricate a source."

5. Multi-language corpora need language-aware retrieval

Embedding models trained primarily on English produce lower-quality embeddings for Spanish and Portuguese text. Using nomic-embed-text (multilingual-capable) and adding language filters (idioma field) to all queries significantly improves cross-language retrieval.


Results

Since deploying this system:

  • Zero hallucinated citations in output documents (validated by /auditor on every deliverable)
  • Research proposal drafts in 3–4 hours vs. 2–3 days manually
  • Evidence density: 1.8 citations per paragraph on average (up from ~0.4 with manual research)
  • Corpus growth: The system accepts new PDFs at any time — ingestion takes ~30 seconds per document

What's Next

A few things on the roadmap:

  • Citation graph: linking documents by shared references to surface clusters of highly-cited foundational work
  • Temporal drift detection: alerting when a claim that was [✓ VERIFIED] against the corpus in 2024 now has contradicting evidence from 2025+ additions
  • Cross-corpus queries: combining this corpus with data from the Grafpin platform itself (geolocated urban art documentation) to answer questions that require both academic literature and empirical field data

The Core Idea

The goal was never to automate research. It was to make the evidence layer of research reliable.

LLMs are extraordinary at synthesis, argument construction, and adapting tone for different audiences. They are unreliable as bibliographic databases. The solution isn't to avoid LLMs — it's to give them a trustworthy, queryable knowledge base so they can focus on what they're actually good at.

A domain-specific RAG corpus, properly indexed and exposed through a well-designed API, changes the LLM's role from source of truth to engine of reasoning. That's a much better place for both the model and the researcher to be.


The system described here is operational and actively used for academic research on urban art preservation. The platform it supports, Grafpin, documents geolocated street art in cities across Latin America.

Stack: Python · FastAPI · ChromaDB · MariaDB · Ollama · Claude Code · pdfplumber