Wanted to ask a question about ollama, but i think i hear only echo here 😅

  • Scipitie@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    9
    ·
    2 days ago

    Just go with the question instead :p But I’ll shoot some answers, perhaps one’s for you!

    Ollana has a few advantages, yes. - Mainly ease of use!

    Llama.cpp is more performant at least on non Macs.

    No, wouldn’t recommend that.

    Yes, sure, try!

    If you round Pi to four you get all kinds of interesting reactions from engineers.

    Echo echo echo?

    But on a serious note: just ask!

  • PrincessCory@lemmy.wtfOP
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 days ago

    Glad to hear you are all here. I noticed that whatever llm i use, they all have prity limited “memory” of how long they remember our conversacion. I mean if chat is wery short, they tend to remember what we were talking wery well. But if chat gets a bit longer they quickly start removing upper parts of the chat and remember only some part abowe our curent stage.

    Thats why they easly get lost, and dont know anymore what we were talking about and what they need to answer now…

    My pc specs are: Arxh Linux with KDE Plasma Gpu - Rx 6800XT 16GB Cpu - Ryzen 9 5950x 16x Ram - 64GB DDR4 A couple of ssd-s and good Corsair PS 1000W

    • tal@lemmy.today
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      50 minutes ago

      I noticed that whatever llm i use, they all have prity limited “memory” of how long they remember our conversacion. I mean if chat is wery short, they tend to remember what we were talking wery well. But if chat gets a bit longer they quickly start removing upper parts of the chat and remember only some part abowe our curent stage.

      Thats why they easly get lost, and dont know anymore what we were talking about and what they need to answer now…

      Yup. The context window only goes so far.

      If you have the memory to spend, you can get it pretty far out, depending on the model (which is also a factor). I’m currently mostly using a Llama-3-derived model (AnubisLemonade) with a 128k context window on a 128GB Framework Desktop. IIRC, there have been some subsequent models that can go substantially further, though I understand that the response quality degrades on them. The problem is that systems with that much memory available have gotten really expensive over the past nine months or so and are probably going to stay expensive at least through the end of 2027.

      I use llama.cpp these days, not ollama, but I’d guess that it’s probably possible to configure ollama for a larger context window as well, up to the maximum that your model can handle, though I can’t give specifics as to configuration.

      searches

      https://docs.ollama.com/faq

      How can I specify the context window size?

      By default, Ollama uses a context window size of 4096 tokens. This can be overridden with the OLLAMA_CONTEXT_LENGTH environment variable. For example, to set the default context window to 8K, use:

      OLLAMA_CONTEXT_LENGTH=8192 ollama serve
      

      If you don’t have the VRAM for a larger context window with whatever model you’re using:

      • I don’t do it, but it’s possible to, with some engines, place some model layers in main memory and have the CPU do them, and place some model layers in VRAM.

      checks

      It looks like ollama can do this; apparently it will use as much video memory as it can, and fall back to system memory.

      https://docs.ollama.com/faq

      The Processor column will show which memory the model was loaded into:

      • 100% GPU means the model was loaded entirely into the GPU
      • 100% CPU means the model was loaded entirely in system memory
      • 48%/52% CPU/GPU means the model was loaded partially onto both the GPU and into system memory

      If you’re using something like SillyTavern, from my reading, users on /r/SillyTavernAI have generally tried to occasionally summarize the past conversation and insert that into the context. There are some plugins that try to do this automatically; my impression from past reading is that they weren’t very good.

        • tal@lemmy.today
          link
          fedilink
          English
          arrow-up
          1
          ·
          12 minutes ago

          No problem. Note that there is one other notable technique to expand the amount of relevant context used specifically in SillyTavern, but it comes comes with its own drawbacks: RAG (Retrieval Augmented Generation).

          The idea here is that the system uses some kind of heuristic for what information must be relevant, and then allocates part of the context window to including that information; that portion now cannot be used to send history. SillyTavern uses what it calls “lorebooks” for RAG. This means that a given “world” has a set of keywords and then associated strings. If it sees a keyword in your prompt, then it inserts the string into the context window.

          So…okay. Say you want it to know that Smaug is a black dragon. You’d have something like:

          keyword: “Smaug” Text: “Smaug is a fire-breathing black dragon, with a vast wingspan.”

          If SillyTavern sees “Smaug”, it’ll stick that into your context window, up near the top, before submitting a prompt to ollama. So for any prompt from you that mentions “smaug”, it’ll never “forget” that Smaug is a black dragon, because that reminder will always be inserted into the context window.

          Now, there are drawbacks. One of these is that SillyTavern also uses a K-V cache; this avoids needing to recompute most of a prompt during prompt processing.

          Typically, SillyTavern prefixes the prompt you type with as much conversation history as it can as part of your prompt submitted to the LLM engine. Other than the last bit, the bit you just typed, which is now at the end, nothing changes from prompt to prompt. But…this only works if all of the prompt (up to the text you just added at the end) is unchanged from something that you’ve already submitted. If RAG is in use and a keyword is matched and an insertion is triggered, that won’t be the case, because it’ll be modifying the context from where it was last prompt.

          On my system, using RAG at all, and thus making the K-V cache potentially useless, is a huge loss. I work with large context windows. Invalidating an entire 128k context window means that SillyTavern needs to go back and process the entire prompt over again, instead of just the new text that I just added. It’d take ages to respond to each prompt, once you get enough history.

          But…if you’re working with a small context window (which reduces prompt processing time) and have high memory bandwidth, you might be willing to live with that recomputation.

          That won’t give you more history per se, unless you’re willing to summarize (or use some sort of auto-summarization system). But it will let the LLM have more information about whatever you’re currently prompting about.

          And RAG isn’t really subject to any particular size limitations. As long as you’re only inserting so much into a given context window, you could theoretically have gigabytes of data, with the LLM being provided with only a little relevant data on each prompt. I mean, you could have a database that has information on every bit of Tolkien’s world or something like that.

          I can’t offer much guidance on effective use of RAG. For my situation, it was preferable to just blow a bunch of memory, use a large context window and the K-V cache and avoid RAG. That way, the LLM “just remembers lots of history”; less work on my end. But…then you can only have it remember history (or something that you’ve inserted into history). You can’t have some system inserting data into the context from a potentially huge database. And you need a bunch of memory to make a large context window doable.

    • floquant@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      20 hours ago

      Ollama uses a context length of 4096 by default, if the conversation goes on for longer the older parts start getting removed.

      You can change that via environment variable, command line option, or even at request time (num_ctx iirc)

      On 16GB you should be able to set 64k with no issue, I run either 32k or 64k depending on the model and usecase on 12GB