After detecting an anomalous sensor reading, Lieutenants Tom Paris and Torres investigate in a shuttle while Voyager collects resources. During the investigation, the signal reappears and two aliensbeam aboard the shuttle. The aliens seem to be attempting to communicate, then subsequently raise their weapons and fire on Paris and Torres, knocking them unconscious.

On Voyager, The Doctor is trying his hand at opera. He's attempting to sing O, Soave Fanciulla, a duet from Act 1 of the Earth opera La bohème by Giacomo Puccini, on the holodeck with a holographic re-creation of Giuseppina Pentangeli, one of the greatest soprano of the 22nd century. However, the hologram of Pentangeli also duplicated her vanity and demanding temperament. They stop during the first part when The Doctor accuses his partner of rushing the tempo. She retorts that he has no feel for the music and that it's like she's singing with a computer. When they finally begin to sing again The Doctor has to stop once again because he can't remember the words, much to his partner's irritation and contempt. He blames it on her for getting him so upset that he can't even remember how to sing anymore. Just as he wants to delete her he is contacted by CaptainKathryn Janeway. She informs him there is an emergency and that he needs to report to sickbay. Just before he deletes his diva he informs her that he may consider singing with Maria Callas next time instead.

Torres reawakens aboard Voyager and describe the events on the shuttle to the crew. Due to the neuroelectric shock, Paris is still unconscious and needs further treatment. While performing some common medical procedures, The Doctor seems to stutter a bit, becoming forgetful.

In the captain's ready room, the senior staff meets to discuss the incident. Neelix informs the staff that he has heard of these aliens described by Torres but shudders at the thought of encountering them. He informs the captain that nobody knows much of this race but what is known is that they are very territorial. Most ships entering their space were never heard from again, and those that returned had all their crew dead.

Back in sickbay, The Doctor continues to perform a procedure to help Paris. He begins to realize that he's having trouble remembering the procedure, and asks for Kes for assistance. After this incident, The Doctor reports his failings to Torres. To solve the problem, Torres transfers The Doctor into the holodeck, where Kes learns from a holographic recreation of The Doctor's creator, Lewis Zimmerman, that The Doctor's program is degrading from having been online far longer than it was originally designed for.

Meanwhile, EnsignHarry Kim devises a method to slip through the alien territory unnoticed by modifying the shield generators to effectively hide the ship from the sensor net. It is noted that traveling at warp 9.75 for twelve hours would take them a third of the way through the most narrow portion of the alien territory. Despite Tuvok's protest, Janeway insists on the plan and sets it in motion.

Once at the border of the alien territory, the stealth shielding is activated and the ship begins traveling through. They note a swarm of the alien vessels, all powered down and initially inactive. However, sensors indicate a separate ship that doesn't appear to belong in the area, so they drop out of warp to investigate. Their scans indicate that it is a Mislenite freighter and that there is one life sign on the ship. From the freighter, they beam Chardis on board. He tells them that he inadvertently traveled into Swarm space and his ship was attacked by numerous Swarm vessels. Rather than attacking with weaponry, they drained the energy from his ship and attempted to crush it.

While investigating the ship, one of the alien craft that had still been attached to it powers up and scans Voyager. It emits a pulse that cancels the stealth modifications to the shields and Voyager is detected by the Swarm vessels.

They pursue Voyager and attempt to incapacitate the ship. Several of the alien crew, similar to those seen by Paris and Torres, attempt to teleport to the bridge and overwhelm Voyager's crew. During these raids, Ensign Kim tries a new tactic: he sends a feedback loop pulse to the Swarm, causing most of the ships attached to Voyager to be destroyed. The Swarm backs off and they continue on their way, unabated.

Thanks to Kes convincing the Zimmerman hologram that The Doctor must be saved, The Doctor's program is fixed by overlaying a holomatrix from the Zimmerman hologram, thus expanding his memory capabilities. This process restabilizes the program's circuits and appears to have at least partially kept most of The Doctor's memories intact. The Doctor does not remember any of his personal relationships at first, but still remembers his opera.

"You are an amateur, you have no sense of rubato, no rallentando. It's like singing with a computer!"

