Case study · AI engineering, Instrumental Partners · 2026
Company intelligence with a knowledge graph and RAG
A US aerospace and defense electronics manufacturer kept hundreds of customers, vendors and competitors in spreadsheets, with no picture of how they connect: who competes with whom, who bought whom, which names are the same company. I built a knowledge graph and a RAG layer that answer those questions with sources attached.
- Context
- Instrumental Partners · client confidential
- Graph
- ~17k nodes · ~22k relationships
- Stack
- Python · Neo4j · FastAPI · LLMs
Sources
The graph starts from the client's own lists (238 customers, 606 vendors and 83 competitors) and grows from public data: SAM.gov firmographics and the SAM Entity API, SEC EDGAR filings, Apollo.io, news from RSS feeds and GDELT, and company websites crawled with trafilatura.
Extraction you can audit
An LLM reads each source and proposes typed relationships such as supplies, acquired or competes with. A relationship only enters the graph if the model quotes the sentence that supports it and that quote appears verbatim in the source. Model output is forced into a JSON schema, so free text never gets stored as a fact.
Company names are the hard part. Resolution goes roster first: known alias, then slug, then a fuzzy match of 95 or above, then a closed-set LLM choice among real candidates. When none of those works, the system declines to link. Rules then infer second-tier suppliers, competitors that share customers, and parent-company rollups. Inferred edges are drawn dashed and carry the rule that created them plus a confidence score, so an inference is never mistaken for a sourced fact.
Reports and Q&A
Report sections are defined in YAML and can draw on the graph, on vector search, or on both. The output is a cited Markdown or Word report per company, and contacts export straight to the CRM. Embeddings live in a Neo4j HNSW index.
Running it cheaply
Development ran on a local Gemma model through Docker Model Runner on an 8 GB laptop GPU. Production runs on a small AWS EC2 instance with Neo4j AuraDB, GitHub Actions and a login gate, and calls gpt-4.1-mini for extraction. The deployed graph holds about 10,100 companies and 6,800 sources, roughly 17,000 nodes and 21,700 relationships. The full development graph, with every part each supplier is approved for, reached 855,000 nodes and a million edges. That is about four times what the hosted tier allows, so production keeps the company layer only.
Known limits
The small local model sometimes mistakes product names for companies, and long pages are cut off at extraction because there is no chunking yet. Both are documented, and the evidence check keeps most of these errors out of the graph.