Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LMStudio file context in prompts gets truncated #4491

Open
3 tasks done
pwilkin opened this issue Mar 5, 2025 · 4 comments
Open
3 tasks done

LMStudio file context in prompts gets truncated #4491

pwilkin opened this issue Mar 5, 2025 · 4 comments
Assignees
Labels
area:context-providers Relates to context providers kind:bug Indicates an unexpected problem or unintended behavior priority:medium Indicates medium priority

Comments

@pwilkin
Copy link

pwilkin commented Mar 5, 2025

Before submitting your bug report

Relevant environment info

- OS: Linux
- Continue version: VSCode 1.0.2, IntelliJ 1.0.2
- IDE version: 
- Model: granite-3.2-8b-instruct
- config:
  
   {
      "apiBase": "http://127.0.0.1:1234/v1/",
      "model": "granite-3.2-8b-instruct",
      "title": "[LM] granite-3.2-8b-instruct",
      "provider": "lmstudio",
      "contextLength": 32000,
      "completionOptions": {
        "temperature": 0.15,
        "maxTokens": 24000
      }
    }

Description

When I try to attach an XSD schema that has around 15k tokens, the schema file gets truncated, even though with other providers (such as Mistral) it gets passed correctly. This happens even if I increase the context size all the way up to 100k.

To reproduce

  1. Install LM Studio.
  2. Add a model that supports big contexts (preferrably up to 128k).
  3. Add a configuration that allows a big context length.
  4. Attach a big file (around 15k tokens).
  5. Try to attach the file in a prompt to the model.

Log output

@dosubot dosubot bot added area:context-providers Relates to context providers kind:bug Indicates an unexpected problem or unintended behavior labels Mar 5, 2025
@IngLP
Copy link

IngLP commented Mar 6, 2025

I have the same problems, long files get truncated!

@tomasz-stefaniak
Copy link
Collaborator

@pwilkin could you check your logs and see what context length the model receives? Here, for example, I see that I'm using:

{
  "contextLength": 200000,
  "temperature": 0,
  "model": "claude-3-5-sonnet-latest",
  "maxTokens": 8192
}

Image

I'm assuming that when you inspect the prompt logs the file appears truncated?

@tomasz-stefaniak tomasz-stefaniak added priority:medium Indicates medium priority and removed "needs-triage" labels Mar 10, 2025
@pwilkin
Copy link
Author

pwilkin commented Mar 10, 2025

@tomasz-stefaniak The metadata the model receives is fine, but the data is truncated already in the message. This is part of a log from LMStudio:

  "messages": [
    {
      "role": "system",
      "content": "Always include the language and file name in the i... <Truncated in logs> ...rite code blocks, for example '```python file.py'."
    },
    {
      "role": "user",
      "content": "nabler-condition\">\r\n    \t<complexContent>\r\n\t\t\t<ext... <Truncated in logs> ... \nWhat is the main element defined in this schema?"
    }
  ],
  "model": "granite-3.2-8b-instruct",
  "max_tokens": 20000,
  "temperature": 0.15,
  "stream": true
}

As you see, since the file is an XSD, it's pretty clear it has been cut at the start.

From the LMStudio metadata, we're far from the model boundaries here:

generate: n_ctx = 34816, n_batch = 2048, n_predict = 20000, n_keep = 10983

I'll add: this happens only with LMStudio. The same data passed to Mistral, Gemini or OpenRouter works just fine.

@IngLP
Copy link

IngLP commented Mar 10, 2025

@pwilkin could you check your logs and see what context length the model receives? Here, for example, I see that I'm using:

{
  "contextLength": 200000,
  "temperature": 0,
  "model": "claude-3-5-sonnet-latest",
  "maxTokens": 8192
}

Image

I'm assuming that when you inspect the prompt logs the file appears truncated?

Yes I can see the files are truncated in prompt.log.
This is true for any llm i tried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:context-providers Relates to context providers kind:bug Indicates an unexpected problem or unintended behavior priority:medium Indicates medium priority
Projects
None yet
Development

No branches or pull requests

3 participants