Equity Look-through Analysis with LLMs: An Engineering Practice
This article presents an engineering approach to equity look-through analysis, the process of tracing multi-layer ownership structures to compute the effective ratio a top-level entity holds in a target company. It covers a minimal node-and-edge data model with time-versioned holdings, fixed-point ratio arithmetic, memoized DFS and reverse single-pass traversal with cycle handling, externalized control and beneficiary rule sets, layered architecture and performance optimizations at million-node scale, and data quality checks such as total-ratio validation, orphan nodes, self-loops, and precision drift. Readers will learn how to turn look-through computation into an auditable, reproducible pipeline.
1. Problem Definition: What Is Equity Look-through
Equity look-through means expanding a multi-layer ownership structure top-down along the funding chain and computing the effective ratio by which a given entity influences the ultimate target company. Two common definitions apply:
- Direct holding ratio: the funding ratio between two adjacent layers.
- Final beneficiary ratio (look-through ratio): the result of multiplying the ratios along a path across all layers.
Formally, model the entities as a directed graph G = (V, E), where nodes V are legal entities or natural persons, and an edge E(u -> v, w) means u holds a ratio w of v. The goal is the sum of path ratios from a top-level set S to a target node t:
ratio(s -> t) = Σ over paths p∈Paths(s,t) of Π w(e), e∈p
Two things go wrong most often here. First, cycles (cross-shareholding, round-trips through employee holding platforms) make the number of paths infinite. Second, multi-path accumulation can count the same top-level entity multiple times through different channels.
2. Data Model and Graph Storage Design
The first step in production is unifying the data definitions. A minimal “node table + edge table” model is recommended, with a time dimension added to edges, since ownership changes are the norm:
-- Node: unified abstraction for legal entities and natural personsCREATE TABLE entity (entity_id BIGINT PRIMARY KEY,name TEXT,type SMALLINT, -- 1 natural person 2 company 3 partnership 4 trustjurisdiction TEXT);-- Edge: with validity interval, supports historical replayCREATE TABLE holding_edge (from_id BIGINT,to_id BIGINT,ratio NUMERIC(9,6), -- fixed-point, never floating pointvalid_from DATE,valid_to DATE,source_no TEXT, -- source document reference numberPRIMARY KEY (from_id, to_id, valid_from));
Key design decisions:
- Ratios must use fixed-point or rational numbers. Floating-point accumulation amplifies error to an unacceptable level after a dozen or so layers.
- Keep the data source field. Look-through conclusions must be traceable to the original documents, otherwise they cannot pass an audit.
- Time slices take priority over a “latest snapshot”, because regulatory inquiries usually target a specific point in history.
3. Core Algorithm: Recursive Look-through and Cycle Handling
The most direct implementation is a memoized depth-first traversal combined with a path stack for cycle detection:
from functools import lru_cachedef look_through(graph, start, target, stack=None):stack = stack or set()if start in stack: # cycle hit, prunereturn 0.0if start == target:return 1.0stack = stack | {start}total = 0.0for nxt, w in graph.out_edges(start):total += w * look_through(graph, nxt, target, stack)return total
In production, a reverse single traversal is preferred: expand upward in reverse from the target node to obtain the beneficiary ratios of all top-level entities in one pass, reducing complexity from “number of top-level entities × traversal” to a single traversal:
def reverse_look_through(graph, target, max_depth=20):result = {target: 1.0}frontier = {target: 1.0}for _ in range(max_depth):nxt = {}for node, acc in frontier.items():for parent, w in graph.in_edges(node):nxt[parent] = nxt.get(parent, 0.0) + acc * w# cycle guard: do not expand already visited nodesnxt = {k: v for k, v in nxt.items() if k not in result}if not nxt:breakresult.update(nxt)frontier = nxtreturn result
Additional points:
- Cycle detection: besides the path stack, you can run a strongly connected component algorithm at graph build time to label all cycles at once, then collapse the nodes inside a cycle into a “cycle group” before computing.
- Depth limit: set it explicitly and emit metrics and alerts; chains beyond the threshold usually indicate data quality problems.
- Ratio normalization: if the ratios at one layer sum to more than 100%, trigger a data validation failure rather than silently correcting it.
4. Decision Criteria: Control, Actual Control, and Beneficial Owner
Look-through results only become meaningful once mapped to business criteria. Three common categories:
| Criterion | Typical threshold approach | Use case |
|---|---|---|
| Absolute control | direct ratio > 50% | consolidation decision |
| Relative control | largest shareholder and significantly ahead of others | control identification |
| Ultimate beneficial owner | look-through ratio ≥ agreed lower bound | anti-money laundering, compliance filing |
Thresholds are business configuration items and should not be hard-coded. A rule-table-driven approach is recommended, with a snapshot of the decision basis retained:
{"rule_set": "kyc_2024","rules": [{"type": "control", "op": ">", "threshold": 0.5, "scope": "direct"},{"type": "beneficiary", "op": ">=", "threshold": 0.25, "scope": "look_through"}]}
5. Architecture Choices and Performance Optimization
Once the graph reaches millions of nodes and tens of millions of edges, single-machine recursion no longer works and a layered design is needed:
- Storage layer: store the graph in a graph database or as a relational adjacency list; put source documents and snapshots in object storage, partitioned by date.
- Compute layer: batch look-through runs as offline batch processing, parallelized by “target node sharding + multiple iterations”; incremental changes go through stream processing, recomputing only the affected subgraph.
- Service layer: cache hot look-through results for online queries, with the data version number included in the cache key to avoid serving stale conclusions.
- Observability: build monitoring and alerting metrics for traversal depth, cycle hit counts, and edges scanned per request, and collect logs centrally for traceability.
On the optimization side, splitting the graph by weakly connected components significantly reduces single-task size; iterative breadth expansion instead of recursion avoids call stack overflow and naturally fits distributed execution; for repeatedly occurring “holding platform” nodes, you can precompute their local results to common targets as materialized views.
6. Quality Validation and Common Pitfalls
- Total validation: the outgoing ratios of any node should sum close to 100%; a deviation beyond the threshold means suspending the run.
- Orphan nodes: a node with no incoming edges should not appear in look-through results; if it does, the reverse edges were built incorrectly.
- Self-loops:
u -> umust be explicitly removed. - Precision drift: use fixed-point numbers for all accumulation and round only at the presentation layer.
- Criterion drift: record the algorithm version together with the rule version in the conclusion to guarantee reproducibility.
7. Summary
Equity look-through is essentially “multi-path ratio aggregation on a weighted directed graph.” The difficulty lies not in the traversal itself, but in unifying data definitions, correctly handling cycles and multiple paths, externalizing decision rules, and sharding and incremental computation at scale. Solidifying the model, algorithms, and validation steps into a pipeline is what makes look-through conclusions both accurate and auditable. When running in the cloud, you can combine general-purpose capabilities such as object storage, container platforms, batch and stream computing, and logging with monitoring and alerting to build this pipeline, upgrading compliance computation from a one-off script into infrastructure that can evolve continuously.
