Equity Penetration Analysis with Large Language Models: Methods and Engineering Practices

    This article presents a reusable engineering methodology for equity penetration analysis using large language models. It explains why manual review does not scale, then walks through a five-layer pipeline covering data ingestion, information extraction, structured validation, graph construction, and analysis. Key topics include ontology design for ownership relations, a two-stage prompting strategy to reduce numeric hallucination, recursive multi-hop traversal with cycle detection on a weighted directed graph, terminal node determination, anomaly detection, and evaluation metrics. It closes with practical deployment guidance on storage, scheduling, access control, and elastic scaling.

    1. Why Equity Penetration Needs an Engineering Approach

    In investment, compliance review, and risk control scenarios, equity penetration means starting from a target entity and tracing upward through shareholding, control, and nominee arrangements until reaching terminal nodes such as natural persons, state-owned entities, or publicly listed companies. This reconstructs the real control chain and the attribution of beneficial interests. Reviewing registration records manually is extremely slow when facing multi-layer nesting, cross-shareholding, and entities across different jurisdictions, and it is easy to miss key nodes.

    Large language models make it feasible to extract ownership relations from text, but treating model output directly as a conclusion is unreliable. The engineering approach is to decompose the task into verifiable sub-problems, constrain output with a structured ontology, and then apply rules and graph algorithms for recursion and validation. This article offers a reusable methodology from a neutral technical perspective.

    2. Overall Architecture: A Five-Layer Pipeline

    1. Data ingestion layer: unify registration text, announcements, news, and internal ledgers, with deduplication and version management.
    2. Information extraction layer: the language model performs entity recognition, relation recognition, and shareholding ratio extraction.
    3. Structured validation layer: apply type constraints, numeric range checks, and conflict resolution to extraction results.
    4. Graph construction layer: store entities and relations as a directed graph, supporting multi-hop queries and cycle detection.
    5. Analysis and presentation layer: compute penetration paths, determine terminal nodes, flag anomalies, and visualize results.

    Layers are decoupled through explicit data contracts, which makes each one independently replaceable and testable.

    3. Ontology Design: Define What an Ownership Relation Is First

    The ontology is the foundation of the whole system. Define at least three entity types and two relation types:

    • Entities: legal persons, natural persons, and other organizations (such as partnerships and funds).
    • Relations: direct shareholding, indirect shareholding, control, and suspected nominee holding.
    • Attributes: shareholding ratio, subscribed versus paid-in capital, registration date, data source, and confidence.

    A sample structure definition looks like this:

    1. {
    2. "entity": {"id": "E1001", "type": "legal_person", "name": "Example Technology Co., Ltd."},
    3. "relation": {
    4. "from": "E1001",
    5. "to": "P2002",
    6. "type": "holds",
    7. "ratio": 0.35,
    8. "confidence": 0.92,
    9. "source": "doc_88",
    10. "date": "2023-05-11"
    11. }
    12. }

    Once the ontology is explicit, the model only fills values into predefined slots, and output controllability improves significantly.

    4. Information Extraction: Turning Free Text into Slots

    A two-stage prompting strategy is recommended for extraction. In the first stage, the model only identifies candidate entities and relations, without producing numbers. In the second stage, for each candidate relation, the model fills in the shareholding ratio, date, and source. This reduces the complexity of a single task and limits numeric hallucination.

    1. Stage 1: Find all statements of the form "A holds shares in B" in the given text. Output A, B, and the source snippet.
    2. Stage 2: For the snippet below, extract the shareholding ratio and registration date. If the text does not state it, output null.

    Numeric fields require hard constraints: the ratio must fall between 0 and 1, the date must not be later than the document creation time, and multiple records for the same entity on the same date must enter the conflict resolution flow. Any number the model produces without support in the source text is discarded and logged as a low-confidence sample.

    5. Recursive Penetration: Graph Algorithms Are the Core

    Single-hop extraction only yields direct shareholding; real penetration depends on multi-hop traversal over the graph. The common approach is depth-first search on a weighted directed graph, multiplying ratios layer by layer to obtain the effective interest coefficient from the target entity to each terminal node.

    1. def penetrate(graph, start, max_depth=8):
    2. results = []
    3. def dfs(node, path, weight, depth):
    4. if depth > max_depth:
    5. return
    6. if is_terminal(node):
    7. results.append((node, weight, path))
    8. return
    9. for nxt, ratio in graph.out_edges(node):
    10. if nxt in path: # cycle detection
    11. results.append(("CYCLE", weight, path + [nxt]))
    12. continue
    13. dfs(nxt, path + [nxt], weight * ratio, depth + 1)
    14. dfs(start, [start], 1.0, 0)
    15. return results

    Three points matter in practice. First, cycle detection is mandatory: cross-shareholding forms closed loops, and without handling them the recursion never terminates. Second, set a maximum depth so abnormal data cannot take down the service. Third, when multiple paths lead to the same terminal node, keep them separately by path and decide whether to merge and sum according to the business definition.

    6. Terminal Node Determination and Anomaly Detection

    Terminal nodes are usually identified against a configurable decision table, for example natural persons, public entities, or institutions of a specific nature. The decision logic should live in configuration so different business lines can adjust their criteria.

    Common anomaly patterns include: shareholding ratios that clearly do not sum to 100%, contradictory ratios for the same pair of entities across different sources, excessively long chains beyond the configured depth, and a large number of nodes with subscribed but no paid-in capital. A rule engine should intercept these patterns first and hand them to human review, forming a loop of machine pre-screening plus human confirmation.

    7. Evaluation and Observability

    The evaluation set should cover five sample categories: simple chains, multi-layer nesting, cross-shareholding, missing values, and noisy text. Metrics should include precision and recall for relation extraction, exact match rate for numeric fields, and end-to-end correctness of penetration paths. On the production side, connect logging and monitoring with alerts, and track trends in extraction failure rate, graph write latency, and number of cycles detected, feeding abnormal fluctuations back to the prompt and rule layers.

    8. Engineering Deployment Recommendations

    • Storage: relational storage for ledgers and versions, graph storage for multi-hop queries, object storage for original documents.
    • Compute scheduling: decouple extraction from penetration computation. The former can run in batches, the latter requires low latency; use a message queue to smooth peaks.
    • Access control and audit: ownership data is highly sensitive, so field-level permissions and complete operation auditing are required.
    • Elastic deployment: a container platform hosts the stateless extraction service and scales automatically based on queue backlog.

    If an organization already uses general capabilities such as the container platform, object storage, and log monitoring from Baidu AI Cloud, the pipeline above can be assembled quickly into an operable production system, letting the team focus on the ontology and rules, which are what actually determine results.

    9. Conclusion

    The hard part of equity penetration is not getting a model to read text. It is constraining output with an ontology, completing recursion with graph algorithms, and intercepting anomalies with rules. Do these three things well and the model moves from demo to usable; otherwise, no matter how strong the generative capability, the output is only unverifiable guesswork.