- Giuseppina Pentangeli, after the Doctor paused playback and accused her of rushing the tempo

"Computer, pause music."
"What now?"
"I just forgot the words."
"I have so far never forgotten the lyric, that's the difference between amateur and professionali."
"It's just a momentary lapse, no need to over-react."
"I want another partner!"
"Addio, (goodbye), Madam, next time I'll take my chances with Maria Callas! Computer, delete the diva."
"Imbecille, pensa veramente... (Imbecile, he truly thinks...)" as her program goes offline.

- The Doctor and Giuseppina Pentangeli

"All the sopranos seem to have the most irritating personalities. These women are arrogant, superior, condescending; I can't imagine anyone behaving that way."

- The Doctor

"Don't touch that!"

- Dr. Zimmerman

"Look at all this useless information floating around your buffer : friendships with the crew, relationships with... women? Do they find you attractive?"

- Dr. Zimmerman to The Doctor

"lt was only during my off hours."
"You're supposed to be off during your off hours!"

"I can see where you get your charming personality."
"Not to mention my hairline."

- B'Elanna Torres and The Doctor

"We are aware of that option. Would it be possible to expand his memory circuits instead?"
"Of course. Schedule it for your next maintenance layover at McKinley Station."
"I'm afraid that isn't possible - we're thousands of light years from Federation space."
"Well, there's nothing more I can do. Either reinitialize it or live with the knowledge that eventually this EMH will end up with the intellectual capacity of a parsnip."
"(panicking) What are you saying?!"

Prior to the writing of this episode, actor Robert Picardo suggested a story idea that was similar to how this episode turned out, as both involved a holographic depiction of Lewis Zimmerman. Shortly after completing work on Star Trek: Voyager's second season, Picardo explained, "I would like an exploration of the man that developed my program. I have suggested a story idea to them about this Doc Zimmerman character, and what would make him design the emergency medical hologram program. Specifically, I've suggested that he no longer practices medicine. In doing volunteer work in the most upsetting medical emergency situations, he witnessed something that has rendered him unable to practice anymore, so he creates the holographic doctor program to complete him as a doctor. He doesn't have it anymore to interact directly with patients. In other words, he is a very frightened, and uncommunicative, an unentitled, shy, pathetic man, versus his creation. We would meet them both on the Holodeck. He would be in the ship's memory banks." (Cinefantastique, Vol. 28, No. 4/5, p. 97)

This is the only episode of Star Trek: Voyager that Michael Sussman wrote alone as well as the only episode of Voyager's third season that he worked on. Having previously contributed the story for the second season installment "Meld", Sussman – following his work here – later went on to co-write nine subsequent episodes of Star Trek: Voyager and twenty-two of Enterprise.

Robert Picardo believed The Doctor's condition in this episode was analogous to Alzheimer's Disease. In fact, the episode may have been partly conceived of as such an analogy. Shortly before Voyager's third season began its initial airing, Picardo (having been informed of the episode by that point) enthused, "We're doing an interesting Alzheimer's analogy which I'm very excited about [....] It's a very interesting script idea [....] I'm very thrilled by the analogy with an obviously readily identifiable Human condition and it should be a very exciting story." (Star Trek Monthly issue 20) He also commented, "It's a very interesting story with a clear parallel to Alzheimer's Disease in humans." (The Official Star Trek: Voyager Magazine, issue #10)

