Certificates of origin: document chunking for multilingual work

Review document chunking for multilingual work in Certificates of origin. Check document scope, failure paths and source evidence through controlled tests.

What the documents look like

Certificate-of-origin work serves import-country tariff treatment and customs clearance. A letter of credit is not a necessary constraint on this category, so one shipment can carry several materials from different sources at the same time: the client's customs clearance requirements, the commercial invoice, the packing list, and production cost records. The certificate application itself is a separate document again.

These materials do not share a language, a numbering system, or a field order. A Chinese-language application paired with an English invoice or a packing list in a third language is an ordinary situation. Submission happens once per shipment; in batch filing, several materials enter the processing flow together. A chunk boundary placed in the wrong position can make a retrieval result point at the wrong passage, and the consequence falls on the client's customs clearance, on preferential tariff treatment, or on amendment costs.

The materials must first be parsed into searchable text and then divided into semantically complete units. One group of source data can map to multiple indexes, and a hit on any one of those indexes recalls that group of source data, with the vector score taken as the highest score. Segmentation has to preserve the relationship between a conditional clause and the object it constrains, and between an explanatory sentence and what it refers to. Otherwise semantic retrieval can recall half of a condition. Full-text retrieval suits exact queries such as numbers, models, and proper nouns; semantic retrieval suits natural-language phrasing; hybrid retrieval merges the two paths through RRF. The reference limit is counted in tokens, and the minimum relevance score takes effect only in semantic retrieval or with result reranking. Neither of them performs any permission or entity isolation function. Libraries built on different vector models cannot be associated together; the identifiers must be checked first and non-matching ones excluded.

Assumed paper exercise sample: the source material reads, "Applicant: a trading company in East China; certificate object: portable computers under HS code 8471.30; origin determination basis: production records state that the main processes were completed domestically; filing date: 10 March 2025; quantity: 120 units." The proposed draft sentence is, "This batch of goods meets the origin rules and the certificate application may be submitted." The request awaiting a decision is, "Parse the above material into the library and build an index for multilingual retrieval." That request is a pending matter and does not constitute an authorization or an approval outcome.

Constraints at the document chunking step

Chunking sits between parsing and retrieval, and the constraints that matter here come from the material itself. A certificate application, an invoice, a packing list, and production cost records each have their own internal structure. The conditional clause that states an origin determination basis has to stay with the goods and the HS code it applies to. An explanatory sentence about a production process has to stay with the record it describes.

The reference limit governs how many tokens of content a single search may cite. The reason it is expressed in tokens rather than top k is that in a mixed library the chunk lengths differ widely, which makes top k results unstable. The minimum relevance score is a 0-1 value that filters out some low-relevance search results, and it applies only in semantic retrieval or when result reranking is used. It is a filtering threshold, not a final ordering rule. After question optimization, hybrid retrieval, image retrieval, or result reranking is enabled, the final result may pass through multi-path recall fusion and does not necessarily follow a single vector similarity ordering.

The search mode choice interacts directly with this material. Certificate numbers, HS codes, and model designations are exact queries that full-text retrieval handles well. Descriptions of production processes and origin rules are natural-language content that semantic retrieval handles well. Hybrid retrieval uses both and merges them with RRF. Question optimization performs referent resolution and question expansion before retrieval, which adds a model call and therefore usually increases overall latency; when the current question is already clear, or when response speed matters more, the decision to enable it can be made on observed results.

The vector storage structure is relevant to how indexes are organized. FastGPT uses the PostgresSQL PG Vector plugin as its vector retriever with an HNSW index, and PostgresSQL is used only for vector retrieval, while MongoDB handles other data access. In the MongoDB dataset.datas table, the vector source data is stored together with an indexes field that records the corresponding vector IDs as an array, so one group of data can correspond to multiple vectors. During retrieval, vectors are recalled first, then the vector IDs are used to find the source content in MongoDB; if they correspond to the same group of source data, the results are merged and the vector score takes the highest value.

Configuration and implementation checks

Configuration itemAssumed starting point for this exerciseReason for the choice and comparison method
Search modeHybrid retrievalThe material contains both numbers and natural-language description; compare the recall difference between semantic retrieval and full-text retrieval
Reference limitAssumed starting point of 2000 tokensAdjust after comparing with the actual material length; not an official default value
Minimum relevance scoreAssumed starting point of 0.5Compare with the score distribution of recalled results; takes effect only in semantic retrieval or reranking
Question optimizationNot enabled for nowA single-turn, already-clear question needs no referent resolution; compare latency and hits with it on and off
Segmentation basisSplit by certificate object and determination basisCompare whether the conditional clause and the constrained object remain in the same segment
Index statusManual check after ingestionUpload success, training completion, and index generation are separate states

Three common errors

  1. Treating upload success as retrieval already updated. Input: the material upload operation record. Comparison: whether the training state and the index generation state can be checked. Observable result: while the state does not show completion, the retrieval result cannot be taken as already reflecting the new content.
  2. Treating the minimum relevance score as a permission filter. Input: the proposed draft sentence and the sample material. Comparison: whether the returned content before and after filtering still belongs to the same retrieval scope. Observable result: filtering out low-scoring content is an ordering behavior and does not change the accessible scope.
  3. Associating libraries across different vector models. Input: the vector model identifiers of the two libraries. Comparison: whether the identifiers are consistent. Observable result: when the identifiers differ, exclude them and do not run a cross-library retrieval comparison.

How to verify the setup

  1. Input the sample source material and the proposed draft sentence, compare whether the conditional clause and the constrained object remain in the same segment after chunking, and observe the result: separation of the condition from its object means the condition is not met.
  2. Input three query types — a term, a number, and a natural-language question — compare whether the recalled passages from each point to the same certificate object, and observe the result: if the number query hits the wrong passage, adjust the segmentation or switch to full-text retrieval.
  3. Input an empty reference scope, compare how the downstream design handles an empty result, and observe the result: an empty result does not mean the rule was not matched; record the gap and check the training and index states.

This page addresses only certificate-of-origin filing, cross-border materials and multilingual retrieval, and document parsing and chunking. At operational handover, which materials, operations, and requests sit at which authorization state must be kept distinct: retrieval and forms are not authorization execution.