Cut-off translations are saved as if they were finished

A film reel unspools into a paper strip torn off halfway, and the torn page lies in an open drawer while a rubber stamp marks it with a check mark.

Cut-off answer Reported

A self-hosted video transcriber and translator that already retries empty answers from reasoning models.

≈ 30,000 tokens per 1,000 calls, for translation chunks that do not fit a reasoning model's output limit estimate

Estimates, not measurements. Every figure on this page is an estimate from reading the code, not a measurement of the app in use.

Repository
wendy7756/AI-Video-Transcriber
Commit audited
7f1c619
leanprompt version
0.1.0-dev.15
Audit date
Status
The maintainers have been told about this audit; no response yet.
Maintainers
the issue
How it ran
Unattended audit: nobody was asked during the run, so priority, volume and prices were left open; the questions for the owner are listed at the end.

A self-hosted transcriber that formats, translates and summarises videos through any OpenAI-compatible model, and already retries empty answers from reasoning models. An answer cut off at the output limit but not empty is still saved as if whole, with nothing logged. Figures are estimates from the code.

leanprompt read the code at commit 7f1c619 and found 0 places where its LLM calls could use fewer tokens, 2 the project already knows about, plus 2 other problems, not scored. Static score: 100 of 100 (an estimate from the findings, leaving out what the project already knows about). The code may have changed since.

Findings

No open findings.

Already known to the project

The project’s own issues, pull requests or docs already cover these, so they are not counted above and are left out of the static score.

  1. LP-GE-03 Output and thinking budgets that fit the task

    backend/summarizer.py:1095 · severity medium · saves prefill and generation · how often is assumed

    What happens. Section summaries are capped at 600 output tokens and transcript formatting at 4,000, and the cap includes a reasoning model's thinking. On a reasoning or hybrid model the first attempt often spends the cap thinking, comes back empty, and is sent again with double the cap.

    The change. Size the caps for reasoning models: raise the section-summary cap (for example to 2,000) and the formatting cap, or make the caps configurable next to the model id, so the first attempt can finish.

    Why it helps. Each empty first attempt pays for the whole prompt and the whole cap of output, then the retry pays again. The app already logs these retries (llm_client.py:43), which is the waste this finding counts.

    Already reported. Issue #52 (closed) traced empty answers from reasoning models to thinking that used up max_tokens; the fix in 7f1c619 retries an empty answer once with a doubled cap. The caps themselves stay as they were, and an answer that is cut off but not empty is not covered (see the note). https://github.com/wendy7756/AI-Video-Transcriber/issues/52

    Estimate about 80k output and 80k prompt tokens per 1,000 calls (estimate)

    Assumptions. a 30-minute talk makes about 18 calls: 7 formatting, 7 section summaries, 1 merge, about 3.5 translation; average call about 1,230 prompt and 790 output tokens; 30% of calls go to a reasoning or hybrid model (GPT-5.5 defaults to medium effort; DeepSeek hybrids); of those, half the 600-cap calls and a tenth of the 4,000-cap calls come back empty the first time

    How often. how often finish_reason is length on the section-summary calls (max_tokens 600, line 1095) and the transcript-formatting calls (max_tokens 4000, line 328), from the provider's logs or the 'LLM 返回空内容' warnings that llm_client.py already writes

  2. LP-GE-03 Output and thinking budgets that fit the task

    backend/translator.py:302 · severity medium · saves prefill and generation · how often is assumed

    What happens. Each translation chunk is up to 4,000 characters and the output cap is 4,000 tokens including thinking. Translating 4,000 Chinese characters into English is about 3,400 visible tokens, which leaves little room for a reasoning model's thinking.

    The change. Cut translation chunks smaller (for example 2,500 characters) or raise the cap for the chunk calls and the single-text call (line 257), so a whole chunk fits with room for thinking.

    Why it helps. A chunk that runs out of room either comes back empty and is retried (both attempts billed) or comes back cut off, and the cut-off tail is lost (see the note on cut-off answers).

    Already reported. Issue #52 (closed) traced empty answers from reasoning models to thinking that used up max_tokens; the fix in 7f1c619 retries an empty answer once with a doubled cap. The caps themselves stay as they were, and an answer that is cut off but not empty is not covered (see the note). https://github.com/wendy7756/AI-Video-Transcriber/issues/52

    Estimate about 23k output tokens per 1,000 calls (estimate)

    Assumptions. translation is about 19% of calls (it runs only when the video language differs from the summary language); 30% of calls on a reasoning model, a tenth of those empty on the first try; 4,000 Chinese characters is about 2,600 English words, about 3,400 tokens

    How often. how often translation chunk calls end with finish_reason length, from the provider's logs; the cases with non-empty content are not logged by the app today

Other problems the audit found

Problems read in the code that cost no tokens of their own, such as a cost meter or an error path. Not scored.

  1. A cut-off answer is accepted as complete

    backend/llm_client.py:39 · LP-GE-12 Read the finish reason before using an answer · severity medium · the same problem as finding 2

    What happens. complete_text returns any non-empty content at line 39 without looking at finish_reason. Only an empty answer is checked for length (line 48). A transcript chunk, translation chunk or summary that stopped at max_tokens is stored and shown as if whole, and nothing is logged.

    The change. Check finish_reason before returning: on length, log it and retry once with the larger budget the empty case already uses (line 49); if the retry is still cut off, return it with a warning or raise so the existing fallback runs.

    Why it matters. A reasoning model's thinking counts toward max_tokens, so on long chunks the visible text can stop mid-sentence. Users lose the end of each chunk with no sign in the log or the UI.

    To check. Add a test next to tests/test_empty_llm_content.py where the fake client returns content='partial' with finish_reason='length' first and a full answer second; complete_text should return the second.

  2. The single-pass summary path is almost never taken

    backend/summarizer.py:1004

    What happens. summarize() uses one call only when _estimate_tokens is at most 4,000, but _estimate_tokens adds a fixed 2,500 (line 112). That leaves about 1,500 tokens: roughly 700 English words or 900 Chinese characters, 3 to 5 minutes of speech. The comment at line 1002 says the limit was raised to prefer the single-call path.

    The change. Compare the transcript's own estimate (without the 2,500) to the limit, or raise the limit for models with large context windows, keeping the chunked path for small local models.

    Why it matters. A 30-minute talk becomes about 7 section summaries plus a merge: 8 sequential calls instead of 1, about 1,400 extra output tokens and 2,300 extra prompt tokens per task, and a summary of summaries.

    To check. Log which path summarize() takes for a 10-minute and a 30-minute transcript before and after the change.

The maintainers’ response

No response from the maintainers yet.

How this was made

The llm-call-audit skill read the code and wrote findings.json; nothing was run against the project’s providers. The full audit page is what leanprompt report --html writes from the same findings.

Corrections and takedown: email info@podwarden.com or open an issue.