Equity Look-through Analysis with Large Language Models: A Technical Practice

    This article explains how to build a reliable equity look-through system, covering the problem as a weighted directed graph, data modeling with time intervals and source references, recursive path aggregation algorithms, four common correctness pitfalls, and engineering practices for verification and auditing. Readers will learn the core definitions, SQL and configuration patterns, and operational checks needed to produce reproducible and compliance-ready results.

    1. The Core Problem: Equity Look-through Is a Weighted Directed Graph

    Equity look-through means starting from an entity and traversing ownership relationships layer by layer, either downward or upward, until a termination condition is met, then collecting all related entities and their ultimate ownership ratios. It is often mistaken for “just querying a few more levels of data,” but it is essentially a reachability and path-aggregation problem on a weighted directed graph. It has four elements:

    • Vertices: legal entities, natural persons, limited partnerships, holding platforms, state-owned entities, and so on;
    • Edges: investment or holding relationships, directed from “shareholder to invested entity,” with the holding ratio as the weight;
    • Termination conditions: natural persons, listed companies, government entities, or a configured maximum depth;
    • Aggregation semantics: ratios along a multi-layer path must be multiplied, and ratios across multiple paths must be summed.

    Defining these four points—direction, weight, termination condition, and aggregation semantics—is the prerequisite for correctness in every implementation. In practice, many disputes over calculation standards are not algorithm errors but the result of these four points not being agreed upon in advance.

    2. Data Modeling: Turning Scattered Materials into Computable Structures

    2.1 Three Types of Data Sources

    1. Business registration data: shareholder registers, registered capital, subscribed and paid-in capital, and change records;
    2. Structured disclosures: the equity structure sections of bond prospectuses and annual reports;
    3. Unstructured materials: announcements and scanned audit reports, which require extraction followed by manual review.
    1. -- Entity table
    2. CREATE TABLE entity (
    3. entity_id BIGINT PRIMARY KEY,
    4. name VARCHAR(200),
    5. entity_type VARCHAR(20), -- COMPANY / PERSON / PARTNERSHIP / STATE
    6. is_listed BOOLEAN DEFAULT FALSE
    7. );
    8. -- Holding edge table (with time intervals to support historical look-back)
    9. CREATE TABLE holding_edge (
    10. src_id BIGINT, -- shareholder
    11. dst_id BIGINT, -- invested entity
    12. ratio DECIMAL(9,6),-- 0.000000 ~ 1.000000
    13. valid_from DATE,
    14. valid_to DATE,
    15. source_ref VARCHAR(100) -- material reference for auditing
    16. );

    Two easily overlooked design points: first, time intervals must be preserved; otherwise, it is impossible to answer “what the actual control relationship was at a given point in time.” Second, every edge must carry a source reference, so that look-through conclusions can be traced back to the original materials; otherwise, they cannot pass compliance review.

    3. Core Algorithm: From Recursive Queries to Path Aggregation

    3.1 Recursive Adjacency List (Most Practical for Small and Medium Scale)

    1. WITH RECURSIVE reach AS (
    2. SELECT dst_id AS node, ratio AS cum_ratio, 1 AS depth,
    3. ARRAY[src_id, dst_id] AS path
    4. FROM holding_edge
    5. WHERE src_id = :root AND valid_to IS NULL
    6. UNION ALL
    7. SELECT e.dst_id, r.cum_ratio * e.ratio, r.depth + 1,
    8. r.path || e.dst_id
    9. FROM holding_edge e
    10. JOIN reach r ON e.src_id = r.node
    11. WHERE e.valid_to IS NULL
    12. AND r.depth < :max_depth
    13. AND NOT (e.dst_id = ANY(r.path)) -- cycle pruning
    14. )
    15. SELECT node, SUM(cum_ratio) AS look_through_ratio
    16. FROM reach GROUP BY node;

    NOT (e.dst_id = ANY(r.path)) is required: cross-holdings within a group are extremely common, and without path-level deduplication, this leads to infinite recursion or an explosion of results.

    3.2 Why “Path Enumeration + Summation” Instead of “Node Deduplication”

    If only the maximum ratio for each node is kept, cases where the same underlying entity is held through multiple paths will be missed. The correct semantics are: for each endpoint, enumerate all acyclic paths, multiply ratios within a single path, and sum across paths.

    3.3 When the Scale Grows

    When the number of edges reaches the tens of millions, repeated computation in recursive queries becomes a bottleneck. At that point, switch to graph computing: first partition by connected components, then perform parallel traversal; materialize results for frequently queried entities and set an invalidation policy (recalculation triggered by equity change events).

    4. Four Correctness Pitfalls That Must Be Tested

    1. Cycles: cross-holdings must be explicitly pruned, and the number of pruned paths should be recorded as a data quality metric;
    2. Ratio basis: subscribed and paid-in capital, direct and indirect holdings must not be mixed;
    3. Look-through termination: whether to look through to natural persons and whether to treat listed companies as endpoints must be parameterized;
    4. Precision: multiplication produces long decimals, so use fixed-point numbers throughout and round only at the presentation layer.

    An illustrative set of calculation-standard parameters:

    1. {
    2. "max_depth": 8,
    3. "stop_at_person": true,
    4. "stop_at_listed": true,
    5. "ratio_basis": "PAID_IN",
    6. "min_ratio_threshold": 0.0001
    7. }

    The threshold is used to filter noisy paths, but results above the threshold should still retain the complete paths for manual judgment.

    5. Engineering Implementation and Result Verification

    • Storage: put the graph structure in a graph database or an adjacency list in a relational database; store original materials in object storage with versioning retained;
    • Computation: run batch jobs as containerized tasks, and delegate scheduling and retries to general-purpose task orchestration;
    • Observability: use a logging service to record the input parameters, elapsed time, and path count of each look-through; use monitoring and alerting to set thresholds for failure rate and latency;
    • Verification: perform sampled manual comparison; run conservation checks (the sum of ratios to all endpoints for the same entity should be consistent with its direct holding structure); run regression comparisons for incremental changes.

    On Baidu AI Cloud, all of the above capabilities can be implemented by combining general cloud product categories, without relying on any proprietary interfaces.

    6. Conclusion

    The engineering difficulty of equity look-through lies not in “querying deeply” but in unified calculation standards, controllable cycles, and auditable results. Only when the four elements are clearly defined, the time dimension and source references are incorporated into the model, and recursion or graph computing is used as the carrier, can look-through results be reproducible and usable for compliance.