Equity Penetration Analysis with Large Language Models: A Technical Practice

    This article explains how to automate equity penetration analysis by modeling ownership structures as directed weighted graphs. It covers node and edge modeling, recursive traversal with cycle detection, direct versus ultimate beneficial ownership calculation, data governance across multiple sources, and result validation and visualization. Readers will learn the core engineering steps needed to trace multi-layer ownership and produce reliable compliance and investment research results.

    1. Background: Why Equity Penetration Needs Engineering

    In scenarios such as equity investment, compliance review, supply chain due diligence, and risk monitoring, teams often need to answer a deceptively simple question: what ownership relationship exists between a natural person and a target entity, and what is the ultimate beneficial percentage? Although the original material discussed a model product’s version iterations and market performance, the technical problem worth abstracting is how to automate penetration through multi-layer nested ownership structures.

    Manually checking business registration records and comparing shareholder lists layer by layer is manageable when the structure is shallow. Once ownership exceeds five layers and involves cross-shareholding, circular capital contributions, or multi-layer nested limited partnerships, manual work becomes slow and error-prone. Equity penetration therefore needs to be treated as an engineering problem that combines graph computation with a rule engine.

    2. Core Modeling: Representing Ownership as a Directed Weighted Graph

    The first step is modeling. The common industry approach treats each legal entity, natural person, and partnership as a node, and treats “Party A holds x% of Party B” as a weighted directed edge from A to B.

    1. Node: { id, name, type (person/entity/partnership), registration location }
    2. Edge: { from, to, holding ratio, subscribed amount, paid-in amount, data source }

    Three points need attention during modeling:

    1. Node type determines the termination condition for penetration. Natural persons, listed companies, and state-owned entities usually serve as endpoints and are not traced further upward.
    2. Edge weight definitions must be consistent. Subscribed and paid-in ratios may differ, so both should be retained on the edge, with the calculation explicitly using one of them.
    3. Every edge should carry its data source and update time to support auditing and traceability.

    3. Traversal Algorithm: Recursive Penetration and Cycle Detection

    Penetration means starting from the target entity and performing a depth-first traversal along the shareholder direction until an endpoint node is reached. Example code:

    1. def penetrate(node, visited, ratio=1.0, result=None):
    2. if result is None:
    3. result = {}
    4. if node in visited: # circular holding protection
    5. return result
    6. visited = visited | {node}
    7. for shareholder, weight in graph[node].holders():
    8. path_ratio = ratio * weight
    9. if is_terminal(shareholder):
    10. result[shareholder] = result.get(shareholder, 0) + path_ratio
    11. else:
    12. penetrate(shareholder, visited, path_ratio, result)
    13. return result

    Circular holdings must be handled in production. A structure where A holds B and B holds A is not uncommon. Without a visited set, recursion will expand indefinitely. In addition to cycle detection, a maximum recursion depth threshold should be set to prevent stack overflow caused by abnormal data.

    4. Ratio Calculation: Direct and Ultimate Beneficial Ratios

    Penetration results usually include two metrics:

    • Direct holding ratio: the original ratio in a single-layer shareholder list;
    • Ultimate beneficial ratio: the ratio obtained by multiplying along each path and then summing by endpoint node.

    It is important to note that the same natural person may hold stakes indirectly through multiple paths. The ultimate beneficial ratio should be the sum of contributions from all paths, not the value of a single path. This is also what manual comparison most easily misses.

    5. Data Governance: Multi-Source Collection and Quality Checks

    The reliability of penetration results is capped by data quality. Common practices include: periodically synchronizing shareholder lists from public registration sources; standardizing names to resolve entity alignment issues caused by full names, abbreviations, and historical renames; validating ratio fields by range to remove records above 100% or clearly abnormal; and retaining version snapshots so any historical point in time can be recalculated.

    For cloud deployment, a combination of general-purpose capabilities can be used: object storage for snapshot files, a message queue for incremental changes, a container platform for compute tasks, and logging and monitoring with alerting for task observability. Similar general-purpose capabilities offered by cloud providers such as Baidu AI Cloud can typically be combined in the same way.

    6. Result Validation and Visualization

    After penetration, three checks are recommended: first, conservation validation, where the sum of endpoint ratios should match the theoretical value; second, sampled manual review, focusing on multi-layer nested paths; third, visualization, using a layered directed graph to show the chains and highlighting cycles, overly long paths, and abnormal ratios so business users can judge quickly.

    7. Summary

    Equity penetration may look like a query problem, but it is a combined engineering effort involving graph modeling, recursive traversal, rule constraints, and data governance. Only by modeling correctly, handling cycles properly, unifying ratio definitions, and controlling data quality can penetration results truly support compliance and investment research decisions.