Building an Investment Knowledge Graph with AI: Architecture and Engineering Practices
This article walks through a practical architecture for turning a large, scattered corpus of shareholder letters into a computable investment knowledge graph using AI. It covers a four-layer processing pipeline and a three-layer knowledge model, engineering practices for idempotent batch translation with three-stage quality validation, entity extraction and disambiguation strategies that keep evidence and confidence on every triple, and a hybrid retrieval pattern that combines vector recall with graph traversal. It also explains how to publish the knowledge base as a crawlable static site and highlights several counterintuitive findings about self-correction, concept emergence, and collaborator influence. Readers will get a reusable checklist for building a knowledge base that keeps growing.
1. The Starting Problem: High-Value Text Is Naturally Scattered
Collect the letters a long-term capital allocator wrote to shareholders over more than seventy years, and you get a corpus of extremely high information density. It covers nearly the full chain of business analysis, capital allocation, risk perception, and self-correction. But this kind of material has an obvious natural weakness: it spans a long time, the text volume is huge, terminology evolves across decades, and the same concept is expressed differently in different years. Readers struggle to build a stable mental index.
The traditional approach relies on manual close reading and note-taking, and it has three problems. First, throughput is low: processing letter by letter takes weeks or even months. Second, structure is missing: notes stay isolated from one another and cannot form a jumpable citation network. Third, retrieval is weak: finding “the judgment made about a certain type of business in a given year” depends on memory.
So the real technical goal is not “turning foreign text into Chinese.” It is converting linear text into a graph structure that is computable, linkable, and able to evolve incrementally.
2. Overall Architecture: A Four-Layer Pipeline and a Three-Layer Knowledge Model
A robust implementation can be split into a four-layer processing pipeline and a three-layer knowledge model.
The four pipeline layers:
- Collection and normalization: unify everything into plain text or structured documents, preserving metadata such as year and sequence number.
- Parsing and chunking: recursively split by section, subheading, and paragraph, control block size, and keep an overlap window.
- Translation and alignment: batch translate, then run terminology consistency and number consistency checks.
- Extraction and loading: identify concepts, entities, people, and events, then write them into the graph structure and a vector index.
The three knowledge model layers:
- Concept layer: investment and financial concepts such as margin of safety, circle of competence, retained earnings, float, buybacks and issuance, and agency costs.
- Entity layer: profiles of the business entities under discussion, including the industry they belong to, their timeline, key judgments, and outcomes.
- People layer: key participants and the evolution of their views, used to capture relationships where ideas influence one another.
Edges such as “a letter — mentions — a concept,” “an entity — belongs to — an industry,” and “a person — proposes/revises — a concept” connect the three layers. Only then does knowledge gain the ability to flow.
3. Engineering Batch Translation: Constraining Throughput and Quality at the Same Time
When batch processing long documents, design tasks to be idempotent and resumable from a checkpoint. Each chunk carries a stable identifier, so repeated runs produce no duplicate data.
def build_tasks(chunks):tasks = []for c in chunks:tasks.append({"id": c.doc_id + ":" + str(c.seq), # Stable primary key for idempotency"year": c.year,"text": c.text,"status": "pending"})return tasks
Quality control cannot rely on a single generation pass. It needs three layers of validation:
- Terminology consistency: maintain a glossary and use fixed translations for core concepts, avoiding multiple Chinese renderings of the same concept.
- Number and year re-checking: amounts, ratios, and years are high-risk fields and must be compared against the source text at the regex level.
- Semantic completeness: check paragraphs for truncation, missing translation, and duplication, and re-translate a second time when necessary.
In engineering terms, split “translation” and “validation” into two independent stages. The former pursues parallel throughput; the latter pursues accuracy. A state machine connects the two, and failed tasks automatically return to the queue.
4. From Text to Graph: Extraction Strategy and Disambiguation
The hard part of entity extraction is not recognition but disambiguation and merging. The same business entity may go by different names in different years, and different entities may share similar names. A workable strategy is “rules first, model as fallback”:
- First, use a dictionary and regex to lock down person names, organization names, and financial metrics.
- Then, use a model to extract concept mentions and relation triples.
- Finally, merge: judge similarity based on context features and the year of appearance. When similarity falls below the threshold, keep the item as a candidate for human confirmation.
A sample triple structure:
{"subject": "letter-1977","predicate": "mentions_concept","object": "margin_of_safety","evidence": "source snippet location","confidence": 0.86}
Keeping the evidence snippet is essential. It makes every edge traceable and prevents the graph from degrading into a set of unverifiable assertions.
5. Retrieval and Question Answering: Graph Structure and Vector Index as Complements
Pure vector retrieval is good at semantic similarity but poor at multi-hop reasoning. Pure graph queries are good at relational constraints but lack semantic generalization. Combining the two is more practical: the vector index handles candidate recall, and the graph structure handles constraints and expansion.
Query: How did the judgment on high-retained-earnings businesses evolve over a given period?Step 1: Vector recall of relevant letter chunks (Top-K)Step 2: Locate the concept node "retained earnings" from those chunksStep 3: Expand along "mentions_concept" edges, sorted by yearStep 4: Link entity nodes and output the timeline and changes in conclusions
This “recall — locate — expand — sort” pattern is reusable for many questions, including the evolution of a person’s views and the migration of judgments across industries.
6. Publishing: From a Local Knowledge Base to an Accessible Site
If the knowledge base can only be viewed on one machine, much of its value is lost. Make it static: generate a standalone page for every letter, every concept, and every entity, and connect the pages with relative links to form a crawlable site structure. Also generate index pages and a timeline view. If multiple people need access and long-term maintenance, you can use object storage to host static assets, a content delivery network to accelerate access, a container platform to host the dynamic query service, and logging plus monitoring and alerting to ensure availability. The whole process requires no binding to any specific vendor interface and can be completed with general product categories.
7. A Few Counterintuitive Observations
- Self-correction is more frequent than assumed: the share of judgment errors openly acknowledged in long-term public letters is far higher than outside impressions suggest. This argues for modeling “revision” as a first-class relationship in the knowledge base rather than as附属 information.
- Core concepts appear later than the practice: a widely cited analytical term formally appears in the text noticeably later than expected, even though the intellectual seed existed much earlier. Concept extraction must therefore distinguish “first appearance of the term” from “first appearance of the meaning.”
- Collaborator influence is underestimated: relationship analysis at the people layer shows that key collaborators shaped the judgment framework more deeply than most secondary accounts suggest. This only becomes quantifiable after the corpus is turned into a graph.
8. A Reusable Checklist
- Metadata first: year, sequence number, and source must be structured.
- Align the chunking strategy with the granularity of the questions you want to answer.
- Separate translation from validation, and maintain the glossary over the long term.
- Keep evidence and confidence on every triple.
- Build dual indexes: vector and graph.
- Prefer a static site first, and scale out dynamic services as needed.
- Bring “revision relationships” into the model so that the evolution of cognition becomes computable.
The learning advantage in the AI era is not letting a model finish reading the material for you. It is using intelligent coding tools and the general cloud capabilities offered by Baidu AI Cloud to build scattered text into a knowledge structure that keeps growing. The methods are mature; all that is missing is the impulse to start building.
