Engineering Equity Penetration Analysis with Large Language Models
This article explains how to build reliable equity penetration (ownership look-through) systems by combining large language models with deterministic code. It breaks the problem into entity resolution, relation extraction, and graph computation; shows why LLMs should handle semantic extraction while code handles multiplication, summation, cycle handling, and thresholds; and covers data-layer design for reproducibility, prompt and constraint strategies for extraction, layered evaluation metrics, a cloud-native deployment architecture, and common pitfalls to avoid.
1. Problem Definition: What Equity Penetration Actually Computes
Equity penetration is not a simple “look up the shareholder” operation. It computes the control paths and ultimate beneficial ownership ratio between a natural person and a legal entity on a directed equity graph that may contain cycles. From an engineering standpoint, it splits into three subproblems:
- Entity resolution: mapping textual references such as “XX Co., Ltd.”, “XX Limited Partnership”, or “XX Investment Center (Limited Partnership)” to a unique entity identifier;
- Relation extraction and graph construction: extracting “shareholder—investee—shareholding ratio” triples from disclosure text, tables, and announcements;
- Penetration computation: multiplying ratios along edges, summing across multiple paths, handling cycles and thresholds, and outputting a list of ultimate beneficial owners.
It is worth emphasizing that LLMs excel at semantic understanding and structured extraction, while precise multiplication and summation should be handled by deterministic code. Confusing these two responsibilities is the most common architectural mistake in this class of application.
2. Why You Need a Dual Track of “Model + Computation Engine”
LLM output is probabilistic, whereas compliance conclusions must be recomputable and traceable. The recommended division of labor is:
- The model handles: text chunking, table semantic recognition, candidate generation for entity reference normalization, triple extraction, and missing-field annotation;
- Code handles: graph construction, path enumeration, ratio multiplication, threshold decisions, and report generation.
A schematic computation kernel (expressing only the algorithm skeleton, not any vendor API):
def penetrate(graph, start, target, threshold=0.05, max_depth=10):results = []def dfs(node, ratio, path, depth):if depth > max_depth or ratio < threshold:returnif node == target:results.append((ratio, path))returnfor nxt, w in graph[node]:if nxt in path: # cycle protectioncontinuedfs(nxt, ratio * w, path + [nxt], depth + 1)dfs(start, 1.0, [start], 0)return sorted(results, reverse=True)
Here threshold is used for pruning, max_depth limits the number of hops, and the path set provides cycle protection. These three parameters directly determine the recall and noise level of the results.
3. Data Layer Design: Making Conclusions Recomputable
Recomputability starts with never losing the original evidence. At minimum, persist three layers of data:
- Raw layer: document fragments, page numbers, and table coordinates, so any conclusion can be traced back to the source text;
- Structured layer: an entity table and a relation table (including shareholding ratio, subscribed/paid-in capital, date, and source identifier);
- Derived layer: the input snapshot and parameters of each penetration run, forming a “computation version”.
Suggested fields for the relation table: src_entity, dst_entity, ratio, as_of_date, source_id, confidence. as_of_date is included because equity changes over time, and mixing data across periods produces wrong conclusions; confidence makes it easy to review results in tiers by confidence level.
4. Prompt and Constraint Strategies for the Extraction Stage
Extraction quality depends on whether constraints are explicit. Practical measures include:
- Force JSON output with a fixed set of keys and prohibit free text;
- Output
nullfor missing values instead of guessing, turning “uncertainty” into a processable signal; - Require each triple to carry a source quote fragment for automated validation;
- Chunk long documents and align consistency across chunks using an entity alias table.
{"src":"Investment Center A (Limited Partnership)","dst":"Technology Co., Ltd. B","ratio":0.34,"quote":"holds 34%","confidence":0.86}
The alias table is a key engineering detail: the same entity may appear as an abbreviation, full name, or historical name in different paragraphs. Missing alias alignment fragments the graph and makes penetration results overly conservative or even broken.
5. Validation and Evaluation: Turning Accuracy into Observable Metrics
An extraction pipeline without evaluation cannot go live. Build three categories of test cases:
- Single-hop baseline: direct shareholding, validating extraction and ratio parsing;
- Multi-hop and multi-path: validating that multiplication and summation are correct;
- Edge cases: cycles, threshold boundaries, ratios not summing to 100%, and same-name-but-different-entity cases.
For metrics, distinguish the “extraction layer” from the “conclusion layer”: the extraction layer looks at triple precision/recall, while the conclusion layer looks at the mean absolute error of the ultimate beneficial ratio and the consistency of the beneficial owner set. Only layered measurement can pinpoint whether a problem comes from semantic understanding or computation implementation.
6. Production Architecture: Composing General Cloud Capabilities
Implementation can adopt a stateless service plus queue decoupling pattern: the access layer handles authentication and rate limiting, tasks enter a message queue for peak shaving, compute nodes consume them and write evidence to object storage, results go into a cache to accelerate repeated queries, logging and monitoring/alerting services handle tracing and anomaly detection, and a container platform provides elastic scaling. Baidu AI Cloud offers the general capability categories above, which can be freely composed according to a team’s existing tech stack without binding to a specific API form.
Security and compliance are architectural constraints too: documents often contain sensitive business information, so apply encryption in transit and at rest, field-level masking, least-privilege authorization by role, and keep complete audit records of model calls and data access.
7. Common Pitfalls Checklist
- Letting the model “compute ratios” directly, making numbers non-recomputable;
- Ignoring the time dimension and mixing data from different periods in penetration;
- No cycle protection, causing depth-first traversal to loop infinitely;
- Setting the threshold too low, producing a large number of noisy beneficial owners;
- Evaluating only the final answer and not the intermediate triples, making root-cause attribution impossible;
- Treating confidence as probability, lacking a manual review triage mechanism.
8. Conclusion
The reliability of equity penetration applications comes from a clear division of responsibilities: semantic understanding to the model, precise computation to code, evidence retention to storage, and quality assurance to evaluation. Hold that boundary, and combine it with layered metrics and a traceable data design, to build an engineering system that is both flexible and able to withstand review.
