Factory Cut Metal Pricing from 4–8 Hours to 2–3 Minutes by Removing AI from the Arithmetic
Metal rolled-product requests go out to four or five mills, and the supplier that returns a commercial offer (KP) first wins the order, yet an estimator needs 4–8 hours to produce one. Developer Alexey Samartsev left the neural network to parse scans and slang, while Python calculates mass and price according to GOST. GPT-4o understated the weight of 300 m of channel beam by 41%, a 126,720 ₽ loss. Now a draft is ready in 20–30 seconds, and checking it takes about 2 minutes.
AI-processed from Habr AI; edited by Hamidun News
A request for rolled metal has a lifespan of just a few hours. The procurement officer at a construction site sends the specification to four or five mills at once and orders from whoever first returns a commercial offer (KP): a document with exact prices, weight and shipping dates. An estimator needs between four and eight hours to prepare such a calculation, and by then the deal has often already been signed with another supplier.
Developer Alexey Samartsev described on Habr how he cut that time to 2–3 minutes: 20–30 seconds to generate a draft KP plus about 2 minutes for an engineer to check it. The key is that AI was removed from the arithmetic. The neural network reads scans and slang, while ordinary code calculates weight and money.
The test below shows why he did not simply feed everything to ChatGPT.
Why a request is chaos, not a table
According to the author, about 90% of incoming requests are far from neat XML. They are blurred scans of a specification with a blue stamp over the text, phone photos of drawings, Excel files from subcontractors without article numbers, or messenger messages like "angle 100 mm, channel 16P — 300 metres." The estimator has to translate the slang into a standard name ("Channel 16P GOST 8240-97"), look up the mass per linear metre in a reference table, multiply, add 3–7% offcut allowance, check stock and price in 1C, add cutting, markup and taxes, and then assemble the form by hand. When 15 such specifications arrive in a day, the department is simply buried in routine work.
What the GPT-4o test showed
The author asked GPT-4o for the theoretical mass of 300 metres of 16P channel beam. The model produced a neat explanation with formulas and an answer of 2.50 tonnes.
According to GOST 8240-97, one metre of this channel weighs 14.20 kg, so the correct answer is 4.26 tonnes.
The understatement was 41.3%. At a price of 72,000 ₽ per tonne, the mill would have quoted 180,000 ₽ instead of 306,720 ₽, losing 126,720 ₽ on a single line item.
The author's explanation is that the model predicts plausible-looking numbers and may have substituted the weight of a neighbouring size, such as 10P at roughly 8.59 kg/m. This is one test, not statistics across many queries, but the example illustrates the risk clearly.
Three layers: who is responsible for what
The solution is built on a division of responsibilities.
Layer 1: language understanding. Scans are first aligned with OpenCV, and the blue channel of stamps is muted. A multimodal model then extracts the tables and, under a strict JSON schema, returns for each line item the product family, profile size, steel grade, quantity and units. The phrase "channel 16P — 300 metres" becomes an object with cut_length: null, because the cut length is not specified. The model does not invent the GOST number: it is filled in by code based on the family-plus-size combination.
Layer 2: calculation without neural networks. A Python module using the Decimal type takes the mass per metre from a local reference database, converts kilograms to tonnes, pulls stock levels and prices from 1C:ERP via REST API, and applies the markup. If the required steel grade is not in stock, the line item receives a requires_procurement flag. If a size is missing from the reference table, the code raises an error rather than making up a number.
Layer 3: a human in the loop. The system builds a draft KP in 15–20 seconds. Confidently recognised items with a full stock match are marked green. Disputed items, where a figure on the scan is illegible or the cutting is non-standard, are marked yellow, and the estimator spends about 30 seconds checking each one. After confirmation, the engine generates a PDF on the mill's letterhead, attaches it to the deal in Bitrix24 or AmoCRM, and sends it to the client.
Figures and caveats
The author compared the department's work on a sample of 350 specifications. Preparing a KP took 20–30 seconds for generation and about 2 minutes for review, instead of 4–8 hours. The client now receives a response within 10–15 minutes rather than the next working day.
The author estimates tonnage errors in manual calculation at 8–12% and in automated calculation at 0%, but this is the author's own claim without independent verification. A more accurate statement is that the arithmetic is deterministic, while the risks have moved to scan recognition and the completeness of the reference databases. The workload rose from 8–10 complex calculations a day to 200 specifications per shift without expanding staff.
For verification, the author has published a demo at samartsev.tech/kp.
What to take from this
The lesson reaches beyond metal rolled products. A language model is good at turning untidy text and scans into structure, but money, mass and units must be calculated by code. If you are building an agent for procurement, logistics or accounting, keep the LLM at the input, keep reference data and formulas separate, and surface uncertainty flags to a human. That way you avoid a neat but wrong number in a document with a stamp on it.
- Nov 21, 2026FDE job postings grew 4.6x in a year: what a forward deployed engineer actually does at the client's site
- Nov 21, 2026A swimming team captain handed ChatGPT three scheduled tasks and cut her routine work by a multiple
- Nov 21, 2026OpenAI GPT-6 Cyber Found About 35 Flaws in iPhone, Mac and Other Apple Devices
- Nov 21, 202622 Claude Agents Spent Six Weeks on Black Hole Problems — and Solved Two
Key Questions Answered
Why a request is chaos, not a table?
According to the author, about 90% of incoming requests are far from neat XML. They are blurred scans of a specification with a blue stamp over the text, phone photos of drawings, Excel files from subcontractors without article numbers, or messenger messages like "angle 100 mm, channel 16P — 300 metres." The estimator has to translate the slang into a standard name ("Channel 16P GOST 8240-97"), look up the mass per linear metre in a reference table, multiply, add 3–7% offcut allowance, check…
What the GPT-4o test showed?
The author asked GPT-4o for the theoretical mass of 300 metres of 16P channel beam. The model produced a neat explanation with formulas and an answer of 2.50 tonnes. According to GOST 8240-97, one metre of this channel weighs 14.20 kg, so the correct answer is 4.26 tonnes. The understatement was 41.3%. At a price of 72,000 ₽ per tonne, the mill would have quoted 180,000 ₽ instead of 306,720 ₽, losing 126,720 ₽ on a single line item.
What are the key details on Three layers: who is responsible for what?
The solution is built on a division of responsibilities. Layer 1: language understanding. Scans are first aligned with OpenCV, and the blue channel of stamps is muted. A multimodal model then extracts the tables and, under a strict JSON schema, returns for each line item the product family, profile size, steel grade, quantity and units. The phrase "channel 16P — 300 metres" becomes an object with cut_length: null, because the cut length is not specified.
Ship AI Faster with Founders, Engineers & Weekly Architecture Reviews
Inside Vibe Club (hamidun.com/club) — weekly live masterminds with Zhemal Khamidun, Tech Radar, full LMS access, and 370+ production Claude Code skills.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.