It was Robert Picardo himself who originally came up with the idea of having The Doctor sing. Following work on the second season, Picardo revealed, "I have asked that the holographic doctor be an opera fan and actually sing opera. I got a call from Jeri Taylor yesterday asking me the specifics of my vocal range. So that I think that's in the works." (Cinefantastique, Vol. 28, No. 4/5, p. 97) Picardo later referred to the idea of The Doctor singing as "a wild suggestion of mine that was taken seriously." (Star Trek Monthly issue 20) Shortly after completing work on the episode, Picardo further explained, "On a humorous level, I suggested to Jeri Taylor over a year ago that the Doctor develop an interest in opera. That just seemed so wildly inappropriate." (The Official Star Trek: Voyager Magazine, issue #10) Ultimately, Picardo was pleased that this suggestion was incorporated into the episode's plot. Of his character's singing, Picardo said, "I think that's a fun element, that the Doctor now has something he does in his discretionary time, like any other crewman on the ship. So, I hope we bring that back." (The Official Star Trek: Voyager Magazine, issue #10)

Robert Picardo was also instrumental in deciding how The Doctor should relate to the diva near the start of this episode. Picardo noted, "I suggested the joke that the Doctor was immediately distraught the moment the soprano began to sing, as if she had made an error instantly." (Star Trek Monthly issue 30, p. 18)

Robert Picardo found that playing both The Doctor and the holographic Dr. Zimmerman in this episode was "interesting." He jokingly added, "I was the guest star. Now I can complain and bitch about what a jerk the co-star was." (The Official Star Trek: Voyager Magazine, issue #10) The fact that Picardo plays two characters that look virtually identical thrilled his two young daughters. "They particularly liked 'The Swarm'," Picardo commented, "because there were two Daddies, talking to myself." (Cinefantastique, Vol. 29, No. 6/7, p. 92)

Robert Picardo also provided The Doctor's singing voice for this episode. (Star Trek: Voyager Companion) He remarked, "I was particularly proud of that because I did my own singing. I asked to do [it], and I worked very hard on that." (Cinefantastique, Vol. 29, No. 6/7, p. 90) Picardo additionally remarked, "'The Swarm' was quite a challenging episode. I've never worked so long on something so brief as that 27 seconds of opera!" In fact, the motive for Picardo suggesting that The Doctor might become immediately distraught with the soprano when she started to sing was that it would allow him to avoid a difficult moment in the composition. "The reason I suggested that joke," Picardo explained, "was a way of getting me out of singing the highest note in the piece!" (Star Trek Monthly issue 30, p. 18)

Torres actress Roxann Dawson enjoyed her character's scenes with The Doctor in this episode. "That was a great opportunity to work with Bob Picardo and to explore B'Elanna's relationship with The Doctor," the actress enthused. "I liked the fact that he's a character who's starting to affect me for the first time. I loved the fact that, to B'Elanna, he had always been just a computer, and in this episode she got to see he had this... humanity." She also said of their relationship, "I love the fact that The Doctor can tick me off so much at one moment, but at other moments there is an element of respect, when he does something that impresses me. For example, when I thought we were losing him and his memory [i.e., in this episode], I suddenly realize that I need him, that he has grown on me." (The Official Star Trek: Voyager Magazine, issue #12) Robert Picardo also enjoyed the scenes of this episode that involve both The Doctor and B'Elanna Torres, describing them as "some good moments." (The Official Star Trek: Voyager Magazine', issue #10)

At some point after he learned that Paris would be gravely injured in this episode, actor Robert Duncan McNeill complained to Voyager's team of writer-producers. "I said to the producers, 'I thought we were going to make me an action hero this year, not a victim,'" McNeill recounted. "I [kept] winding up on the verge of death." Ultimately, however, McNeill enjoyed this episode. He noted, "'The Swarm' was fun for me." He went on to say that the pleasure he took from this installment was due to the flirtatious interaction between Paris and B'Elanna Torres in the episode's teaser. (The Official Star Trek: Voyager Magazine, issue #11)

Robert Picardo found that the production of the scenes in which both The Doctor and Dr. Zimmerman appear was extremely challenging, although he also felt that the time it took to shoot those scenes seemed to whiz by. "The episode was [...] very challenging from a technical point of view, because of the scenes where I had to play opposite myself as Dr Zimmerman," Picardo said. "The technology involved in compositing the two images is quite technical for an actor – obviously, you have to look at your other self who isn't there and maintain certain eye-lines with off-camera marks, and do things like that which really enhance the illusion. I was pleased with the way that it turned out, particularly as we shot those scenes so quickly – one day I changed wardrobe between Zimmerman's engineering uniform and my holographic medical uniform 18 or 19 times!" (Star Trek Monthly issue 30, p. 18) The production of these scenes also involved Mitch Suskin, who recalled, "We [...] had a lot of fun with the splits of the two Doctors in that show. Marvin Rush, the director of photography, helped us come up with some great camera moves in the shot, even though there was a split going on, and made it really work." (Cinefantastique, Vol. 29, No. 6/7, p. 104)

From this episode onward, Foundation Imaging became the regular CGI supplier for Star Trek: Voyager. CGI effects director Ron Thornton said of Foundation, "The first episode that we did spaceship work on for Voyager was 'The Swarm,' where thousands of little spaceships ended up attacking Voyager." (The Official Star Trek: Voyager Magazine, issue #16) This was also the second episode that Mitch Suskin worked on, as visual effects supervisor, he having joined the series with the earlier third season installment "The Chute". Having utilized Digital Muse on that episode, Suskin had confidence that Ron Thornton – with whom Suskin had worked on Babylon 5 – could manage the effects work required for this episode. "When it came time to do 'The Swarm,'" Suskin remembered, "I knew that it was the kind of thing that I'd done with him before, and decided to try a show with Foundation [....] In addition to the CG on that show, which I felt a lot better about," Suskin continued, comparing this episode to "The Chute", "I was feeling a lot more comfortable just working with Star Trek." (Star Trek Monthly issue 30, p. 104)

As for the small attacking ships of the Swarm species – which the effects team had to design from scratch – Mitch Suskin described them as "little trilobyte ships." He continued by recalling, "Rick Sternbach [senior illustrator] provided us with the basic design, and Ron Thornton carried it forward." (Star Trek Monthly issue 30, p. 104)

A screen with different noses, eyes, and ears is seen in the Jupiter Station lab. It also features facial features with blue skin, so it can be assumed that Doctor Zimmerman worked with Andorian or Bolian holograms (or holograms of other blue-skinned species).

This episode marks the first time anybody says "EMH".

Following the appearance of The Doctor singing in this episode, several subsequent episodes feature The Doctor singing with vocals that were, as in this episode, provided by Robert Picardo himself. (Star Trek: Voyager Companion)

Tom Paris and B'Elanna Torres begin a flirtation in the teaser of this episode that, as the series progresses, ultimately develops into them becoming married and having a daughter, Miral Paris. While explaining that this episode was fun for him, Robert Duncan McNeill referred to the scene wherein his character and Torres engage in flirtatious banter as "my first little flirting scene with B'Elanna". He continued by saying, "I see that they're going to develop that somehow. They're going to do it slow and steady, I think. I'm looking forward to seeing how that develops." (The Official Star Trek: Voyager Magazine, issue #11)

In a conversation between The Doctor and Kes, they reference The Doctor's activation, as seen in VOY: "Caretaker", as well as The Doctor having massaged Kes' feet while she considered having a child, which occurs in VOY: "Elogium".

This episode is the second in a row (after "The Chute") to feature Tom Paris being gravely wounded.

Although this episode takes place before VOY: "Future's End", according to The Doctor's comments, the stardates suggest otherwise.

Robert Picardo initially thought that the predicament in which The Doctor is left at the end of this episode would affect future episodes. While he was under this impression, he stated, "I think that the audience has a sense, when they see me, of what I am and what I'm likely to mean to the weekly story. It's a nice feeling that my character seems defined. So, of course, we're throwing a monkey wrench into all of that." Again referring to this episode, he observed, "At the very end [...] everything is very up in the air. It's a great concept and it presents an interesting challenge to me as an actor, because I may have to start the character over from scratch." (The Official Star Trek: Voyager Magazine, issue #10) About a year later (during production on Voyager's fourth season), Picardo commented, "There's a tremendous desire among the makers of our show to keep things self-contained. They don't like to serialize that much and, if they do, it's only as a two-parter. They tend not to carry arcs through a number of episodes. So, we really had to throw out the whole notion of the Doctor losing all of his memory, being rebooted and having to redevelop his personality. We couldn't really follow through with that in a way that I would have hoped we would. It was still a strong episode and an acting challenge for me, but I do regret somewhat that we couldn't have carried the aftermath of that experience through a number of episodes." (The Official Star Trek: Voyager Magazine, issue #18)